Googlier.com News Article Search
Googlier.com Precious Metals Exchange Smart Contracts
Googlier.com Document Services





          NLog      
http://staffofgeeks.net/afeng/archive/2006/07/31/86759.aspx

Originally posted on: http://staffofgeeks.net/afeng/archive/2006/07/31/86759.aspx

Logging is one of those things where once you have it, you never really pay much attention to it.  Today I decided to investigate what is new in the logging world since the last time I looked at it.  I heard of NLog some time ago, but never took the time to test drive it.  In the past I have always used log4net, so I decided to compare NLog to it.  Here are some of the things that I really like about NLog, and it might not be possible or “easy” to do with log4net:

 

Asynchronous Processing:

 

NLog provider wrapper and compound targets for asynchronous processing, loading balancing, buffering, and etc.

 

Easy Configuration:

 

The configuration file structure is simple and easier to write.  If you do not remember all the options, no worries, you will receive Intellisense in Visual Studio.

 

Include Files:

 

You can split up the configuration to multiple files by using the <include />.

 

Contextual Information:

 

Like all other logging frameworks, NLog is able to add contextual information when each message is logged.  You can use the contextual information to create a log file for each user, create one log file per day, one file per logger, or any combination.  Stack trace can also be included when each message is logged.

 

Not Swallowing Exceptions:

 

Sometimes it is useful to know when the logging framework is throwing an exception to prevent logging from happening; NLog can be configured not to swallow any exceptions.  It is useful to troubleshoot problems during deployment. 

 

Defining Variables in Configuration File:

 

Common value can be stored in a variable.  Great way to keep you configuration file DRY.

 

Note:  This is a superficial look at some of the features of NLog, and I have not worked with NLog extensively.




Array ( [p] => 90 [in] => 58 [style] => 45 [o] => 35 [pt] => 27 [MARGIN] => 27 [MsoNormal] => 27 [class] => 27 [a] => 25 [nbsp] => 24 [span] => 22 [to] => 15 [b] => 14 [http] => 12 [mso-spacerun] => 11 [yes] => 11 [the] => 11 [href] => 11 [org] => 10 [is] => 10 [NLog] => 9 [nlog-project] => 8 [I] => 7 [www] => 7 [it] => 7 [mso-bidi-font-weight] => 7 [net] => 7 [normal] => 7 [log] => 6 [logging] => 6 [file] => 5 [and] => 5 [of] => 5 [you] => 5 [can] => 5 [not] => 4 [be] => 4 [some] => 3 [one] => 3 [configuration] => 3 [have] => 3 [afeng] => 3 [each] => 3 [when] => 3 [time] => 3 [staffofgeeks] => 3 [all] => 2 [useful] => 2 [or] => 2 [strong] => 2 [do] => 2 [contextual] => 2 [with] => 2 [office] => 2 [any] => 2 [Configuration] => 2 [information] => 2 [per] => 2 [create] => 2 [for] => 2 [logged] => 2 [message] => 2 [apache] => 2 [You] => 2 [at] => 2 [never] => 2 [archive] => 2 [aspx] => 2 [things] => 2 [really] => 2 [decided] => 2 [use] => 1 [superficial] => 1 [look] => 1 [aggbug] => 1 [features] => 1 [worked] => 1 [extensively] => 1 [This] => 1 [img] => 1 [src] => 1 [problems] => 1 [able] => 1 [add] => 1 [lt] => 1 [split] => 1 [up] => 1 [multiple] => 1 [files] => 1 [by] => 1 [using] => 1 [include] => 1 [user] => 1 [gt] => 1 [Contextual] => 1 [width] => 1 [Information] => 1 [Like] => 1 [other] => 1 [frameworks] => 1 [Note] => 1 [day] => 1 [DRY] => 1 [from] => 1 [Variables] => 1 [framework] => 1 [throwing] => 1 [an] => 1 [exception] => 1 [prevent] => 1 [happening] => 1 [File] => 1 [Defining] => 1 [deployment] => 1 [during] => 1 [swallow] => 1 [exceptions] => 1 [It] => 1 [know] => 1 [Common] => 1 [troubleshoot] => 1 [Great] => 1 [logger] => 1 [keep] => 1 [way] => 1 [combination] => 1 [Stack] => 1 [trace] => 1 [also] => 1 [value] => 1 [included] => 1 [Not] => 1 [variable] => 1 [stored] => 1 [Swallowing] => 1 [Exceptions] => 1 [Sometimes] => 1 [configured] => 1 [loading] => 1 [Files] => 1 [In] => 1 [heard] => 1 [ago] => 1 [but] => 1 [took] => 1 [test] => 1 [drive] => 1 [past] => 1 [last] => 1 [always] => 1 [used] => 1 [so] => 1 [compare] => 1 [Here] => 1 [are] => 1 [that] => 1 [looked] => 1 [since] => 1 [about] => 1 [where] => 1 [Originally] => 1 [posted] => 1 [on] => 1 ['http] => 1 [aspx'] => 1 [Logging] => 1 [those] => 1 [once] => 1 [world] => 1 [pay] => 1 [much] => 1 [attention] => 1 [Today] => 1 [investigate] => 1 [what] => 1 [new] => 1 [like] => 1 [might] => 1 [Include] => 1 [remember] => 1 [Easy] => 1 [The] => 1 [structure] => 1 [simple] => 1 [easier] => 1 [write] => 1 [If] => 1 [options] => 1 [buffering] => 1 [no] => 1 [worries] => 1 [will] => 1 [receive] => 1 [Intellisense] => 1 [Visual] => 1 [Studio] => 1 [etc] => 1 [balancing] => 1 [possible] => 1 [urn] => 1 [ldquo] => 1 [easy] => 1 [rdquo] => 1 [xml] => 1 [namespace] => 1 [prefix] => 1 [ns] => 1 [schemas-microsoft-com] => 1 [processing] => 1 [Asynchronous] => 1 [Processing] => 1 [provider] => 1 [wrapper] => 1 [compound] => 1 [targets] => 1 [asynchronous] => 1 [height] => 1 )

© Googlier LLC, 2019