Skip to content

Logger Component

The Logger component supports various logging levels and can be configured to support different back ends.

The supported log levels are as follows:

  • Error. This logs all error events that might still allow the application to run, such as failure to access a file. These events should be investigated, as they are likely to lead to the system not performing as configured
  • Warning. This logs all potentially harmful, unexpected events, such as a repeated failure to invoke a service. These events should also be investigated, as they may be the root cause of subsequent Errors
  • Information. This logs all high-level informational events that show the progress of the application, such as the start-up or stopping of a service. These events are milestones in normal operation and do not require any action
  • Debug. This logs more granular informational events. This is used when debugging an application or providing diagnostic information for an investigation
  • Trace. This logs fine-grained informational events and captures as much detail as possible. This is used when the debug level has not proved useful when diagnosing an issue and further detail is required

The Logger can be configured to output to console, to a file, or to a UDP socket.

Configuration

The following table describes the configuration variables that can be used with the Logger component:

Parameter Type Description Valid Values Required
Name String Specifies the name of this Logger component Any string Y
Level String Specifies the level of information to log Valid values are as follows:
  • Error
  • Warn (default)
  • Info
  • Debug
  • Trace
N
To String Specifies the destination for the log Logging is to console by default.
To log to a file, specify file:<filename>
To log to a UDP socket, specify udp:<host>:<port>, or for broadcast: udp:<port>
N
Next String Specifies the name of the next logger in a chain The name of another Logger or Bus Logger component N
Start Boolean Specifies whether to start on allocation

Specify true to start on allocation

Specify false to start the logger manually

Note: IoTech recommends that the logger is started on allocation (set to true) to allow the capturing of start-up events.
Valid values are as follows:
  • true (default)
  • false
N

Example Configuration

The following example configures a Logger component called file, which logs Warnings and Errors to the ./errors.log file:

{
  "Name": "file",
  "To": "file:./errors.log",
  "Level": "Warn"
}