Skip to content

Conversation

smghasempour
Copy link

@smghasempour smghasempour commented Jul 4, 2025

Add Configurable Log Formatting Options for Supervisor

Fixes #553 - This PR implements highly requested log formatting configuration options for Supervisor, addressing community feedback.

What's New

Two new configuration options:

  • logfile_format - Customizes main supervisord log messages
  • childlog_format - Customizes child process log messages (stdout/stderr)

Both support Python logging format strings with placeholders like %(asctime)s, %(levelname)s, %(process)d, etc.

Example Usage

[supervisord]
logfile_format=%(asctime)s [%(levelname)s] [PID:%(process)d] %(message)s
childlog_format=%(asctime)s [CHILD] %(message)s

Output:

# Main log
2024-01-15 10:30:15,123 [INFO] [PID:1234] supervisord started with pid 1234

# Child logs
2024-01-15 10:30:16,456 [CHILD] Starting application server

Key Features

backward compatible - existing configs work unchanged
error handling - invalid formats fall back to defaults
tests - all existing tests pass + new coverage
documentation - examples, best practices, troubleshooting

Benefits

  • Enhanced debugging with timestamps and PIDs
  • Better integration with log aggregation systems (ELK, Splunk, etc.)
  • Support for compliance logging requirements
  • Customizable formats for specific operational needs

This addresses a long-standing community request for better control over Supervisor's logging output while maintaining full compatibility.

@smghasempour smghasempour force-pushed the feature/custom-log-formatting branch from 444623f to 0b30bb3 Compare July 4, 2025 09:29
@smghasempour smghasempour marked this pull request as draft July 4, 2025 09:29
@smghasempour smghasempour marked this pull request as ready for review July 4, 2025 09:30
@smghasempour smghasempour force-pushed the feature/custom-log-formatting branch 3 times, most recently from d69082e to 01e4121 Compare July 14, 2025 10:23
@coredumperror
Copy link

This is excellent! Hope it gets merged soon. That "failing" test doesn't seem to be related to this PR, but rather an issue with the CI system itself.

@smghasempour smghasempour force-pushed the feature/custom-log-formatting branch 2 times, most recently from 9bba646 to 0b30bb3 Compare October 8, 2025 16:49
@smghasempour smghasempour marked this pull request as draft October 8, 2025 17:04
@smghasempour smghasempour force-pushed the feature/custom-log-formatting branch 3 times, most recently from df984c3 to c4efea9 Compare October 8, 2025 17:31
@smghasempour smghasempour marked this pull request as ready for review October 8, 2025 17:56
@smghasempour
Copy link
Author

The PR is ready to merge now, but I don't have merge access. I'll appreciate it if some can review and merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to specify log format

2 participants