I like the MS Enterprise Library Logging Application Block because it lets me easily define a few logging settings and then log an error in a line or so of code from my application.
However, I really want to be able to send email using my SMTP server's pickup folder (as opposed to specifying the servername and port). Just using the plain old System.Net block in your web.config, you could do:
<system.net>
<mailSettings>
<smtp deliveryMethod="pickupDirectoryFromIis" from="[email protected]">
</smtp>
</mailSettings>
</system.net>
or something like that, and then you're done.
Is this possible in the Logging Application Block? I don't want to specify the server and port.
Thanks, Stack Overflow!
If you want to email warnings:
Add a warning category.
Create a Trace Listener to allow us to send warnings to an email address: Right click the Trace Listeners and add a new Email Trace Listener. Set all the parameters, they’re pretty straight forward. Right click your Warning category and add a new trace listener referencing reference your email trace listener.
Logger.Write("Warning Message", "Warning", 1, 1,
System.Diagnostics.TraceEventType.Warning);
Ref: Microsoft Enterprise Library #1 – Logging Application Block
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With