ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Miller" <daniel.mil...@corp.idt.net>
Subject Trouble logging with log4net
Date Wed, 23 Aug 2006 12:43:44 GMT
Hi there

 

I have log4net working with my ASP.NET 2.0 app but can't get iBatis to log the SQL.

 

Some background: 

 

The ASP 2.0 app calls business logic in a separate c# DLL. Both the ASP app and the DLL use
the logger successfully.

One potential issue seems to be the version of log4net in use. My code uses 1.2.10, whereas
iBatis 1.3.0 (IBatisNet.Common.Logging.Log4Net.dll) seems to use 1.2.9. Could this be the
problem?

 

Code:

 

In Global.asax (Application_Start) I load the log4net configuration from Web.config:

 

log4net.Config.XmlConfigurator.Configure(); 

 

All the config data is in web.config:

 

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

  <appSettings>

    <!-- To enable internal log4net logging specify the following appSettings key -->

    <!-- <add key="log4net.Internal.Debug" value="true"/> -->

  </appSettings>

    <connectionStrings/>

    <system.web>

      <sessionState mode="InProc" cookieless="false" timeout="20"></sessionState>

      <compilation debug="true"/>

      <authentication mode="Windows"/>

    </system.web>

    <iBATIS>

      <logging>

        <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net">

          <arg key="configType" value="external" />

        </logFactoryAdapter>

      </logging>

    </iBATIS>

    <log4net debug="true">

      <appender name="FileAppender" type="log4net.Appender.FileAppender">

        <param name="File" value="Log/log-file.txt" />

        <param name="AppendToFile" value="true" />

        <layout type="log4net.Layout.PatternLayout">

          <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />

        </layout>

      </appender>

      <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">

        <to value="daniel.miller@myDomain.com" />

        <from value="daniel.miller@myDomain.com" />

        <subject value="DEBIT Accounts Alias - log message" />

        <smtpHost value="mail.myDomain.com" />

        <bufferSize value="10" />

        <lossy value="true" />

        <threshold value="DEBUG" />

        <evaluator type="log4net.Core.LevelEvaluator,log4net">

          <threshold value="ERROR" />

        </evaluator>

        <layout type="log4net.Layout.PatternLayout,log4net">

          <conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}]
- %message%newline%newline%newline" />

        </layout>

      </appender>

      <root>

        <appender-ref ref="SmtpAppender"/>

        <appender-ref ref="FileAppender"/>

        <level value="ALL"/>

      </root>

      <!-- iBatis internal logging -->

      <logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataMapper.LazyLoadList">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataMapper.SqlMapSession">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.Common.Transaction.TransactionScope">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataAccess.DaoSession">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataAccess.Configuration.DaoProxy">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">

        <level value="DEBUG" />

      </logger>

      <logger name="IBatisNet.DataMapper.Commands.IPreparedCommand">

        <level value="DEBUG" />

      </logger>

    </log4net>

  </configuration>

 

I've also tried using:

 

<arg key="configType" value="inline" />

 

I've checked that all the assemblies are in my /bin folder (IBatisNet.Common, IBatisNet.Common.Logging.Log4net.dll,
Castle.DynamicProxy.dll,…)

 

Another suspicious bit is in the Output window when I run the ASP app. The iBatis DLLs are
referred to but as "No symbols loaded" – is this a problem too? See below for full Output
window contents.

 

As I said, logs are written successfully from within the ASP app and the "backend" DLL, but
no iBatis logs to be seen.

 

Thanks!

 

Daniel Miller

 

Warning: Cannot debug script code. Script debugging is disabled for the application you are
debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog
box (Advanced page) for Internet Explorer and restart the process.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\WebDev.WebHost\8.0.0.0__b03f5f7f11d50a3a\WebDev.WebHost.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.JScript\8.0.0.0__b03f5f7f11d50a3a\Microsoft.JScript.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\VJSharpCodeProvider\2.0.0.0__b03f5f7f11d50a3a\VJSharpCodeProvider.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CppCodeProvider\8.0.0.0__b03f5f7f11d50a3a\CppCodeProvider.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_Code.yns0xa6t.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\33e91d97\9a9b1ab0_afc6c601\Idt.DebitAccounts.DLL',
Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_global.asax.bd5k6q9f.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\922b7e4f\90abbd8f_94c6c601\Idt.Utilities.DLL',
Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\344e9671\0056ee1f_e453c601\log4net.DLL',
No symbols loaded.

log4net: XmlHierarchyConfigurator: Configuration update mode [Merge].

log4net: XmlHierarchyConfigurator: Loading Appender [SmtpAppender] type: [log4net.Appender.SmtpAppender,log4net]

log4net: XmlHierarchyConfigurator: Setting Property [To] to String value [daniel.miller@myDomain.com]

log4net: XmlHierarchyConfigurator: Setting Property [From] to String value [daniel.miller@myDomain.com]

log4net: XmlHierarchyConfigurator: Setting Property [Subject] to String value [DEBIT Accounts
Alias - log message]

log4net: XmlHierarchyConfigurator: Setting Property [SmtpHost] to String value [mail.myDomain.com]

log4net: XmlHierarchyConfigurator: Setting Property [BufferSize] to Int32 value [10]

log4net: XmlHierarchyConfigurator: Setting Property [Lossy] to Boolean value [True]

log4net: XmlHierarchyConfigurator: Setting Property [Threshold] to Level value [DEBUG]

log4net: XmlHierarchyConfigurator: Setting Property [Threshold] to Level value [ERROR]

log4net: XmlHierarchyConfigurator: Setting Property [Evaluator] to object [log4net.Core.LevelEvaluator]

log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%newline%date
[%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [date] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [thread] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [] ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [level] Option [] Format [min=5,max=2147483647,leftAlign=True]

log4net: PatternParser: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [logger] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [property] Option [NDC] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [] - ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.PatternLayout]

log4net: XmlHierarchyConfigurator: Created Appender [SmtpAppender]

log4net: XmlHierarchyConfigurator: Adding appender named [SmtpAppender] to logger [root].

log4net: XmlHierarchyConfigurator: Loading Appender [FileAppender] type: [log4net.Appender.FileAppender]

log4net: XmlHierarchyConfigurator: Setting Property [File] to String value [Log/log-file.txt]

log4net: XmlHierarchyConfigurator: Setting Property [AppendToFile] to Boolean value [True]

log4net: PatternParser: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: XmlHierarchyConfigurator: Setting Property [ConversionPattern] to String value [%d
[%t] %-5p %c [%x] - %m%n]

log4net: PatternParser: Converter [d] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [t] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [] ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [p] Option [] Format [min=5,max=2147483647,leftAlign=True]

log4net: PatternParser: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [c] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [x] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [literal] Option [] - ] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [m] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: PatternParser: Converter [n] Option [] Format [min=-1,max=2147483647,leftAlign=False]

log4net: XmlHierarchyConfigurator: Setting Property [Layout] to object [log4net.Layout.PatternLayout]

log4net: FileAppender: Opening file for writing [C:\Documents and Settings\dmill2\My Documents\MG\Projects\debit\Accounts\Log\log-file.txt]
append [True]

log4net: XmlHierarchyConfigurator: Created Appender [FileAppender]

log4net: XmlHierarchyConfigurator: Adding appender named [FileAppender] to logger [root].

log4net: XmlHierarchyConfigurator: Logger [root] Level string is [ALL].

log4net: XmlHierarchyConfigurator: Logger [root] level set to [name="ALL",value=-2147483648].

log4net: XmlHierarchyConfigurator: Retrieving an instance of log4net.Repository.Logger for
logger [IBatisNet.DataMapper].

log4net: XmlHierarchyConfigurator: Setting [IBatisNet.DataMapper] additivity to [True].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper] Level string is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper] level set to [name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Retrieving an instance of log4net.Repository.Logger for
logger [IBatisNet.DataMapper.Commands.DefaultPreparedCommand].

log4net: XmlHierarchyConfigurator: Setting [IBatisNet.DataMapper.Commands.DefaultPreparedCommand]
additivity to [True].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.Commands.DefaultPreparedCommand]
Level string is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.Commands.DefaultPreparedCommand]
level set to [name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Retrieving an instance of log4net.Repository.Logger for
logger [IBatisNet.DataMapper.Configuration.Cache.CacheModel].

log4net: XmlHierarchyConfigurator: Setting [IBatisNet.DataMapper.Configuration.Cache.CacheModel]
additivity to [True].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.Configuration.Cache.CacheModel]
Level string is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.Configuration.Cache.CacheModel]
level set to [name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Retrieving an instance of log4net.Repository.Logger for
logger [IBatisNet.DataMapper.LazyLoadList].

log4net: XmlHierarchyConfigurator: Setting [IBatisNet.DataMapper.LazyLoadList] additivity
to [True].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.LazyLoadList] Level string
is [DEBUG].

log4net: XmlHierarchyConfigurator: Logger [IBatisNet.DataMapper.LazyLoadList] level set to
[name="DEBUG",value=30000].

log4net: XmlHierarchyConfigurator: Hierarchy Threshold []

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_Web_eiojpzj9.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_Web_accountaliaslist.ascx.cc671b29.jwqdha4p.dll',
Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_Web_vu7aev6e.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.RegularExpressions\2.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\App_Web_5-bezbet.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\94b2eb4e\00304306_cd00c601\IBatisNet.DataMapper.DLL',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\5ce0578f\00304306_cd00c601\IBatisNet.Common.DLL',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\1d1aeba2\005d7407_cd00c601\IBatisNet.Common.Logging.Log4Net.DLL',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC\Oracle.DataAccess\9.2.0.700__89b483f429c47342\Oracle.DataAccess.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll',
No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\accounts\363c6587\aa985223\assembly\dl3\4c4a9d18\00a62122_d1bec501\Castle.DynamicProxy.DLL',
No symbols loaded.

The thread 0x164c has exited with code 0 (0x0).

3:39 PM 8/23/2006a

 


Mime
View raw message