logging: add configurable log file level, default to INFO - #11
Merged
Conversation
The log file handler was hardcoded to DEBUG whenever a log file was configured. On a busy deployment this is a lot of volume, most of it the per-message firehose (send/receive/write lines) that is only useful when debugging the wire protocol. Add a `log.level` config option (under the existing `log:` section, values `debug` or `info`) controlling the file handler level, and change the default to INFO so the file is readable out of the box. Note: this is a behavioral change. A deployment that configured a log file specifically to capture DEBUG now gets INFO unless it adds `log.level: debug`. The `--verbose`/`-v` flag only affects the stderr handler, not the file, so it does not restore debug-in-file either. Also demote three per-connection server log lines (client connected, client closed, closing connection) from INFO to DEBUG: agents reconnect on every send retry and every rename, so these are routine churn rather than noteworthy events and would otherwise dominate the INFO file log. While here, harden the `log:` config access against a bare `log:` key (YAML null), which the new always-evaluated level lookup would otherwise turn into an AttributeError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168heNfiwZUhaUxzU8qhNY6
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.
The log file handler was hardcoded to DEBUG whenever a log file was configured. On a busy deployment this is a lot of volume, most of it the per-message firehose (send/receive/write lines) that is only useful when debugging the wire protocol.
Add a
log.levelconfig option (under the existinglog:section, valuesdebugorinfo) controlling the file handler level, and change the default to INFO so the file is readable out of the box.Note: this is a behavioral change. A deployment that configured a log file specifically to capture DEBUG now gets INFO unless it adds
log.level: debug. The--verbose/-vflag only affects the stderr handler, not the file, so it does not restore debug-in-file either.Also demote three per-connection server log lines (client connected, client closed, closing connection) from INFO to DEBUG: agents reconnect on every send retry and every rename, so these are routine churn rather than noteworthy events and would otherwise dominate the INFO file log.
While here, harden the
log:config access against a barelog:key (YAML null), which the new always-evaluated level lookup would otherwise turn into an AttributeError.Claude-Session: https://claude.ai/code/session_0168heNfiwZUhaUxzU8qhNY6