diff --git a/setup.py b/setup.py
index a1dddaa..db14acc 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 
-VERSION = '0.2.2'
+VERSION = '0.2.3'
 
 
 setup(name='simple_json_logger',
diff --git a/simple_json_logger/formatter.py b/simple_json_logger/formatter.py
index b4eb58a..629eecb 100644
--- a/simple_json_logger/formatter.py
+++ b/simple_json_logger/formatter.py
@@ -1,7 +1,7 @@
 import logging
 try:
     from logging import _levelToName
-except ImportError:
+except ImportError:  # pragma: no cover
     from logging import _levelNames as _levelToName
 
 import traceback
@@ -32,7 +32,7 @@ class JsonFormatter(logging.Formatter):
             return obj.strftime(DATETIME_FORMAT)
         elif istraceback(obj):
             tb = ''.join(traceback.format_tb(obj))
-            return tb.strip()
+            return tb.strip().split('\n')
         elif isinstance(obj, Exception):
             return "Exception: %s" % str(obj)
         elif callable(obj):

Fix multiline log for stacktraces
Multiline stack traces must be formatted as a list of strings
diff --git a/tests/test_logger.py b/tests/test_logger.py
index a98e7f4..8094814 100644
--- a/tests/test_logger.py
+++ b/tests/test_logger.py
@@ -78,12 +78,11 @@ class LoggerTests(unittest.TestCase):
         json_log = json.loads(logged_content)
 
         exc_class, exc_message, exc_traceback = json_log['exc_info']
-        self.assertIn(member=exception_message,
-                      container=exc_message)
+        self.assertEqual('Exception: {}'.format(exception_message), exc_message)
 
         current_func_name = inspect.currentframe().f_code.co_name
-        self.assertIn(member=current_func_name,
-                      container=exc_traceback)
+        self.assertIn(current_func_name, exc_traceback[0])
+        self.assertIn('raise Exception(exception_message)', exc_traceback[1])
 
     def test_it_logs_datetime_objects(self):
         message = {

pip install -e .[dev]
parse_log_pytest
requirements.txt
freezegun==0.3.8 pytest pytest-cov codecov
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.8.0
exceptiongroup==1.2.2
freezegun==0.3.8
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
requests==2.32.3
-e git+https://github.com/diogommartins/simple_json_logger.git@1bc3c8d12784d55417e8d46b4fe9b44bd8cd1f99#egg=simple_json_logger
six==1.17.0
tomli==2.2.1
urllib3==2.3.0

name: simple_json_logger
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - freezegun==0.3.8
      - idna==3.10
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - python-dateutil==2.9.0.post0
      - requests==2.32.3
      - six==1.17.0
      - tomli==2.2.1
      - urllib3==2.3.0
prefix: /opt/conda/envs/simple_json_logger

tests/test_logger.py::LoggerTests::test_it_logs_exceptions_tracebacks
tests/test_logger.py::LoggerTests::test_it_calls_stderr_for_high_log_leves tests/test_logger.py::LoggerTests::test_it_calls_stdout_for_low_levels_and_stderr_for_high_levels tests/test_logger.py::LoggerTests::test_it_replaces_default_handlers_if_a_stream_is_provided
tests/test_logger.py::LoggerTests::test_callable_values_are_called_before_serialization tests/test_logger.py::LoggerTests::test_extra_param_adds_content_to_document_root tests/test_logger.py::LoggerTests::test_extra_parameter_adds_content_to_root_of_all_messages tests/test_logger.py::LoggerTests::test_extra_parameter_on_log_method_function_call_updates_extra_parameter_on_init tests/test_logger.py::LoggerTests::test_flatten_instance_attr_adds_messages_to_document_root tests/test_logger.py::LoggerTests::test_flatten_instance_attr_overwrites_default_attributes tests/test_logger.py::LoggerTests::test_flatten_method_parameter_does_nothing_is_message_isnt_a_dict tests/test_logger.py::LoggerTests::test_flatten_method_parameter_overwrites_default_attributes tests/test_logger.py::LoggerTests::test_flatten_param_adds_message_to_document_root tests/test_logger.py::LoggerTests::test_it_escapes_strings tests/test_logger.py::LoggerTests::test_it_forwards_serializer_kwargs_instance_attr_to_serializer tests/test_logger.py::LoggerTests::test_it_forwards_serializer_kwargs_parameter_to_serializer tests/test_logger.py::LoggerTests::test_it_logs_current_log_time tests/test_logger.py::LoggerTests::test_it_logs_datetime_objects tests/test_logger.py::LoggerTests::test_it_logs_valid_json_string_if_message_is_json_serializeable tests/test_logger.py::LoggerTests::test_it_logs_valid_json_string_if_message_isnt_json_serializeable
setup.py simple_json_logger/formatter.py
setup.py simple_json_logger/formatter.py