iBatis logging log4j - how to get sql id in the log -
i have ibatis log working prints sql stmt, parameters etc. in log file. not print select id.
for example: select id="getuserinfo" parameterclass="string" resultclass="string"
i want print getuserinfo in log. how do that?
thank you, robert
are using logging framework or something? use log4j logging consoleappender class "org.apache.log4j.consoleappender" , fileappender class , have conversionpattern set "%d{iso8601} %-5p %m%n" , works me.
console appender settings
<appender name="a1" class="org.apache.log4j.consoleappender"> <param name="target" value="system.out"/> <param name="threshold" value="debug"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{iso8601} %-5p %m%n"/> </layout> </appender>
my log4j.xml file
<?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="a1" class="org.apache.log4j.consoleappender"> <param name="target" value="system.out"/> <param name="threshold" value="debug"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{iso8601} %-5p %m%n"/> </layout> </appender> <appender name="a2" class="org.apache.log4j.rollingfileappender"> <param name="file" value="../logs/server.log"/> <param name="maxfilesize" value="100mb"/> <param name="maxbackupindex" value="2"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{iso8601} %-5p %m%n"/> </layout> </appender> <root> <level value="debug"/> <appender-ref ref="a1"/> <appender-ref ref="a2"/> </root> </log4j:configuration>
server.log file - getxyzquery
2013-09-02 15:34:44,230 debug {conn-100087} preparing statement: select x,y,z xyz_tbl type_id = 1 order sort_priority asc 2013-09-02 15:34:44,230 debug {pstm-100088} executing statement: select x,y,z xyz_tbl type_id = 1 order sort_priority asc 2013-09-02 15:34:44,231 debug {conn-100089} connection 2013-09-02 15:34:44,240 debug {pstm-100088} parameters: [] 2013-09-02 15:34:44,243 debug {rset-100091} resultset 2013-09-02 15:34:44,244 debug query getxyzquery 18 ms using list (9-wlt.getworklisttabfilter mypchost) 2013-09-02 15:34:44,246 debug sql_return_conn: operational_db returned connection 000000001652311912 (a1/100 i1/40 w0)
getxyzquery select id in
select id="getxyzquery" parameterclass="string" resultclass="string"
i hope works perhaps doesn't send me ibatis xml file , logging framework using.
Comments
Post a Comment