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 Fri, 18 Aug 2006 04:40:09 GMT
OK. Thanks. That makes sense. I've updated my configuration to include
the external value. Now in my logger config file, I've got this:

		<logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
			<level value="ALL" />
		</logger>

The developer guide says:

To log all Prepared SQL command text, enable the logger for
IBatisNet.DataMapper.Configuration.Statements.DefaultPreparedCommand.
This will display the statement, parameters, and parameter types used
by the DataMapper.

Do I need to do something other than the above line to make this happen?

Thanks for your help.

On 8/17/06, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> 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 <brian.elcock@gmail.com> 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>
> >
>
>

Mime
View raw message