With your current configuration, you're telling your application to
look for the log4net configuration in the App/Web.config and for
IBatisNet to re-configure log4net from the Log4net.config file. I
usually configure log4net from my application and tell IBatisNet to
attach itself to that configuration:

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

The configType value extenral tells IBatisNet that log4net has already
been configured.

--- Brian Elcock <[EMAIL PROTECTED]> wrote:

> Hello All.
> 
> I'm struggling with getting logging setup to log all
> prepared/executed
> SQL statements. I am using .NET 1.1, Log4Net 1.2.9.0,
> IBatisNet.DataMapper 1.3.0.0. I can write to the log just fine from
> within the application when I'm testing, but I can't get iBatis to
> log
> the SQL statements. I've looked at the developer guide, and it seems
> pretty straightforward, but I'm clearly missing something somewhere.
> 
> My solution is broken up into 3 separate projects:
> 
> 1. Domain
> 2. Model (where all the iBatis interaction lives)
> 3. Web
> 
> Any help would be greatly appreciated.
> 
> Here are the relevant parts of my configuration:
> 
>       <configSections>
>               <sectionGroup name="iBATIS">
>                       <section name="logging"
> type="IBatisNet.Common.Logging.ConfigurationSectionHandler,
> IBatisNet.Common" />
>               </sectionGroup>
>               <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>       </configSections>
>       
>       <iBATIS>
>               <logging>
>                       <logFactoryAdapter
> type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA,
> IBatisNet.Common.Logging.Log4Net">
>                               <arg key="configType" value="file" />
>                               <arg key="configFile" value="Log4Net.config" />
>                       </logFactoryAdapter>
>               </logging>
>       </iBATIS>
> 
>       <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">
>                               <conversionPattern value="%5level [%date] 
> %-40.40logger{2}
> %message%newline" />
>                       </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>
> 
>               <logger
> name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
>                       <level value="ALL" />
>               </logger>
>               
>       </log4net>
> 

Reply via email to