Re: Async Nlog

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: Async Nlog

Jarek Kowalski
Hi Narendra,
Your asynchronous target configuration looks ok.
The best way to disable a particular logger completely is to put a final rule at the beginning of your rules:
    <logger name="SomeLoggerName" final="true" />
You could also disable some particular logging levels for some matching loggers:
    <logger name="Some.Logger.*" levels="Debug,Fatal" final="true" />
or disable some levels globally:
    <logger levels="Trace,Fatal" final="true" />
Jaroslaw Kowalski
----- Original Message -----
Sent: Friday, October 07, 2005 10:37 AM
Subject: Async Nlog

Hi Jaroslaw,
gr8 work Jaroslaw...I'm impressed the way you quickly solved our problems.
I'm sending you the config settings I made to acheive the Async logging through Nlog
    <nlog autoReload="true" >
         <target name="async-db" type="AsyncWrapper" > <!-- batchSize="3"-->
            <!-- database target -->
            <target name="database" type="Database" >
                      <!--database configuration-->

         <target name="async-mail" type="AsyncWrapper" > <!-- batchSize="3"-->
            <!--Mail Target-->          
            <target name="mail" type="Mail" HTML="true"
                                      <!--mail configuration-->
                        footer            = ""/>
                <!--Log Levels-->
                <!--Trace, Debug, Info, Warn, Error, Fatal  maxlevel="Error" -->
            <logger name="WciHttpModule" minlevel="Fatal" writeTo="async-mail" />
            <logger name="*"  minlevel="Error" writeTo="async-db" />

Here I have 2 Targets "mail" and "database" I wrapped these targets inside "async-db" and "async-mail" targets these are of type AsyncWrapper. this is producing the correct desired result, but I want you to have a look on the configuration I made.
* Please put your comments, whether it is a correct implementation for asynchronous logging.
* One more thing, How can I Enable\Disable a particular logger through configuration ?
looking for your reply.

Narendra Tiwari
NLog Blog