Skip to content

Logging

Mogens Heller Grabe edited this page Aug 30, 2019 · 1 revision

Fleet Manager uses Serilog internally to log what it's doing. The on-premise Fleet Manager Windows service can have its logging configured like this:

Console logging

Logs will be output to the console, if the process detects that it's being started by a user (checked via Environment.UserInteractive).

Logs will default to have second-resolution on timestamps, and each line will include a shorthand for the log level, the name of the "service" (internal component of Fleet Manager) to which the log line belongs, then the message, and then possibly some exception details.

An example line looks like this:

12:49:48|INF|pool1|Starting consumer worker for topic "fm-events-1"
^-Timestamp        ^-Message
             ^-service
         ^-Level

If you want to customize how logs look on the console, you can change the appsetting logpattern:console.

File logging

Logs will also be written to rolling files on the disk.

The location is determined by the setting logpath, and an example value could be something like C:\logs\fm\windowsservice\log.txt, which will result in files like

C:\logs\fm\windowsservice\log-20190828.txt
C:\logs\fm\windowsservice\log-20190829.txt
C:\logs\fm\windowsservice\log-20190830.txt

being written.

The format used by default will be much like the one used on the console, except the timestamps will have higher resolution and contain their offset from UTC, and the "source context" will be included as well.

An example could be this:

2019-08-30 12:54:53.925 +02:00|INF|backendalt|Rebus.Bus.RebusBus|Bus "Rebus 2" started
^-Timestamp                        ^-service  ^-SourceContext    ^-Message
                               ^-Level

Available fields

For full documentation on which fields are provided by Serilog, please visit their documentation about the subject here: Serilog page about Formatting Output.

All default Serilog fields can be referenced from the output template, so e.g. if you'd like to include ALL logged properties without any particular formatting and in JSON format, you can change the format to {Timestamp}|{Properties:j}{NewLine}

In additional to Serilog's built'in fields, Fleet Manager will include these fields:

  • service – component, from which the line originated
Clone this wiki locally