4.4 Monitoring with Log Files
The SQLcl daemon includes a built-in reporting system for job execution events, scheduler lifecycle events, and configuration issues. It records key events and errors in log files to help you debug and monitor scheduled jobs.
Learn about log formats, log file locations, and their descriptions.
4.4.1 Log Formats
The log files have a semi-structured format, where each log line contains
tokens enclosed in `[]
` and separated by ` -
` (a hyphen
surrounded by spaces) for better readability and parsing.
Logs are generated in two primary formats, one for informational entries and another for error entries. However, key events like job scheduling or job completion have unique, dedicated formats.
- Informational messages: This format is used for general messages,
such as job started, scheduler started, and so on.
[timestamp] - [STATUS] - [MESSAGE: <message>]
- Error reports: This format is used for error messages,
such as job failed, scheduler start failed, and so on.
[timestamp] - [STATUS] - [ERROR: <error-message>]
In the above formats, the
STATUS
field classifies the type of log event, and theMESSAGE
orERROR
field provides the details. - Special formats for key events.
- Job scheduling (SCHEDULE_JOB): This format is
used to indicate that a job has been successfully scheduled for
execution.
[timestamp] - [SCHEDULE_JOB] - [JOB: <job-name>] - [JOB_LOG: <full-log-file-path>]
- Job completion (COMPLETED): This format is used
to indicate that a job has successfully completed execution.
[timestamp] - [COMPLETED] - [JOB_RESULT: <output returned by running the job>]
If the output spans multiple lines, it's wrapped in the following way:
[timestamp] - [COMPLETED] - [JOB_RESULT: line 1 of output line 2 of output ]
- Schedule file events: This format is used to
indicate the changes that can occur to the schedule file
(
scheduler.yaml
), such asSCHEDULE_FILE_LOADED
,SCHEDULE_FILE_VALIDATED
, andSCHEDULE_FILE_ERROR
.[timestamp] - [STATUS] - [SCHEDULE_FILE: <schedule-file-path>]
- Job scheduling (SCHEDULE_JOB): This format is
used to indicate that a job has been successfully scheduled for
execution.
4.4.2 Log File Locations
The Database Tools (dbtools
) home directory contains
the log files.
The log files path is:
${HOME}/.dbtools/schedules/
The SQLcl daemon uses the following directory structure for log files:
~/.dbtools/schedules
├── logs
│ ├── job-<job-name>.log
│ └── jobs.log
├── pid
├── scheduler.log
└── scheduler.yaml
4.4.3 Log File Descriptions
Each log file of the SQLcl daemon has a distinct purpose. For example, one file records daemon lifecycle logs while another captures scheduling logs of jobs, and so on.
Note:
Log rotation is not supported, so these log files may grow over time.4.4.3.1 Daemon Life Cycle Logs
(scheduler.log
)
The scheduler.log
file records high-level events related to
the daemon's life cycle, such as startup, shutdown, and
failures.
Table 4-1 Statuses reported in life cycle logs
Status | Description | Example |
---|---|---|
|
Indicates the scheduler has started successfully and is ready to begin scheduling jobs. |
|
|
Indicates the scheduler has been stopped and the job scheduling has ceased. |
|
|
Indicates the scheduler has failed to start. The message provides the reason. |
|
|
Indicates the scheduler has failed to shut down cleanly. The message provides the reason. |
|
4.4.3.2 Shared Job Scheduling Logs
(jobs.log
)
The jobs.log
file logs events that affect all
jobs, such as updates to the schedule file, validations, and job scheduling
actions.
Table 4-2 Statuses reported in shared-job scheduling logs
Status | Description | Example |
---|---|---|
|
Indicates the schedule file was successfully loaded and serialized, and jobs are available for scheduling. |
|
|
Indicates the schedule file is invalid due to missing fields or malformed content. |
|
|
Indicates the schedule file is valid and the system can proceed to schedule jobs. |
|
|
Indicates a job has been successfully scheduled. The log shows the job's name and its dedicated log file path. |
|
|
Indicates a job failed to be scheduled due to an invalid cron expression or internal error. |
|
4.4.3.3 Per-Job Execution Logs
(job-<job-name>.log
)
Each job has its own dedicated log file, recording only that job's activity. This facilitates isolating and debugging job-specific behavior.
Table 4-3 Statuses reported in individual job logs
Status | Description | Example |
---|---|---|
|
Indicates the job has started executing. This confirms that the job's scheduled time has arrived and a resource has been allocated to run it. |
|
|
Indicates the job has completed successfully. The job's output is included in the log. |
|
|
Indicates the job failed to complete due to errors like a missing connection or script failure. The reason is included in the log. |
|