Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the best viewer for NLog? [closed]

Which is the best viewer for NLog?

log2console

sentinel

Other?

like image 426
Pierre8r Avatar asked Jun 30 '11 18:06

Pierre8r


1 Answers

Although a very old question, the same question has been haunting me this last couple of weeks. Here is my little contribution to the hive-mind:

I found that for a lightweight client or client/server application using a simplistic, lightweight log viewer like log2console with NLogViewer target' filled with additional parameters fields made it both easy to use/setup and customize, while being readable and easy to find the info I looked for.

I used a UDP listener in the log viewer, and the following target definition in my NLog configuration:

<target xsi:type="NLogViewer" name="logviewer" address="udp://localhost:7071" onOverflow="Split">     <parameter name="Message&#9;&#9;" layout="${message}" />     <parameter name="Callsite&#9;&#9;" layout="${callsite:includSourcePath=true}"/>     <parameter name="Exception&#9;" layout="${exception:separator=&#13;&#10;----&#13;&#10;:innerExceptionSeparator=&#13;&#10;-- -- -- -- --&#13;&#10;:maxInnerExceptionLevel=5:format=Message,Type,StackTrace:innerFormat=Message,Type,StackTrace}" />     <parameter name="StackTrace&#9;" layout="${newline}&#9;${stacktrace_custom}" /> </target> 

Notes:

  1. The &#9; is tab, which helps make it a bit more readable.
  2. The &#13;&#10; is newline, since I couldn't use ${newline} in a layout renderer's parameter (an NLog limitation).
  3. In my example I use a very detailed layout, you can of course edit it however you like, use the $exception layout renderer doc page for reference.

Hope someone finds this helpful

like image 101
Lockszmith Avatar answered Sep 20 '22 10:09

Lockszmith