You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Beaver, Ryan" <RB...@emphasysworld.com> on 2004/07/23 18:02:23 UTC
Using log4net within a dll
Hello All,
I've searched over some post and found some examples for using
Log4NET in a dll. One post suggested that if I was to encapsulate the
log4NET coding in a dll, and call it from an assembly, I should call the
DOMConfigurator.(PathToConfigurationFile) which I have. So basically I call
this, passing in a
FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile) to
Log4NET to let it know where my app.config file is. I have created a simple
appender in my config file to output the data to a .txt file(posted below).
When I call DOMConfigurator, no Log4NETExample.txt is created. When it moves
further to actually trying to make a call, I get this out of the console
window:
log4net:ERROR No appenders could be found for category
(Log4NetExample.frmMain)
log4net:ERROR Please initialize the log4net system properly.
Any help would be greatly appreciated.
Thanks,
Ryan
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<log4net debug="false">
<appender name="LogFileAppender"
type="log4net.Appender.FileAppender,log4net" >
<param name="File" value="C:\\Log4NetExample.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d
[%t] %-5p %c [%x] - %m%n" />
</layout>
</appender>
<root>
<priority value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>