Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

NLog email buffering wrapper

, 12 Mar 2011
Rate this:
Please Sign up or sign in to vote.
I have found this link which works well without having to write your class above. <target xsi:type="PostFilteringWrapper"...
I have found this link which works well without having to write your class above.
 
<targets>
        <target name="console" xsi:type="Console" />
        <target name="papercut" xsi:type="BufferingWrapper" bufferSize="100">
            <target xsi:type="PostFilteringWrapper" defaultFilter="level >= LogLevel.Error">
                <target xsi:type="Mail"
                    name="papercut"
                    subject="Your app has errors"
                    to="somebody@domain.net"
                    from="someemail@domain.net"
                    smtpServer="localhost" />
                <when exists="level >= LogLevel.Error" filter="level >= LogLevel.Info"/>
            </target>
        </target>
    </targets>
    <rules>
        <logger name="*" minlevel="Debug" writeTo="console" />
        <logger name="*" minlevel="Debug" writeTo="papercut"  />
    </rules>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Simon Hughes
Software Developer (Senior) www.ByBox.com
United Kingdom United Kingdom
C++ and C# Developer for 21 years. Microsoft Certified.
 
UK Senior software developer / team leader.
 
I've been writing software since 1985. I pride myself on designing and creating software that is first class. That means it has to be fast, scalable, and with good use of design patterns.
 
I have done everything from risk analysis and explosion modelling, banking systems, to highly scalable multi-threaded arrival and departure screens in many leading airports, to state of the art wireless warehouse systems.
Follow on   Twitter   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 12 Mar 2011
Article Copyright 2011 by Simon Hughes
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid