Vivek
Vivek

Reputation: 2123

Buffered Emailing Logger for .Net (preferably a NLog Target)?

Could anyone point me to a NLog target or some other logging sink that would allow sinking logs to SMTP but in a buffered fashion (multiple errors logged in a single email)?

Anyone who's ever used a SMTP sink has likely been spammed sometime or another from the default SMTP logging sinks :) Hoping someone can point me to an existing solution so i don't have to figure out all the myraid headaches inherent with doing this well and reliably at the level of a well tested sink :P Thanks!

Upvotes: 2

Views: 179

Answers (1)

Stijn
Stijn

Reputation: 2060

Take a look at the BufferingWrapper target.

A target that buffers log events and sends them in batches to the wrapped target.

You can use it in combination with the Mail target.

<target
    xsi:type="BufferingWrapper"
    name="mail_buffered"
    bufferSize="5">

        <target
            xsi:type="Mail" ... >
            ...
        </target>
</target>

Upvotes: 3

Related Questions