Skip to content

Commit

Permalink
rename file and fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nvkevlu committed Nov 12, 2024
1 parent 96e6611 commit a11371a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/resources/log.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion nvflare/apis/fl_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion nvflare/private/fed/app/simulator/log.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions nvflare/private/fed/client/client_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions nvflare/private/fed/utils/fed_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit a11371a

Please sign in to comment.