Honor user-set flag for LOG_TO_FILE (#10078)

This commit is contained in:
Chase Farmer 2025-08-04 15:20:20 -04:00 committed by GitHub
parent a36d1673fa
commit d30f77c60a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,11 @@ else:
if DEBUG:
LOG_LEVEL = 'DEBUG'
LOG_TO_FILE = os.getenv('LOG_TO_FILE', 'False').lower() in ['true', '1', 'yes']
LOG_TO_FILE = os.getenv('LOG_TO_FILE', str(LOG_LEVEL == 'DEBUG')).lower() in [
'true',
'1',
'yes',
]
DISABLE_COLOR_PRINTING = False
LOG_ALL_EVENTS = os.getenv('LOG_ALL_EVENTS', 'False').lower() in ['true', '1', 'yes']
@ -362,7 +366,6 @@ if DEBUG:
openhands_logger.addFilter(StackInfoFilter())
if current_log_level == logging.DEBUG:
LOG_TO_FILE = True
openhands_logger.debug('DEBUG mode enabled.')
if LOG_JSON: