Memurai can output logs to the console, to a log file and/or to the Windows event log. When running as a Windows service, the console log is not available. When running as a standalone application, the file log and the console log are mutually exclusive. The event log is available in both standalone and service runs.
The following table summarizes the available options:
|Memurai mode||Console log||File log||Event log|
The log file verbosity level is set via the
loglevel configuration flag, which supports the following values:
The event log verbosity level is set via the
winlog-level configuration flag, which supports the following values:
An additional configuration flag,
instance-name, can be used to distinguish between multiple Memurai instances in the logs. If not empty, the value of
instance-name is displayed at the beginning of every Windows event log message, and also in one of the first lines of the log file.
instance-name configuration flags are Memurai specific.
logfile configuration flag specifies the log file name and path.
logfile is a relative path, it will be relative to the path specified by the
dir flag (the
dir flag default value is the current working directory).
logfile value can also be set to an absolute path or to a UNC path.
logfile is not set, or if it's set to an empty string, no log file will be written; if Memurai is running as a standalone application, it will print the log output to the console.
If the log file path contains spaces, it must be enclosed in single or double quotes. The directory delimiter can be either the standard Windows backslash or the Unix style forward slash and both can be used for relative, absolute or UNC paths.
Configuration Flag Examples
The log file can be disabled by commenting out the
logfile flag using the
# symbol or setting it to an empty string, ex:
To set the log file to be located in the folder specified by the
The following are all valid ways of specifying a log file path:
logfile "log/memurai.log" #Unix style path delimiter logfile 'C:\memurai data\memurai.log' #absolute path single/double quotes can be used logfile "\\fileshare\memurai\memurai.log" #UNC folder
Windows Event Log Configuration
Since version 2.0.0, Memurai supports logging to the Windows event log in addition to the file log. The table below illustrates the mapping between the log file elements and their event log counterparts.
|File log||Event log association||Example|
|[pid]||Message header (pid property)||pid = 884|
|role||Message header (role property)||role = sentinel|
|timestamp||Date and Time||2020-04-22T18:41:22|
|message type||EventID||an integer value|
|message||Message body||Server initialized|
|sentinel mode||Source = Memurai-Sentinel||n/a|
|non sentinel roles||Source = Memurai||n/a|
|Level = "Information"||all events are always "Information"|