In my case, I use Spring and have the following in my web.xml file:
<!--
- Location of the Log4J config file, for initialization and
refresh checks.
- Applied by Log4jConfigListener.
-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/conf/log4j.properties</param-value>
</context-param>
<!--
- Key of the system property that should specify the root
directory of this
- web app. Applied by WebAppRootListener or
Log4jConfigListener.
-->
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>ICE.root</param-value>
</context-param>
<!--
- Configures Log4J for this web app.
- As this context specifies a context-param
"log4jConfigLocation", its file path
- is used to load the Log4J configuration, including periodic
refresh checks.
-
- Would fall back to default Log4J initialization
(non-refreshing) if no special
- context-params are given.
-
- Exports a "web app root key", i.e. a system property that
specifies the root
- directory of this web app, for usage in log file paths.
- This web app specifies "example.root" (see log4j.properties
file).
-->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listen
er-class>
</listener>
-----Original Message-----
From: Davide Marche [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 07, 2006 9:03 AM
To: [email protected]
Subject: Re: iBATIS and log4j
Hi Greg and thank you,
may I ask you if you initialize log4j somehow ?
Rose, Greg ha scritto:
>
> I am using iBATIS 2.1.5.582 and Tomcat 5.5.12. Here is an excerpt of
> my log4j.properties file that I have in my WEB-INF/lib/conf directory.
>
>
>
> log4j.logger.com.ibatis=DEBUG
>
> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
>
> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
>
> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
>
>
>
> log4j.logger.java.sql.Connection=DEBUG
>
> log4j.logger.java.sql.Statement=DEBUG
>
> log4j.logger.java.sql.PreparedStatement=DEBUG, a2
>
> log4j.logger.java.sql.ResultSet=DEBUG
>
>
>
>
>
> Sample output to console:
>
>
>
> 2006-02-07 07:27:00,531 DEBUG java.sql.Connection - {conn-100000}
> Connection
>
> 2006-02-07 07:27:00,671 DEBUG java.sql.PreparedStatement -
> {pstm-100001} PreparedStatement: select P.PERSONID as id,
> P.LOGON as userName, P.PASSWORD as password,
> P.RECORDSTATUSID as recordStatusID, R.RECORDSTATUSCODE as
> recordStatusCode, R.RECORDSTATUSNAME as recordStatusName from
> PERSON P, RECORDSTATUS R where
> P.RECORDSTATUSID=R.RECORDSTATUSID
> AND (P.LOGON = ? )
>
> 2006-02-07 07:27:00,671 DEBUG java.sql.PreparedStatement -
> {pstm-100001} Parameters: [grose]
>
> 2006-02-07 07:27:00,671 DEBUG java.sql.PreparedStatement -
> {pstm-100001} Types: [java.lang.String]
>
> 2006-02-07 07:27:00,703 DEBUG java.sql.ResultSet - {rset-100002}
ResultSet
>
> 2006-02-07 07:27:00,765 DEBUG java.sql.ResultSet - {rset-100002}
> Header: [id, userName, password, recordStatusID, recordStatusCode,
> recordStatusName]
>
> 2006-02-07 07:27:00,765 DEBUG java.sql.ResultSet - {rset-100002}
> Result: [2, grose, test, 1, A , Active]
>
> 2006-02-07 07:27:00,781 DEBUG java.sql.Connection - {conn-100003}
> Connection
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100004} PreparedStatement: select P.PERSONID as id,
> P.FNAME as firstName, P.MNAME as middleName, P.LNAME as
> lastName, P.EMAILADDRESS as emailAddress,
> P.RECORDSTATUSID as recordStatusID, R.RECORDSTATUSCODE as
> recordStatusCode, R.RECORDSTATUSNAME as recordStatusName from
> PERSON P, RECORDSTATUS R where
> P.RECORDSTATUSID=R.RECORDSTATUSID and P.PERSONID = ?
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100004} Parameters: [2]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100004} Types: [java.lang.Long]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.ResultSet - {rset-100005}
ResultSet
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.ResultSet - {rset-100005}
> Header: [id, firstName, middleName, lastName, emailAddress,
> recordStatusID, recordStatusCode, recordStatusName]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.ResultSet - {rset-100005}
> Result: [2, Greg, null, Rose, null, 1, A , Active]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.Connection - {conn-100006}
> Connection
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100007} PreparedStatement: select RO.ROLEID as id,
> RO.ROLECODE as code, RO.ROLENAME as name, RO.ROLEDESC as
> description, RO.RECORDSTATUSID as recordStatusID,
> RS.RECORDSTATUSCODE as recordStatusCode, RS.RECORDSTATUSNAME
> as recordStatusName from ROLE RO, RECORDSTATUS RS,
> ROLEALLOC RX where RO.RECORDSTATUSID=RS.RECORDSTATUSID and
> RO.ROLEID = RX.ROLEID and RX.PERSONID = ?
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100007} Parameters: [2]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.PreparedStatement -
> {pstm-100007} Types: [java.lang.Long]
>
> 2006-02-07 07:27:00,796 DEBUG java.sql.ResultSet - {rset-100008}
ResultSet
>
>
[EMAIL PROTECTED]
=[]]
>
> This electronic message transmission contains information from the
Company that may be proprietary, confidential and/or privileged.
> The information is intended only for the use of the individual(s) or
entity named above. If you are not the intended recipient, be
> aware that any disclosure, copying or distribution or use of the
contents of this information is prohibited. If you have received
> this electronic transmission in error, please notify the sender
immediately by replying to the address listed in the "From:" field.
>
This electronic message transmission contains information from the Company that
may be proprietary, confidential and/or privileged.
The information is intended only for the use of the individual(s) or entity
named above. If you are not the intended recipient, be
aware that any disclosure, copying or distribution or use of the contents of
this information is prohibited. If you have received
this electronic transmission in error, please notify the sender immediately by
replying to the address listed in the "From:" field.