Moler creates log files automatically as soon as aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nokia/moler/llms.txt
Use this file to discover all available pages before exploring further.
LOGGER section is present in your configuration. You get two categories of log files without any extra code:
moler.log— main log showing high-level activity across all devices (commands started/finished, state transitions, events)moler.<DeviceName>.log— one file per device showing everything sent to and received from that device, with directional markers
Minimal setup
Add aLOGGER section to your YAML config file:
./logs/moler.log and per-device log files (e.g., ./logs/moler.MyMachine.log) are created automatically.
LOGGER section fields
| Field | Type | Description |
|---|---|---|
PATH | string | Directory where log files are written. Defaults to the current working directory. |
DATE_FORMAT | string | strftime-style format for timestamps in log entries. Default: "%d %H:%M:%S". |
MODE | string | File open mode: "a" (append, default) or "w" (overwrite on each run). |
RAW_LOG | bool | When True, creates additional .raw.log binary files with the exact bytes sent/received. |
DEBUG_LEVEL | string | Enable verbose logging: "TRACE" (most verbose), "DEBUG", or "INFO". |
ERROR_LOG_STACK | bool | When True, log entries for errors include the full call stack. Default: False. |
LOG_ROTATION | mapping | Sub-section configuring log file rotation (see below). |
CONSOLE_LOGS | list | Logger names that should also write to stdout. |
Log rotation
If your test runs are long, log files can grow large. Moler supports both size-based and time-based rotation through theLOG_ROTATION sub-section.
Size-based rotation
Split log files when they reach a given size. The example below rotates at 5 MB and keeps up to 999 files:Time-based rotation
Split log files at a fixed time interval. The example below rotates every 30 minutes:LOG_ROTATION fields
| Field | Type | Description |
|---|---|---|
KIND | string | "size" for size-based rotation, "time" for time-based rotation. |
INTERVAL | int | Rotation threshold: bytes when KIND: size, seconds when KIND: time. Default: 102400 (100 KB). |
BACKUP_COUNT | int | Maximum number of rotated files to keep. Default: 999. |
COMPRESS_AFTER_ROTATION | bool | Compress each rotated file using COMPRESS_COMMAND. Default: False. |
COMPRESS_COMMAND | string | Shell command used to compress a rotated file. Uses {compressed} and {log_input} placeholders. Default: "zip -9mq {compressed} {log_input}". |
COMPRESSED_FILE_EXTENSION | string | File extension appended to compressed files. Default: ".zip". |
Log compression after rotation
To save disk space, enableCOMPRESS_AFTER_ROTATION. An external tool (default: zip) is called after each rotation.
{log_input} placeholder is replaced with the path to the just-rotated file; {compressed} is replaced with the desired output archive path.
What each log file contains
Main log (moler.log)
The main log gives a high-level view of test progress across all devices. Connection data is not shown — only commands, events, and state transitions.Per-device log (moler.<DeviceName>.log)
Each device log shows the raw terminal conversation with directional markers:> for data sent to the device and < for data received from it.
moler.RebexTestMachine.log:
moler.MyMachine.log:
| separators so every line of a block is clearly associated with its timestamp.
Runtime control
Enable and disable device logging
You can suppress logging for a specific device at runtime. Use this sparingly — missing logs make failure investigation significantly harder.Change log file suffix
You can add a suffix to log file names to distinguish different test phases or test cases, then remove it or change it again as the test progresses.change_logging_suffix has no effect when log rotation is active (KIND is set). Rotating handlers manage their own file naming.Relocate logs at runtime
Debug logging
SetDEBUG_LEVEL in the config or via the MOLER_DEBUG_LEVEL environment variable to write additional detail:
DEBUG_LEVEL: TRACE or DEBUG_LEVEL: DEBUG, an additional moler.debug.log file is created with per-logger, per-thread, per-file detail: