def test_exception_traceback_is_logged_as_string_array_with_json_formatter(self):
        """Test the exact JSON format of access logs"""
        # Set up environment for JSON format
        with patch.dict('os.environ', {
            'MARQO_LOG_LEVEL': 'info',
            'MARQO_LOG_FORMAT': 'json'
        }):
            importlib.reload(marqo_logging)

            # replace the stream object of the handler
            stream = io.StringIO()
            logging.root.handlers[0].stream = stream

            # Generate log message
            logger = marqo_logging.get_logger('test')
            try:
                raise ValueError('test exception')
            except ValueError as e:
                logger.error("OOPS, error occurred", exc_info=True)

            output = stream.getvalue()
            import json
            try:
                log_data = json.loads(output)
                self.assertEqual(log_data['level'], 'ERROR')
                self.assertEqual(log_data['name'], 'test')
                self.assertEqual(log_data['message'], 'OOPS, error occurred')
                self.assertIn('timestamp', log_data)
                self.assertIn('process', log_data)
                self.assertIsInstance(log_data['exc_info'], list)
                self.assertEqual('Traceback (most recent call last):', log_data['exc_info'][0])
            except json.JSONDecodeError:
                self.fail("Output is not valid JSON")
Test the exact JSON format of access logs
tests/unit_tests/marqo/test_logging.py