eboix
10-10-2005, 07:55 AM
While I'm quite sure it's not an Spring issue, maybe you'll be able to help me. I'm trying to enable log4net logging in my Spring Managed ASP.NET app.
Here goes the relevant "web.config" sections:
<configSections>
<section name="DatabaseConfiguration" type="System.Configuration.NameValueSectionHandler, System,Version=1.0.3300.0,Culture=neutral,PublicKe yToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net,Version=1.2.0.30714, Culture=neutral,PublicKeyToken=36239442fa0ec68b" />
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
</sectionGroup>
</configSections>
<DatabaseConfiguration>
<add key="connection.string" value="Data Source=127.0.0.1;Initial Catalog=MAC;User Id=macuser;Password=password;Min Pool Size=5;Max Pool Size=60;Connect Timeout=2;" />
</DatabaseConfiguration>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net,Versi on=1.2.0.30714, Culture=neutral,PublicKeyToken=36239442fa0ec68b">
<param name="File" value="c:\\inetpub\\app\\mac\\logs\\mac.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="20" />
<param name="MaximumFileSize" value="10MB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<filter
type="log4net.Filter.LevelRangeFilter, log4net,
Version=1.2.0.30714, Culture=neutral,
PublicKeyToken=36239442fa0ec68b">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="FATAL" />
</filter>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
</layout>
</appender>
<root>
<priority value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<logger name="MAC">
<priority value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
</log4net>
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Config/mac-context.xml" />
</context>
</spring>
...then in my context xml config file:
<object name="macLog" type="Spring.Objects.Factory.Config.Log4NetFactoryObject , Spring.Core">
<property name="logName"><value>MAC</value></property>
</object>
... that is injected into my objects (ILog property, right ?).
Well... this does not create the logging file.
- I've double checked the permissions. Everything is right.
- I've tried using LogManager.GetLogger directly instead of using Spring's DI, to no avail.
- I've tried using and not using those "PublicKeyTokens", just in case. Nothing.
- I suspect that is related to the config file, if I add "AAA" to the name of the class "log4net.Config.Log4NetConfigurationSectionHandler", no error shows either... I'm puzzled.
BTW, I'm using the lastest build from your web site. Regarding this, how comes that the "release" folder does not contain Spring.Web or Spring.Data while the "debug" folder does ?
Thanks a lot for your time and help,
Regards,
Esteve
Here goes the relevant "web.config" sections:
<configSections>
<section name="DatabaseConfiguration" type="System.Configuration.NameValueSectionHandler, System,Version=1.0.3300.0,Culture=neutral,PublicKe yToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net,Version=1.2.0.30714, Culture=neutral,PublicKeyToken=36239442fa0ec68b" />
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
</sectionGroup>
</configSections>
<DatabaseConfiguration>
<add key="connection.string" value="Data Source=127.0.0.1;Initial Catalog=MAC;User Id=macuser;Password=password;Min Pool Size=5;Max Pool Size=60;Connect Timeout=2;" />
</DatabaseConfiguration>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net,Versi on=1.2.0.30714, Culture=neutral,PublicKeyToken=36239442fa0ec68b">
<param name="File" value="c:\\inetpub\\app\\mac\\logs\\mac.log" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="20" />
<param name="MaximumFileSize" value="10MB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<filter
type="log4net.Filter.LevelRangeFilter, log4net,
Version=1.2.0.30714, Culture=neutral,
PublicKeyToken=36239442fa0ec68b">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="FATAL" />
</filter>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
</layout>
</appender>
<root>
<priority value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<logger name="MAC">
<priority value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
</log4net>
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Config/mac-context.xml" />
</context>
</spring>
...then in my context xml config file:
<object name="macLog" type="Spring.Objects.Factory.Config.Log4NetFactoryObject , Spring.Core">
<property name="logName"><value>MAC</value></property>
</object>
... that is injected into my objects (ILog property, right ?).
Well... this does not create the logging file.
- I've double checked the permissions. Everything is right.
- I've tried using LogManager.GetLogger directly instead of using Spring's DI, to no avail.
- I've tried using and not using those "PublicKeyTokens", just in case. Nothing.
- I suspect that is related to the config file, if I add "AAA" to the name of the class "log4net.Config.Log4NetConfigurationSectionHandler", no error shows either... I'm puzzled.
BTW, I'm using the lastest build from your web site. Regarding this, how comes that the "release" folder does not contain Spring.Web or Spring.Data while the "debug" folder does ?
Thanks a lot for your time and help,
Regards,
Esteve