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 Log4Net and logging SQL Statements
Date Thu, 17 Aug 2006 22:59:45 GMT
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