Skip to content

Commit 3901cb7

Browse files
authored
Merge pull request #77 from SAP/message-fix
Remove stacktrace from message
2 parents 2e4d217 + 226c79b commit 3901cb7

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

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

8+
## 4.2.7 - 2024-06-27
9+
10+
### Fixed
11+
12+
- Remove stacktrace from the message element of the log
13+
814
## 4.2.6 - 2024-02-26
915

1016
### Update

sap/cf_logging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sap.cf_logging.record.request_log_record import RequestWebRecord
1111
from sap.cf_logging.record.simple_log_record import SimpleLogRecord
1212

13-
__version__ = '4.2.6'
13+
__version__ = '4.2.7'
1414

1515
_SETUP_DONE = False
1616
FRAMEWORK = None

sap/cf_logging/record/simple_log_record.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ def format(self):
7979
stacktrace = ''.join(traceback.format_exception(*self.exc_info))
8080
stacktrace = format_stacktrace(stacktrace)
8181
record['stacktrace'] = stacktrace.split('\n')
82-
record['msg'] += "\n"
83-
record['msg'] += stacktrace
8482

8583

8684
record.update(self.extra)

tests/test_job_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_exception_stacktrace():
6868

6969
assert error == {}
7070
assert 'ZeroDivisionError' in str(log_json['stacktrace'])
71-
assert 'ZeroDivisionError' in log_json["msg"]
71+
assert log_json["msg"] == 'zero division error'
7272

7373

7474
def test_exception_stacktrace_info_level():
@@ -85,7 +85,7 @@ def test_exception_stacktrace_info_level():
8585

8686
assert error == {}
8787
assert 'ZeroDivisionError' in str(log_json['stacktrace'])
88-
assert 'ZeroDivisionError' in log_json["msg"]
88+
assert log_json["msg"] == 'zero division error'
8989

9090

9191
def test_custom_fields_set():

tests/unit/formatters/test_json_formatter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,4 @@ def test_stacktrace_is_added_to_msg_field():
4747
record_object = json.loads(FORMATTER.format(log_record))
4848
assert "Dummy Exception" in "".join(record_object["stacktrace"])
4949
expected_msg = "Error found!"
50-
expected_msg += "\n"
51-
expected_msg += "\n".join(record_object["stacktrace"])
5250
assert record_object["msg"] == expected_msg

0 commit comments

Comments
 (0)