Skip to content

Commit 4e4b409

Browse files
committed
feature: add thread local trace_id and trace_reason to logging.
Added trace_id to default logging so that all logs for a given request share the same trace_id. This allows correlation of logs across a request. admin_guide.txt, upgrading.txt: add docs update sample configs to include trace_id. rewrite logging docs in admin_guide. Hopefully they are clearer now. clean up some stuff in the logging config file docs. admin.py: add decorators to run_command to enable trace_id. change calls to db.commit() to use run_command to get trace_id. configuration.py: clean up imports. update docstrings, comments and inline docs. add trace_id to default log format. add function for testing decorated with trace_id. add support for dumping stack trace in logging. add check for pytest in sys.modules to enable log propagation when pytest is running. Otherwise tests fail as the caplog logger doesn't see the roundup logs. logcontext.py: new file to handle thread local contextvar mangement. mailgw.py: add decorators for trace_id etc. scripts/roundup_xlmrpc_server.py: add decorators for trace_id etc. fix encoding bug turning bytes into a string. fix command line issue where we can't set encoding. (not sure if changing encoding via command line even works) cgi/client.py decorate two entry points for trace_id etc. cgi/wsgi_handler.py: decorate entry point for trace_id etc. test/test_config.py: add test for trace_id in new log format. test various cases for sinfo and errors in formating msg.
1 parent b9b8478 commit 4e4b409

File tree

11 files changed

+889
-107
lines changed

11 files changed

+889
-107
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Features:
4444
or put them in the input buffer for editing. (John Rouillard)
4545
- add format to logging section in config.ini. Used to set default
4646
logging format. (John Rouillard)
47+
- the default logging format template includes an identifier unique
48+
for a request. This identifier (trace_id) can be use to identify
49+
logs for a specific transaction. Logging also supports a
50+
trace_reason log token with the url for a web request. The logging
51+
format can be changed in config.ini. (John Rouillard)
4752

4853
2025-07-13 2.5.0
4954

0 commit comments

Comments
 (0)