Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'd like to log some custom errors to a separate log file, which I've got working but i'm also getting all the Umbraco messages in there as well. I'm sure its only a config issue can anyone help?
<log4net> <root> <priority value="Info"/> <appender-ref ref="AsynchronousLog4NetAppender" /> </root> <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> <encoding value="utf-8" /> </appender> <appender name="SagepayLog4NetAppender" type="log4net.Appender.FileAppender"> <file value="App_Data\Logs\SagepayLog.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> <encoding value="utf-8" /> </appender> <!--Here you can change the way logging works for certain namespaces --> <logger name="NHibernate"> <level value="WARN" /> </logger> <logger name="Sagepay"> <level value="ALL" /> <appender-ref ref="SagepayLog4NetAppender" /> </logger> </log4net>
This is the code I'm using to log the error:
private static readonly ILog Logger = LogManager.GetLogger("Sagepay"); Logger.Info("Error message here");
I think your Logger name needs to be your assembly namespace in log4net.config.
<logger name="NRP.Web.Events"> <level value="DEBUG" /> <appender-ref ref="CustomNrpAppender" /> </logger>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Custom error logs
I'd like to log some custom errors to a separate log file, which I've got working but i'm also getting all the Umbraco messages in there as well. I'm sure its only a config issue can anyone help?
This is the code I'm using to log the error:
I think your Logger name needs to be your assembly namespace in log4net.config.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.