質問

Does anyone know solution how to see SQL log on console after using method which invoking some sql query? I am using Eclipse, Log4J fw and TopLink V11.1.1.5.

This is my log4j file:

log4j.appender.sql.Threshold=INFO
log4j.appender.sql=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.sql.URL=url
log4j.appender.sql.sql=xxxx
log4j.appender.sql.password=pwd
log4j.appender.sql.user=user
log4j.appender.sql.driver=driver

I guess that I am missing some line in Log4j properties file.

Thanks in advance!

役に立ちましたか?

解決

I dont think you can do this by configuration, AFAIK you need to log the statements (from code) befor you fire them. Alternatively you can use somethink like SQL Monitor but then you will not have the statements in your log4J log file.

If you decide to make the 1st option you can create a wrapper class for running SQL statements which logs these.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top