Custom logging

The program uses Serilog for logging which is a powerful extensible library.

Levels

simple-acme uses the following five log levels:

  • Error - Logs fatal or dangerous conditions
  • Warning - Logs minor errors and suspicious conditions
  • Information - General information about operations
  • Debug - Additional information that can be useful for troubleshooting
  • Verbose - Full logging for submitting bug reports

Included sinks

  • The default sink logs to the console window to provide real time insights.
  • The event sink writes to the Windows Event Viewer includes Error, Warning and selected Information messages.
  • The disk sink writes rolling log files to the {Client.LogPath}.

Custom sinks

There are many types of output channels called sinks for all kinds of different databases, file formats and services.

Example (Seq)

  • Download Serilog.Sinks.PeriodicBatching.dll and Serilog.Sinks.Seq.dll from NuGet. These files can be found here and here, respectively.
  • Configure the sink in a file called serilog.json according to the specification here.

Example

The follow piece of code in serilog.json adds the process ID to the output of the file log.

{
  "disk": {
    "WriteTo": [{ 
      "Name": "File",
      "Args": { 
        "outputTemplate": "[{Level:u3}] [PID:{ProcessId}] {Message:lj}{NewLine}{Exception}"
      } 
    }]
  }
}

Arguments

‑‑test Enables testing behaviours in the program which may help with troubleshooting. By default this also switches the ‑‑baseuri to the ACME test endpoint. The default endpoint for test mode can be modified in settings.json.
‑‑verbose Print additional log messages to console for troubleshooting and bug reports.

Settings

Client.LogPath The path where log files for the past 31 days are stored.

Paths should be JSON-encoded, e.g. "C:\\" (note the double backslash).

Type: string
Default: undefined (resolves to {Client.ConfigurationPath}\Log)

Looking for win-acme?

simple-acme is a backwards compatible, drop-in replacement built by the same person. Project history.