nvflare.app_common.logging.job_log_streamer module

class JobLogStreamer(log_file_name: str = 'log.txt', liveness_interval: float = 10.0, poll_interval: float = 0.5, target_parent_server: bool = False)[source]

Bases: Widget

Streams a job log file to the server in real-time.

JobLogStreamer tails the live log file from the moment the job starts and streams new bytes to the server as they are written. The stream is drained and closed cleanly when the job completes or is aborted.

The log file path is discovered by inspecting the active Python logging handlers, so it works correctly in both the simulator and production without any workspace path arithmetic.

This widget runs inside the job subprocess (CLIENT_JOB or SERVER_JOB) and must be placed in the job-level configuration (config_fed_client.json or config_fed_server.json). To stream multiple log files, add one JobLogStreamer per file.

Parameters:
  • log_file_name – base name of the log file to stream. Defaults to WorkspaceConstants.LOG_FILE_NAME ("log.txt").

  • liveness_interval – seconds between heartbeat messages when no new log bytes have been written (default 10.0). Must be less than the receiver’s idle_timeout.

  • poll_interval – seconds between polls when the log file has no new data (default 0.5).

Init the Widget.