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
How do I replace log4net logging module with my custom one?
I do not want to use log4net but want to use nLog (http://nlog-project.org/)
You can add your logger to existing setup, like this:
In log4net.config:
<logger name="MyLogger"> <level value="DEBUG" /> <appender-ref ref="MyAppender" /> </logger> <appender name="MyAppender" type="log4net.Appender.RollingFileAppender"> <file value="App_Data\Logs\My-folder\Whatever-" /> <datePattern value="dd-MM-yyyy'.log'" /> <staticLogFileName value="false" /> <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>
and then in your code:
using log4net; ... private static readonly ILog log = LogManager.GetLogger("MyLogger"); ... log.Info("Blah");
Pav,
Take a look at http://nugetmusthaves.com/Package/log4net.NLogAppender then as per Zakhar's suggestion add the appender with the nlog one.
Regards
Ismail
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Is it possible to replace logging provider?
How do I replace log4net logging module with my custom one?
I do not want to use log4net but want to use nLog (http://nlog-project.org/)
You can add your logger to existing setup, like this:
In log4net.config:
and then in your code:
Pav,
Take a look at http://nugetmusthaves.com/Package/log4net.NLogAppender then as per Zakhar's suggestion add the appender with the nlog one.
Regards
Ismail
is working on a reply...