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 IBATIS <ve...@wipro.com> on 2008/01/08 19:32:44 UTC

Unable to log sql queries in my log files

Hi There,

I am unable to log my sql queries used in ibatis sql mapper. Let me narrate
the steps I used.

I have put the following entries into my log4j.properties file.
log4j.logger.com.ibatis=DEBUG,ibatisFile
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG,ibatisFile
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG,ibatisFile

log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG,ibatisFile
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG,ibatisFile
log4j.logger.java.sql.Connection=DEBUG,ibatisFile
log4j.logger.java.sql.Statement=DEBUG,ibatisFile
log4j.logger.java.sql.PreparedStatement=DEBUG,ibatisFile
log4j.logger.java.sql.ResultSet=DEBUG,ibatisFile

log4j.appender.ibatisFile=org.apache.log4j.RollingFileAppender
log4j.appender.ibatisFile.MaxFileSize=6MB
log4j.appender.ibatisFile.immediateFlush=true
log4j.appender.ibatisFile.MaxBackupIndex=3
log4j.appender.ibatisFile.File=/logs/MyIBatis.log
log4j.appender.ibatisFile.Threshold=DEBUG
log4j.appender.ibatisFile.append=true
log4j.appender.ibatisFile.layout=org.apache.log4j.PatternLayout
log4j.appender.ibatisFile.layout.ConversionPattern=%d{yyyy/MM/dd
HH:mm:ss,SSS}: <%p> %m%n

I have put my log4j.property file under ejbModule (I am using RAD 7.0 and
this folder would be created when we are creating an ejb project). I have my
log entries in the same log files which is working fine. 
I am unable to see the sql queries in 'MyIBatis.log'. The file
'MyIBatis.log' is getting generated but there are no sql entries into it.

Please help me out. Tell me where I am doing wrong. 

Thanks
Venkat

-- 
View this message in context: http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14695875.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Unable to log sql queries in my log files

Posted by IBATIS <ve...@wipro.com>.
Hi Chetan,

It is working now. Thanks for your valuable suggesstion. The mistake was,
since I had the two jar files reference
(Ibatis-2.3.0.677.jar,Ibatis-sqlmap-2.jar), I was not able to get the
method(selectLog...) now I am having the reference of Ibatis-2.3.0.677.jar
alone and it is solved now.

Regards
Venkat


Chetan Nayak wrote:
> 
> Try using this line before you make calls to IBATIS API,
>  LogFactory.selectLog4jLoggin() ,I'm just guessing here.
> 
> Thanks
> Chetan
> 
> 
> 
> On 1/9/08, IBATIS <ve...@wipro.com> wrote:
>>
>>
>> Hi There,
>>
>> I am unable to log my sql queries used in ibatis sql mapper. Let me
>> narrate
>> the steps I used.
>>
>> I have put the following entries into my log4j.properties file.
>> log4j.logger.com.ibatis=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG,ibatisFile
>>
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG
>> ,ibatisFile
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
>> ,ibatisFile
>> log4j.logger.java.sql.Connection=DEBUG,ibatisFile
>> log4j.logger.java.sql.Statement=DEBUG,ibatisFile
>> log4j.logger.java.sql.PreparedStatement=DEBUG,ibatisFile
>> log4j.logger.java.sql.ResultSet=DEBUG,ibatisFile
>>
>> log4j.appender.ibatisFile=org.apache.log4j.RollingFileAppender
>> log4j.appender.ibatisFile.MaxFileSize=6MB
>> log4j.appender.ibatisFile.immediateFlush=true
>> log4j.appender.ibatisFile.MaxBackupIndex=3
>> log4j.appender.ibatisFile.File=/logs/MyIBatis.log
>> log4j.appender.ibatisFile.Threshold=DEBUG
>> log4j.appender.ibatisFile.append=true
>> log4j.appender.ibatisFile.layout=org.apache.log4j.PatternLayout
>> log4j.appender.ibatisFile.layout.ConversionPattern=%d{yyyy/MM/dd
>> HH:mm:ss,SSS}: <%p> %m%n
>>
>> I have put my log4j.property file under ejbModule (I am using RAD 7.0 and
>> this folder would be created when we are creating an ejb project). I have
>> my
>> log entries in the same log files which is working fine.
>> I am unable to see the sql queries in 'MyIBatis.log'. The file
>> 'MyIBatis.log' is getting generated but there are no sql entries into it.
>>
>> Please help me out. Tell me where I am doing wrong.
>>
>> Thanks
>> Venkat
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14695875.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14700183.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Unable to log sql queries in my log files

Posted by IBATIS <ve...@wipro.com>.
Hi Chetan,

I would like to correct my previous message. 

I am not getting the selectLog4jLogging method from my LogFactory class. I
am currently using the following APIs. Please let me know if I need to
remove or replace someother Jar file.

Currently Used API are
Ibatis-2.3.0.677.jar
Ibatis-common-2.jar
Ibatis-sqlmap-2.jar
commons-logging.jar
log4j-1.2.13.jar

I believe that I need to instantiate the LogFactory class which is found
under com.ibatis.common.logging right?

Thanks
Venkat


Chetan Nayak wrote:
> 
> Try using this line before you make calls to IBATIS API,
>  LogFactory.selectLog4jLoggin() ,I'm just guessing here.
> 
> Thanks
> Chetan
> 
> 
> 
> On 1/9/08, IBATIS  wrote:
>>
>>
>> Hi There,
>>
>> I am unable to log my sql queries used in ibatis sql mapper. Let me
>> narrate
>> the steps I used.
>>
>> I have put the following entries into my log4j.properties file.
>> log4j.logger.com.ibatis=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG,ibatisFile
>>
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG
>> ,ibatisFile
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
>> ,ibatisFile
>> log4j.logger.java.sql.Connection=DEBUG,ibatisFile
>> log4j.logger.java.sql.Statement=DEBUG,ibatisFile
>> log4j.logger.java.sql.PreparedStatement=DEBUG,ibatisFile
>> log4j.logger.java.sql.ResultSet=DEBUG,ibatisFile
>>
>> log4j.appender.ibatisFile=org.apache.log4j.RollingFileAppender
>> log4j.appender.ibatisFile.MaxFileSize=6MB
>> log4j.appender.ibatisFile.immediateFlush=true
>> log4j.appender.ibatisFile.MaxBackupIndex=3
>> log4j.appender.ibatisFile.File=/logs/MyIBatis.log
>> log4j.appender.ibatisFile.Threshold=DEBUG
>> log4j.appender.ibatisFile.append=true
>> log4j.appender.ibatisFile.layout=org.apache.log4j.PatternLayout
>> log4j.appender.ibatisFile.layout.ConversionPattern=%d{yyyy/MM/dd
>> HH:mm:ss,SSS}: <%p> %m%n
>>
>> I have put my log4j.property file under ejbModule (I am using RAD 7.0 and
>> this folder would be created when we are creating an ejb project). I have
>> my
>> log entries in the same log files which is working fine.
>> I am unable to see the sql queries in 'MyIBatis.log'. The file
>> 'MyIBatis.log' is getting generated but there are no sql entries into it.
>>
>> Please help me out. Tell me where I am doing wrong.
>>
>> Thanks
>> Venkat
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14695875.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14698230.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Re: Unable to log sql queries in my log files

Posted by IBATIS <ve...@wipro.com>.
Hi Chetan,

Thanks for the information. I am instantiating my sqlmapclient only once.
Hence do I need to put this piece of code before I get the instance for the
first time. Also could you please be more specific on the code because I am
unable to put the LogFactory.selectLog4j... method.

Thanks
Venkat



Chetan Nayak wrote:
> 
> Try using this line before you make calls to IBATIS API,
>  LogFactory.selectLog4jLoggin() ,I'm just guessing here.
> 
> Thanks
> Chetan
> 
> 
> 
> On 1/9/08, IBATIS <ve...@wipro.com> wrote:
>>
>>
>> Hi There,
>>
>> I am unable to log my sql queries used in ibatis sql mapper. Let me
>> narrate
>> the steps I used.
>>
>> I have put the following entries into my log4j.properties file.
>> log4j.logger.com.ibatis=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG,ibatisFile
>> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG,ibatisFile
>>
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG
>> ,ibatisFile
>> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
>> ,ibatisFile
>> log4j.logger.java.sql.Connection=DEBUG,ibatisFile
>> log4j.logger.java.sql.Statement=DEBUG,ibatisFile
>> log4j.logger.java.sql.PreparedStatement=DEBUG,ibatisFile
>> log4j.logger.java.sql.ResultSet=DEBUG,ibatisFile
>>
>> log4j.appender.ibatisFile=org.apache.log4j.RollingFileAppender
>> log4j.appender.ibatisFile.MaxFileSize=6MB
>> log4j.appender.ibatisFile.immediateFlush=true
>> log4j.appender.ibatisFile.MaxBackupIndex=3
>> log4j.appender.ibatisFile.File=/logs/MyIBatis.log
>> log4j.appender.ibatisFile.Threshold=DEBUG
>> log4j.appender.ibatisFile.append=true
>> log4j.appender.ibatisFile.layout=org.apache.log4j.PatternLayout
>> log4j.appender.ibatisFile.layout.ConversionPattern=%d{yyyy/MM/dd
>> HH:mm:ss,SSS}: <%p> %m%n
>>
>> I have put my log4j.property file under ejbModule (I am using RAD 7.0 and
>> this folder would be created when we are creating an ejb project). I have
>> my
>> log entries in the same log files which is working fine.
>> I am unable to see the sql queries in 'MyIBatis.log'. The file
>> 'MyIBatis.log' is getting generated but there are no sql entries into it.
>>
>> Please help me out. Tell me where I am doing wrong.
>>
>> Thanks
>> Venkat
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14695875.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14696957.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Unable to log sql queries in my log files

Posted by Chetan Nayak <ch...@gmail.com>.
Try using this line before you make calls to IBATIS API,
 LogFactory.selectLog4jLoggin() ,I'm just guessing here.

Thanks
Chetan



On 1/9/08, IBATIS <ve...@wipro.com> wrote:
>
>
> Hi There,
>
> I am unable to log my sql queries used in ibatis sql mapper. Let me
> narrate
> the steps I used.
>
> I have put the following entries into my log4j.properties file.
> log4j.logger.com.ibatis=DEBUG,ibatisFile
> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG,ibatisFile
> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG,ibatisFile
>
> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG
> ,ibatisFile
> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
> ,ibatisFile
> log4j.logger.java.sql.Connection=DEBUG,ibatisFile
> log4j.logger.java.sql.Statement=DEBUG,ibatisFile
> log4j.logger.java.sql.PreparedStatement=DEBUG,ibatisFile
> log4j.logger.java.sql.ResultSet=DEBUG,ibatisFile
>
> log4j.appender.ibatisFile=org.apache.log4j.RollingFileAppender
> log4j.appender.ibatisFile.MaxFileSize=6MB
> log4j.appender.ibatisFile.immediateFlush=true
> log4j.appender.ibatisFile.MaxBackupIndex=3
> log4j.appender.ibatisFile.File=/logs/MyIBatis.log
> log4j.appender.ibatisFile.Threshold=DEBUG
> log4j.appender.ibatisFile.append=true
> log4j.appender.ibatisFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.ibatisFile.layout.ConversionPattern=%d{yyyy/MM/dd
> HH:mm:ss,SSS}: <%p> %m%n
>
> I have put my log4j.property file under ejbModule (I am using RAD 7.0 and
> this folder would be created when we are creating an ejb project). I have
> my
> log entries in the same log files which is working fine.
> I am unable to see the sql queries in 'MyIBatis.log'. The file
> 'MyIBatis.log' is getting generated but there are no sql entries into it.
>
> Please help me out. Tell me where I am doing wrong.
>
> Thanks
> Venkat
>
> --
> View this message in context:
> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tp13292529p14695875.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>