Skip to content
jtorjo edited this page Mar 22, 2016 · 5 revisions

Log Syntax


As of version 1.8.15, Log Syntax now support nlog/log4net syntax


The Log Syntax is the syntax of each line of your log. This is how we split each line into columns.

By default, LogWizard tries to automatically find the syntax of each line by parsing the file header. Most of the time, you should be fine.

However, for the cases when LogWizard does not find the syntax correctly, you can manually set it.

The syntax looks like this:

$part-of-line1[start,end] $part-of-line2[start,end] ... $part-of-lineN[start,end] $msg[start]

$part-of-line can by any of:

  • $msg - the logged message itself. This must always be last
  • $date - Date of the message
  • $time - Time of the message
  • $level - Level (INFO, DEBUG, ERROR, FATAL, etc.)
  • $file - file:line the message was logged from (in case you're logging it)
  • $func - Function the message was logged from (in case you're logging it)
  • $class - Class the message was logged from (in case you're logging it)
  • $ctx1 - Extra contextual information about the message (in case you're logging it)
  • $ctx2 - Extra contextual information about the message (in case you're logging it)
  • $ctx3 - Extra contextual information about the message (in case you're logging it)

The start and end can be any of:

  • a number (the index in line where the part-of-line starts or ends)
  • a string (where the part-of-line starts or ends). It is not considered part of the message.
  • '' (the empty string). Means, continue from where you are now (see the last example)

Examples:

$time[0,12] $ctx1[13,10] $level[24,5] $class[' ','- '] $msg

will correctly parse this line:

11:06:13,944 main DEBUG TNControls.ls_util - load_save - on_change not implemented - enable_vision

as:

  • time = 11:06:13,944
  • ctx1 = main
  • level = DEBUG
  • class = TNControls.ls_util
  • msg = load_save - on_change not implemented - enable_vision

A more complex example is this:

$date[0,' '] $time['',' '] $ctx1['[',']:'] $ctx2['[',']'] $ctx3['[','] '] $msg

which parses this line

2015/09/14 13:41:43.228 [00001]: [- Main -][SystemInfo] C:\ Disk Space: 466,438 mb total; 403,234 mb used; 63,204 mb free

as:

  • date = 2015/09/14
  • time = 13:41:43.228
  • ctx1 = 00001
  • ctx2 = - Main -
  • ctx3 = SystemInfo
  • msg = C:\ Disk Space: 466,438 mb total; 403,234 mb used; 63,204 mb free