diff --git a/docs/resources/log.config b/docs/resources/log.config index f36fcb1914..4fd98dcb48 100644 --- a/docs/resources/log.config +++ b/docs/resources/log.config @@ -21,7 +21,7 @@ args=(sys.stdout,) class=FileHandler level=ERROR formatter=fullFormatter -args=('error.log', 'a') +args=('error_log.txt', 'a') [formatter_fullFormatter] format=%(asctime)s - %(name)s - %(levelname)s - %(message)s \ No newline at end of file diff --git a/nvflare/apis/fl_constant.py b/nvflare/apis/fl_constant.py index 058762de5e..f5604ff1db 100644 --- a/nvflare/apis/fl_constant.py +++ b/nvflare/apis/fl_constant.py @@ -375,7 +375,7 @@ class WorkspaceConstants: DEFAULT_LOGGING_CONFIG = LOGGING_CONFIG + ".default" AUDIT_LOG = "audit.log" LOG_FILE_NAME = "log.txt" - ERROR_LOG_FILE_NAME = "error.log" + ERROR_LOG_FILE_NAME = "error_log.txt" STATS_POOL_SUMMARY_FILE_NAME = "stats_pool_summary.json" STATS_POOL_RECORDS_FILE_NAME = "stats_pool_records.csv" diff --git a/nvflare/private/fed/app/simulator/log.config b/nvflare/private/fed/app/simulator/log.config index 3b85259cfd..19a5f1ab13 100644 --- a/nvflare/private/fed/app/simulator/log.config +++ b/nvflare/private/fed/app/simulator/log.config @@ -21,7 +21,7 @@ args=(sys.stdout,) class=FileHandler level=ERROR formatter=fullFormatter -args=('error.log', 'a') +args=('error_log.txt', 'a') [formatter_fullFormatter] format=%(asctime)s - %(name)s - %(levelname)s - %(message)s diff --git a/nvflare/private/fed/client/client_executor.py b/nvflare/private/fed/client/client_executor.py index 6d6e06cb15..4b2aceb896 100644 --- a/nvflare/private/fed/client/client_executor.py +++ b/nvflare/private/fed/client/client_executor.py @@ -396,13 +396,15 @@ def _wait_child_process_finish(self, client, job_id, allocated_resource, token, self.logger.info(f"run ({job_id}): child worker process finished with RC {return_code}") - should_report_error_log = False # set this to True to report error.log to server, todo: get value from client config + should_report_error_log = ( + False # set this to True to report error log to server, todo: get value from client config + ) if should_report_error_log: error_log_contents = None workspace_object = Workspace(root_dir=workspace, site_name=client.client_name) error_log_path = workspace_object.get_app_error_log_file_path(job_id=job_id) if os.path.exists(error_log_path): - with open(error_log_path, 'r') as f: + with open(error_log_path, "r") as f: error_log_contents = f.read() if error_log_contents: request = new_cell_message( @@ -416,7 +418,7 @@ def _wait_child_process_finish(self, client, job_id, allocated_resource, token, message=request, optional=True, ) - self.logger.info(f"Reported contents of error.log to server!") + self.logger.info(f"Reported contents of error log to server!") if return_code in [ProcessExitCode.UNSAFE_COMPONENT, ProcessExitCode.CONFIG_ERROR]: request = new_cell_message( diff --git a/nvflare/private/fed/utils/fed_utils.py b/nvflare/private/fed/utils/fed_utils.py index 60651700c9..9dc0d73de6 100644 --- a/nvflare/private/fed/utils/fed_utils.py +++ b/nvflare/private/fed/utils/fed_utils.py @@ -65,7 +65,7 @@ def add_logfile_handler(log_file: str): The purpose for this is to handle dynamic log file locations. If a handler named errorFileHandler is found, it will be used as a template to - create a new handler for writing to the error.log file at the same directory as log_file. + create a new handler for writing to the error log file at the same directory as log_file. The original errorFileHandler will be removed and replaced by the new handler. Each log file will be rotated when it reaches 20MB. @@ -90,7 +90,7 @@ def add_logfile_handler(log_file: str): if not configured_error_handler: return - error_log_file = os.path.join(os.path.dirname(log_file), "error.log") + error_log_file = os.path.join(os.path.dirname(log_file), WorkspaceConstants.ERROR_LOG_FILE_NAME) error_file_handler = RotatingFileHandler(error_log_file, maxBytes=20 * 1024 * 1024, backupCount=10) error_file_handler.setLevel(configured_error_handler.level) error_file_handler.setFormatter(configured_error_handler.formatter)