Created
April 19, 2013 15:30
-
-
Save Jeavon/5421117 to your computer and use it in GitHub Desktop.
Adding SmtpAppender to log4net in Umbraco to email logs of Error or above
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<log4net> | |
<root> | |
<priority value="Info" /> | |
<appender-ref ref="AsynchronousLog4NetAppender" /> | |
<appender-ref ref="SmtpAppender"/> | |
</root> | |
<!--To Change the way logging works for certain namespaces, insert a new logger like: --> | |
<!-- | |
<logger name="Umbraco.Core"> | |
<level value="WARN" /> | |
</logger>--> | |
<appender name="AsynchronousLog4NetAppender" type="Umbraco.Core.Logging.AsynchronousRollingFileAppender, Umbraco.Core"> | |
<file value="App_Data\Logs\UmbracoTraceLog.txt" /> | |
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> | |
<appendToFile value="true" /> | |
<rollingStyle value="Date" /> | |
<maximumFileSize value="5MB" /> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> | |
</layout> | |
</appender> | |
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender"> | |
<threshold value="INFO" /> | |
<to value="[email protected]" /> | |
<from value="[email protected]" /> | |
<subject value="My Website Error Report" /> | |
<smtpHost value="127.0.0.1" /> | |
<bufferSize value="50" /> | |
<lossy value="true" /> | |
<evaluator type="log4net.Core.LevelEvaluator"> | |
<threshold value="ERROR" /> | |
</evaluator> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" /> | |
</layout> | |
</appender> | |
</log4net> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment