rolandz
02-21-2007, 08:09 AM
Hi,
I would like to enable the spring (internal) logging via log4net. What should I set? I've seen the common logging section in the configuration of application. But how to properly set this up. My preferred solution is to have log4net.config file.
I already am using log4net (at least initializing it for NHibernate):
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">
<object id="Log4NetInitializer"
type="Spring.Objects.Factory.Config.MethodInvokingFactor yObject, Spring.Core">
<property name="TargetType" value="log4net.Config.XmlConfigurator, log4net" />
<property name="TargetMethod" value="Configure" />
<property name="Arguments">
<list>
<value type="System.IO.Stream">~/Config/Log4Net.config</value>
</list>
</property>
</object>
<object id="loggingAroundAdvise"
type="Spring.Aspects.LoggingAroundAdvice, CMS"
depends-on="Log4NetInitializer">
<property name="Level" value="Warn" />
</object>
</objects>
I have a log4net.config there as well. But I have a strong feeling that there is better way... Especially because the spring doesn't log - it prooves that it is wrong way rather...
I would like to enable the spring (internal) logging via log4net. What should I set? I've seen the common logging section in the configuration of application. But how to properly set this up. My preferred solution is to have log4net.config file.
I already am using log4net (at least initializing it for NHibernate):
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">
<object id="Log4NetInitializer"
type="Spring.Objects.Factory.Config.MethodInvokingFactor yObject, Spring.Core">
<property name="TargetType" value="log4net.Config.XmlConfigurator, log4net" />
<property name="TargetMethod" value="Configure" />
<property name="Arguments">
<list>
<value type="System.IO.Stream">~/Config/Log4Net.config</value>
</list>
</property>
</object>
<object id="loggingAroundAdvise"
type="Spring.Aspects.LoggingAroundAdvice, CMS"
depends-on="Log4NetInitializer">
<property name="Level" value="Warn" />
</object>
</objects>
I have a log4net.config there as well. But I have a strong feeling that there is better way... Especially because the spring doesn't log - it prooves that it is wrong way rather...