feat: configurable logging (stdout/file/syslog, text/JSON, per-package levels)#41
Merged
Conversation
Validates log_format, log handler enablement, log_stdout_stream, log_syslog_protocol, and log_syslog_facility in pre_gen_project.py, with corresponding tests in tests/test_bake_logging.py.
Replaces the hardcoded logging configuration with a fully conditional Jinja2 template driven by new cookiecutter.json variables: log_format, log_level, log_stdout, log_file, log_syslog, access_log_enabled, and logging_loggers. Supports text, JSON, and custom formatter classes; console (stdout/stderr), file, and syslog handlers; and configurable per-logger log levels.
Conditional generation of handlers (console, file, syslog), formatters (text, json, custom), loggers (dict-based), and access log pipeline. All driven by new log_* cookiecutter variables.
Add 22 template output tests to test_bake_logging.py covering formatters, handlers, loggers, and integration scenarios. Update test_bake_with_defaults to verify default logging configuration (stderr console handler, generic text formatter, wsgi logger, and translogger middleware).
Add how-to guide and reference page for configurable logging (Task 10). Mark location_log as deprecated in basic-config reference. Add 2.5.0 unreleased changelog entry.
gogobd
approved these changes
Mar 24, 2026
Contributor
gogobd
left a comment
There was a problem hiding this comment.
Looks good to me, tests were running locally. I tried out our current copy of the production site and everything worked as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #40.
instance.yaml— handlers (stdout/file/syslog), format (text/JSON/custom), per-package log levels, access log toggle.log_file: true.python-json-loggeras a runtime dependency.location_logis deprecated in favor oflog_file_path.New variables
log_formattexttext,json, or custom vialog_format_classlog_levelINFOlog_stdout/log_stdout_streamtrue/stderrlog_file/log_file_pathfalse/""log_syslog+_host,_port,_facility,_protocolfalseaccess_log_enabledtruelogging_loggers{"plone": "INFO", ...}Breaking changes
log_file: true.access_log_enabledis true, access log entries now also appear on stdout/syslog (previously file-only).Test plan
🤖 Generated with Claude Code