Jeremy
Jeremy

Reputation: 3504

Cannot get logging output from iBATIS.NET

My application is using the iBATIS.NET Data Mapper version 1.6.3. A recent modification is causing a SqlException and I would like to see the query that it is trying to execute, so I added the following to the app.config:

<configSections>
    <sectionGroup name="iBATIS">
        <section name="logging" type="IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common"/>
    </sectionGroup>
</configSections>

<iBATIS>
    <logging>
        <loggingFactoryAdapter type="IBatisNet.Common.Logging.Impl.TraceLoggerFA, IBatisNet.Common">
            <arg key="logLevel" value="All"/>
        </loggingFactoryAdapter>
    </logging>
</iBATIS>

<system.diagnostics>
    <trace autoflush="true" indentsize="4">
        <listeners>
            <add name="textFileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TextWriterOutput.log"/>
        </listeners>
    </trace>
</system.diagnostics>

However, I am not getting any output. As a sanity check, I added a few calls to Trace.WriteLine() and those were appended to the log file as expected.

Am I missing some element to turn on logging?

Upvotes: 0

Views: 1117

Answers (2)

Dmitriy Own
Dmitriy Own

Reputation: 1

Better late then never - for me the reason was in missing Reference to IBatisNet.Common.Logging.Log4Net. According to https://ibatis.apache.org/docs/dotnet/datamapper/ch04s02.html, it is a separate DLL you need to reference, to be able to use Log4Net with iBatis.

Upvotes: 0

Romesh D. Niriella
Romesh D. Niriella

Reputation: 480

Pretty old thread but there are people like me who use this awesome ibatis.net library. So, if you are facing this problem, In your app.config/web.config check to see if log4net dependency is mentioned in section.

put the following xml node in there (note that log4net version is the latest as of today)

<dependentAssembly>
   <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
   <bindingRedirect oldVersion="0.0.0.0-1.2.13.0" newVersion="1.2.13.0" />
</dependentAssembly>

Upvotes: 0

Related Questions