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

Support for nlog / log4net

As of version 1.8.15, Log Wizard has enhanced support for nlog / log4net logging libraries. Of course, it already supports a lot of log targets (different file formats, database, windows event logs, and the like).

However, when first you first view a log in Log Wizard, depending on its syntax (how you write each piece of information into it), it can be sometimes a bit difficult to accurately describe it so Log Wizard shows it correctly from the get-go.

Thus, I have enhanced it to make this process as seamless as possible.

Auto-recognize nlog / log4net syntax

First, when it comes to syntax, Log Wizard now recognizes both nlog and log4net syntaxes. Or,

So, when you open a log file (Ctrl-O), you can click on "Edit", and paste your nlog/log4net syntax.

Instead of Log Wizard syntax, such as

$time[0,' | '] $level['',' | '] $msg['']

you can now copy-paste your nlog/log4net syntax:

${date:format=dd.MM.yyyy HH\\:mm\\:ss,fff} | ${level:uppercase=true} | ${message}
%-70file(%4line): %date{HH:mm:ss,fff} %-5level - %message%newline

But, it gets better...

.config files

Log Wizard can now parse nlog / log4net .config files, to automatically load the syntax from them:

  • When you drop a file onto Log Wizard, it will automatically look to see if there is any .config file (if not found, it will look in the directory's parent and its parent's parent). If a .config file is found, is parsed, and settings are automatically applied
  • When you open a log manually (Ctrl-O), you can now click on "Load Config" - where you can manually select where your nlog/log4net config file is.

Once it parses a .config file, it will try to to load as much information from there. At this time:

  • if it's a log file, it will look for its syntax and its file name (the latter can not always be inferred, but that's ok, because very likely you've drag and dropped the file name)
  • if it's a database table, it will pre-load all the database connection information

Drag and drop of .config files

You can also drag and drop an nlog/log4net .config file. At this point, Log Wizard will pre-load all the information it could parse from the configuration file, fill it, and then open the "Open Log" dialog.

At this point, you can check that the information is correct, press OK, and that's it - enjoy viewing the log!