PDA

View Full Version : log4net 1.2.10 w/ spring 1.1 p3


PaulD
02-12-2007, 05:35 PM
Hi,

I just recently upgraded from spring 1.0.1 to spring 1.1.0.2. Before I upgraded spring the log4net logging was working fine. However, I also upgraded from log4net 1.2.9 to 1.2.10 at the same time. The whole reason for this exercise is so that I could use 1.2.10 with iBatis to try and get its logging working. So now the logging for my app works and ibatis logging works but not the logging for spring. I have read the updated 1.1 p3 docs on logging and have added the new section to the web.config for the commons logging. It was very similar to the ibatis commons section that I had to put in their for ibatis.

Here is the relevant section of the web.config:

<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net">
<arg key="configType" value="EXTERNAL" />
</factoryAdapter>
</logging>
</common>
<iBATIS>
<logging>
<logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net">
<arg key="configType" value="external" />
</logFactoryAdapter>
</logging>
</iBATIS>


Here are the loggers I have setup in my log4net config file:

<logger name="Spring">
<level value="DEBUG" />
</logger>

<logger name="IBatisNet.DataMapper.Commands.DefaultPreparedComma nd">
<level value="DEBUG" />
</logger>


Does anybody have any suggestions on what is going on here?

Thanks

Mark Pollack
02-12-2007, 07:37 PM
Hi,

I double checked that EXTERNAL config works, you can see for yourself in the MovieFinder example. There maybe some subtle issue between Common.Logging and iBatis.Logging (they are virtually identical....) I'll try it within an ibatis app and get back to you. If you can you quickly try to see if w/out ibatis in your app that would be appreciated.

Cheers,
Mark

PaulD
02-13-2007, 02:48 PM
Thanks for the info. I took out the iBatis logging but that didn't make any difference. I am taking a look at the movie finder example, but it seems to use an 'inline' config for log4net. I will change it to external and make sure log4net is initialized. Right now we usually do this in the global.asax, is that ok?

Mark Pollack
02-13-2007, 03:03 PM
Hi,

Make sure that Common.Logging and Common.Logging.Log4Net are in the runtime directory. Just as a sanity check you could add the config for the built in Commong.Logging console appender (http://www.springframework.net/doc-latest/reference/html/ch13.html#d0e8033).

I didn't get a change to try out the ibatis project yet. Will keep you posted.

Cheers,
Mark

PaulD
02-13-2007, 04:49 PM
Make sure that Common.Logging and Common.Logging.Log4Net are in the runtime directory

hmmmm.....

I checked and sure enough that was it. Looks like I was missing the Common.Logging.Log4Net assembly :)

Well, I'm glad it was that easy. Now everything is logging fine. ibatis and spring have no problem logging in harmony.

I really appreciate the help.

Thanks!

Paul

Mark Pollack
02-13-2007, 05:14 PM
Hi,
Glad it worked out. We should probably give some indication if the specified library isn't found.
Cheers,
Mark

snelson
02-13-2007, 07:43 PM
I came across that too - missed off the log4net libraries in my web app. There wasn't any error but no logging either. Kicked myself when I worked out what I'd done wrong!

Mark Pollack
02-13-2007, 07:55 PM
Hi,
Added a JIRA (http://opensource.atlassian.com/projects/spring/browse/SPRNET-484) issue so we don't forget..
Mark