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, 25 Aug 2006 21:39:02 GMT
Mike.

Thanks for your reply. I'm hesitant to introduce the newer version of
log4net because IBatis itself uses 1.2.9. It's not as simple as just
replacing the DLL, unfortunately. Or, if it is, let me know if I need
to change anything w/ IBatis itself.

I tried including an appender like you did below, but that didn't do
anything for me.

In addition to what I wrote before, let me include that this is how
I'm configuring Log4Net in my Assembly file:

[assembly: log4net.Config.XmlConfiguratorAttribute(ConfigFile="Log4Net.config",Watch=true)]

Again, my Log4Net.config file contains, simply, the following:

	<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">
			<appender-ref ref="RollingLogFileAppender" />
		</logger>
				
	</log4net>

And my web.config file contains:

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

Yet nothing happens w/ the IBatis information being logged. Using
log4net directly works fine. IBatis doesn't seem to be able to get a
hold of it. Can anyone suggest anything else? Or is there a different
way you would suggest setting things up? I noticed another question
regarding this, so hopefully an answer will help many! I know that
this will help me further my quest to get IBatis used more in my
organization.

Thanks again.

Brian

Mime
View raw message