Sorry to keep on you all about this. I just can't seem to figure it
out. Here's what I've got in my web.config file (the relevant parts):

        <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>

From what I understand, the "external" value in the configType tells
IBatis that it will not need to configure the logger, as it's
configured externally. I have Log4Net configured and working just fine
from within my application. I am using a separate Log4Net.config file
for all of that configuration. Here are some snippets from that file:

        <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.DataMapper.Commands.DefaultPreparedCommand">
                        <level value="ALL" />
                </logger>
                
                <logger 
name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.DataMapper.LazyLoadList">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.DataMapper.SqlMapSession">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.Common.Transaction.TransactionScope">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.DataAccess.DaoSession">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.DataAccess.Configuration.DaoProxy">
                        <level value="ALL" />
                </logger>
                <logger 
name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">
                        <level value="ALL" />
                </logger>
                <logger name="IBatisNet.DataMapper.Commands.IPreparedCommand">
                        <level value="ALL" />
                </logger>
                                
        </log4net>

Yet nothing from IBatis is logged. I've played with the level values
and what not, but nothing ever changes. Is there something I'm
missing? Thanks for any help.

Brian

On 8/17/06, Brian Elcock <[EMAIL PROTECTED]> wrote:
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 <[EMAIL PROTECTED]> 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 <[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