You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Filipe David Manana <fd...@ieee.org> on 2008/04/21 17:13:43 UTC

iBATIS logging

Hi,

I am trying to log, with Log4J 1.2.15, all iBATIS access to the database
(sent queries, errors, etc). But nothing is being logged. My Log4J config
(an excerpt):

logs.dir=${catalina.home}/logs
>
> log4j.logger.com.ibatis=DEBUG, sqlLogFile
> log4j.logger.java.sql=DEBUG, sqlLogFile
>
> # do not duplicate entries to the root log
> log4j.additivity.com.ibatis = false
> log4j.additivity.java.sql = false
>
> log4j.appender.sqlLogFile=org.apache.log4j.RollingFileAppender
> log4j.appender.sqlLogFile.File=${logs.dir}/sql.log
> log4j.appender.sqlLogFile.MaxFileSize=5MB
> log4j.appender.sqlLogFile.MaxBackupIndex=20
> log4j.appender.sqlLogFile.ImmediateFlush=true
> log4j.appender.sqlLogFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.sqlLogFile.layout.ConversionPattern=[%p %C %d{dd MMM yyyy
> HH:mm:ss}] %m%n
>

My log file remains empty. I have been googling and some people say to
remove commons-logging from the classpath. I don't it in my classpath,
although the problem persists.
Any suggestion? Am I doing something wrong?

cheers

-- 
Filipe David Manana,
fdmanana@ieee.org

"The cruellest lies are often told in silence."

Re: iBATIS logging

Posted by Filipe David Manana <fd...@ieee.org>.
Now it works great :)

Thanks a lot

On Mon, Apr 21, 2008 at 5:51 PM, Jeff Butler <je...@gmail.com> wrote:

> Commons logging (JCL) is insidious and is almost always in the classpath
> (WebSphere, Tomcat, etc. always have JCL in the classpath).  Try this line
> of code to force iBATIS to use log4j:
>
> com.ibatis.common.logging.LogFactory.selectLog4JLogging();
>
> You should execute this at application startup - before any other iBATIS
> activity.
>
> Jeff Butler
>
> On Mon, Apr 21, 2008 at 10:13 AM, Filipe David Manana <fd...@ieee.org>
> wrote:
>
> > Hi,
> >
> > I am trying to log, with Log4J 1.2.15, all iBATIS access to the database
> > (sent queries, errors, etc). But nothing is being logged. My Log4J config
> > (an excerpt):
> >
> > logs.dir=${catalina.home}/logs
> > >
> > > log4j.logger.com.ibatis=DEBUG, sqlLogFile
> > > log4j.logger.java.sql=DEBUG, sqlLogFile
> > >
> > > # do not duplicate entries to the root log
> > > log4j.additivity.com.ibatis = false
> > > log4j.additivity.java.sql = false
> > >
> > > log4j.appender.sqlLogFile=org.apache.log4j.RollingFileAppender
> > > log4j.appender.sqlLogFile.File=${logs.dir}/sql.log
> > > log4j.appender.sqlLogFile.MaxFileSize=5MB
> > > log4j.appender.sqlLogFile.MaxBackupIndex=20
> > > log4j.appender.sqlLogFile.ImmediateFlush=true
> > > log4j.appender.sqlLogFile.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.sqlLogFile.layout.ConversionPattern=[%p %C %d{dd MMM
> > > yyyy HH:mm:ss}] %m%n
> > >
> >
> > My log file remains empty. I have been googling and some people say to
> > remove commons-logging from the classpath. I don't it in my classpath,
> > although the problem persists.
> > Any suggestion? Am I doing something wrong?
> >
> > cheers
> >
> > --
> > Filipe David Manana,
> > fdmanana@ieee.org
> >
> > "The cruellest lies are often told in silence."
>
>
>


-- 
Filipe David Manana,
fdmanana@ieee.org

"The cruellest lies are often told in silence."

Re: iBATIS logging

Posted by Jeff Butler <je...@gmail.com>.
Commons logging (JCL) is insidious and is almost always in the classpath
(WebSphere, Tomcat, etc. always have JCL in the classpath).  Try this line
of code to force iBATIS to use log4j:

com.ibatis.common.logging.LogFactory.selectLog4JLogging();

You should execute this at application startup - before any other iBATIS
activity.

Jeff Butler

On Mon, Apr 21, 2008 at 10:13 AM, Filipe David Manana <fd...@ieee.org>
wrote:

> Hi,
>
> I am trying to log, with Log4J 1.2.15, all iBATIS access to the database
> (sent queries, errors, etc). But nothing is being logged. My Log4J config
> (an excerpt):
>
> logs.dir=${catalina.home}/logs
> >
> > log4j.logger.com.ibatis=DEBUG, sqlLogFile
> > log4j.logger.java.sql=DEBUG, sqlLogFile
> >
> > # do not duplicate entries to the root log
> > log4j.additivity.com.ibatis = false
> > log4j.additivity.java.sql = false
> >
> > log4j.appender.sqlLogFile=org.apache.log4j.RollingFileAppender
> > log4j.appender.sqlLogFile.File=${logs.dir}/sql.log
> > log4j.appender.sqlLogFile.MaxFileSize=5MB
> > log4j.appender.sqlLogFile.MaxBackupIndex=20
> > log4j.appender.sqlLogFile.ImmediateFlush=true
> > log4j.appender.sqlLogFile.layout=org.apache.log4j.PatternLayout
> > log4j.appender.sqlLogFile.layout.ConversionPattern=[%p %C %d{dd MMM yyyy
> > HH:mm:ss}] %m%n
> >
>
> My log file remains empty. I have been googling and some people say to
> remove commons-logging from the classpath. I don't it in my classpath,
> although the problem persists.
> Any suggestion? Am I doing something wrong?
>
> cheers
>
> --
> Filipe David Manana,
> fdmanana@ieee.org
>
> "The cruellest lies are often told in silence."