Skip to content

Reduce the noise from loggers #8833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 2, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions openhands/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,20 @@ def log_uncaught_exceptions(
) # default log to project root
openhands_logger.debug(f'Logging to file in: {LOG_DIR}')

# Exclude LiteLLM from logging output
logging.getLogger('LiteLLM').disabled = True
logging.getLogger('LiteLLM Router').disabled = True
logging.getLogger('LiteLLM Proxy').disabled = True
# Exclude loquacious loggers
LOQUACIOUS_LOGGERS = [
'engineio',
'engineio.server',
'LiteLLM',
'LiteLLM Router',
'LiteLLM Proxy',
'socketio',
'socketio.client',
'socketio.server',
]

for logger_name in LOQUACIOUS_LOGGERS:
logging.getLogger(logger_name).setLevel('WARNING')
Copy link
Collaborator

@enyst enyst Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this is a good idea in general, but FYI litellm was disabled because it can leak API keys in logs, not only because it's a lot of output.

Edited to add: on errors, IIRC. So I think it will (if it's still doing it) on warning too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - I was not aware of that - I have fully disabled the LiteLLM loggers again and added a note explaining why they were disabled



class LlmFileHandler(logging.FileHandler):
Expand Down
Loading