log4j.xml 셋팅#

<appender name="java-sql"
  class="org.apache.log4j.RollingFileAppender">
  <param name="File" value="C:/was/jakarta-tomcat-5.0.28/logs/sql.log" />
  <param name="Threshold" value="ALL" />
  <param name="MaxFileSize" value="1MB" />
  <param name="MaxBackupIndex" value="5" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
      value="%-5p [%d{yyyy-MM-dd HH:mm:ss} ] %x %c - %m%n" />
  </layout>
</appender>

<logger name="java.sql" additivity="true">
  <priority value="debug"/>
  <appender-ref ref="java-sql" />
</logger>

결과#

DEBUG [2007-08-07 17:49:49]  java.sql.Connection - {conn-100000Connection
DEBUG [2007-08-07 17:49:49]  java.sql.Connection - {conn-100000Preparing Statement:
select id, first_name as firstName, last_name as lastName         from app_user;     
DEBUG [2007-08-07 17:49:49]  java.sql.PreparedStatement - {pstm-100001Executing Statement:
select id, first_name as firstName, last_name as lastName         from app_user;     
DEBUG [2007-08-07 17:49:49]  java.sql.PreparedStatement - {pstm-100001Parameters: []
DEBUG [2007-08-07 17:49:49]  java.sql.PreparedStatement - {pstm-100001Types: []
DEBUG [2007-08-07 17:49:49]  java.sql.ResultSet - {rset-100002ResultSet
DEBUG [2007-08-07 17:49:49]  java.sql.ResultSet - {rset-100002Header: [id, firstName, lastName]
DEBUG [2007-08-07 17:49:49]  java.sql.ResultSet - {rset-100002Result: [1, DongGuk, Lee]

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 07-Aug-2007 17:59 by DongGukLee