Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).

The format is based on [Keep a Changelog](http://keepachangelog.com/).

## 4.2.7 - 2024-06-27

### Fixed

- Remove stacktrace from the message element of the log

## 4.2.6 - 2024-02-26

### Update
Expand Down
2 changes: 1 addition & 1 deletion sap/cf_logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sap.cf_logging.record.request_log_record import RequestWebRecord
from sap.cf_logging.record.simple_log_record import SimpleLogRecord

__version__ = '4.2.6'
__version__ = '4.2.7'

_SETUP_DONE = False
FRAMEWORK = None
Expand Down
2 changes: 0 additions & 2 deletions sap/cf_logging/record/simple_log_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def format(self):
stacktrace = ''.join(traceback.format_exception(*self.exc_info))
stacktrace = format_stacktrace(stacktrace)
record['stacktrace'] = stacktrace.split('\n')
record['msg'] += "\n"
record['msg'] += stacktrace


record.update(self.extra)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_job_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_exception_stacktrace():

assert error == {}
assert 'ZeroDivisionError' in str(log_json['stacktrace'])
assert 'ZeroDivisionError' in log_json["msg"]
assert log_json["msg"] == 'zero division error'


def test_exception_stacktrace_info_level():
Expand All @@ -85,7 +85,7 @@ def test_exception_stacktrace_info_level():

assert error == {}
assert 'ZeroDivisionError' in str(log_json['stacktrace'])
assert 'ZeroDivisionError' in log_json["msg"]
assert log_json["msg"] == 'zero division error'


def test_custom_fields_set():
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/formatters/test_json_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,4 @@ def test_stacktrace_is_added_to_msg_field():
record_object = json.loads(FORMATTER.format(log_record))
assert "Dummy Exception" in "".join(record_object["stacktrace"])
expected_msg = "Error found!"
expected_msg += "\n"
expected_msg += "\n".join(record_object["stacktrace"])
assert record_object["msg"] == expected_msg