ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Elcock" <brian.elc...@gmail.com>
Subject Re: Log4Net and logging SQL Statements
Date Wed, 20 Sep 2006 16:56:45 GMT
I just wanted to follow up on this, in case anyone else out there was
struggling with the same issue. I sort of gave up because it *seemed*
like I was doing everything right and that it should be working. But,
of course, it wasn't. Then I got an email from one of the many great
users on this list who suggested that I might have been missing
something incredibly simple and (now, at least) very obvious. I was
missing a reference to IBatisNet.Common.Logging.Log4Net. So I added
the reference and everything was golden.

A big thank you to Nicholas Piasecki.

Brian

On 8/25/06, Brian Elcock <brian.elcock@gmail.com> wrote:
> Mike.
>
> Thanks for your reply. I'm hesitant to introduce the newer version of
> log4net because IBatis itself uses 1.2.9. It's not as simple as just
> replacing the DLL, unfortunately. Or, if it is, let me know if I need
> to change anything w/ IBatis itself.
>
> I tried including an appender like you did below, but that didn't do
> anything for me.
>
> In addition to what I wrote before, let me include that this is how
> I'm configuring Log4Net in my Assembly file:
>
> [assembly: log4net.Config.XmlConfiguratorAttribute(ConfigFile="Log4Net.config",Watch=true)]
>
> Again, my Log4Net.config file contains, simply, the following:
>
>         <log4net>
>
>                 <!-- Define some output appenders -->
>                 <appender name="RollingLogFileAppender"
> type="log4net.Appender.RollingFileAppender">
>                         <file value="log.log" />
>                         <appendToFile value="true" />
>                         <maximumFileSize value="5MB" />
>                         <maxSizeRollBackups value="-1" />
>                         <layout type="log4net.Layout.PatternLayout">
>                                 <param name="ConversionPattern" value="%d [%t] %-5p
%c [%x] - %m%n" />
>                         </layout>
>                 </appender>
>
>                 <!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
>                 <!-- Set root logger level to ERROR and its appenders -->
>                 <root>
>                         <level value="ALL" />
>                         <appender-ref ref="RollingLogFileAppender" />
>                 </root>
>
>                 <logger name="IBatisNet">
>                         <appender-ref ref="RollingLogFileAppender" />
>                 </logger>
>
>         </log4net>
>
> And my web.config file contains:
>
>         <configSections>
>                 <sectionGroup name="iBATIS">
>                         <section name="logging"
> type="IBatisNet.Common.Logging.ConfigurationSectionHandler,
> IBatisNet.Common" />
>                 </sectionGroup>
>         </configSections>
>
>         <iBATIS>
>                 <logging>
>                         <logFactoryAdapter
> type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA,
> IBatisNet.Common.Logging.Log4Net">
>                                 <arg key="configType" value="external" />
>                         </logFactoryAdapter>
>                 </logging>
>         </iBATIS>
>
> Yet nothing happens w/ the IBatis information being logged. Using
> log4net directly works fine. IBatis doesn't seem to be able to get a
> hold of it. Can anyone suggest anything else? Or is there a different
> way you would suggest setting things up? I noticed another question
> regarding this, so hopefully an answer will help many! I know that
> this will help me further my quest to get IBatis used more in my
> organization.
>
> Thanks again.
>
> Brian
>

Mime
View raw message