Am using Log4Net in my code,it start throwing this weird exception when my process run.
Here is my Appconfig for Log4Net,still am not sure what am missing here
It throws like
log4net:Error XmlHierarchyConfigurator : cannot find property[maxSizeRollBackups] to set object on [log4net.Appender.FileAppender].
Config:
<appender name="ErrorAppender" type="log4net.Appender.FileAppender,log4net">
<appendToFile value="true" />
<maxSizeRollBackups value="30" />
<maximumFileSize value="5MB" />
<rollingStyle value="Size" />
<staticLogFileName value="false" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<file value="C:\Error.log"/>
<param name="AppendToFile" value="true"/>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="ERROR"/>
</filter>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-2p %c %method - %m%n"/>
</layout>
</appender>
"When set to Once the log file will be rolled when the appender is configured. This effectively means that the log file can be rolled once per program execution. So, when you set your RollingFileAppender to "once", then every time you execute your program, a new log file will be created.
Add log4net in config file config and enter the following details. Add a class Log. cs in the Utilities folder. Now, in the constructor of this class, instantiate logs for monitoring and debugger loggers.
If you are using a separate configuration file for log4net, do this: after following all the other setup instructions, make sure that u right click on the file in the visual studio solution explorer, select properties, expand the "Advanced" option group, set the "Copy To Output Directory" value as "Copy always".
Change log4net.Appender.FileAppender to log4net.Appender.RollingFileAppender.
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender,log4net">
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