mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2024-08-29 01:18:33 +03:00
(fix) Enable and log if logging to file is enabled (#3556)
* enable logging to file also when DEBUG is active * Log a message if logging to file is enabled * log a message if DEBUG mode is enabled
This commit is contained in:
@@ -165,7 +165,10 @@ LOG_DIR = os.path.join(
|
||||
'logs',
|
||||
)
|
||||
|
||||
if LOG_TO_FILE:
|
||||
if DEBUG:
|
||||
openhands_logger.setLevel(logging.DEBUG)
|
||||
|
||||
if LOG_TO_FILE or DEBUG:
|
||||
# default log to project root
|
||||
openhands_logger.debug('Logging to file is enabled. Logging to %s', LOG_DIR)
|
||||
openhands_logger.addHandler(get_file_handler(LOG_DIR))
|
||||
@@ -175,6 +178,10 @@ openhands_logger.addFilter(SensitiveDataFilter(openhands_logger.name))
|
||||
openhands_logger.propagate = False
|
||||
openhands_logger.debug('Logging initialized')
|
||||
|
||||
if LOG_TO_FILE or DEBUG:
|
||||
openhands_logger.info('Logging to file is enabled. Logging to %s', LOG_DIR)
|
||||
if DEBUG:
|
||||
openhands_logger.info('DEBUG mode enabled')
|
||||
|
||||
# Exclude LiteLLM from logging output
|
||||
logging.getLogger('LiteLLM').disabled = True
|
||||
|
||||
Reference in New Issue
Block a user