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 , e2n, , software | Björn Raupach <ra...@e2n.de> on 2010/01/12 16:09:16 UTC

Logging in iBatis 3

Hello,

short Question: How is logging configured in iBatis 3?

In iBatis2 we used to caught the SQLException, logged it and threw a RuntimeException. 

However in iBatis3 there are no checked execptions anymore.

We are using log4j. In log4j.properties we tried:

log4j.logger.org.apache.ibatis=DEBUG
log4j.logger.java.sql=DEBUG

The sql statement logging is nice, but how to record if something goes wrong? Lets say an insert fails because of a constraint? There is some nice output in my unit tests, but I havent't figured out how retrieve the SQL Exection to log the in the application log.

Thanks in advance!

Re: Logging in iBatis 3

Posted by Clinton Begin <cl...@gmail.com>.
The SqlException is always within the thrown exception as a chained
exception.

Clinton

2010/1/12 [e2n] software | Björn Raupach <ra...@e2n.de>

> Hello,
>
> short Question: How is logging configured in iBatis 3?
>
> In iBatis2 we used to caught the SQLException, logged it and threw a
> RuntimeException.
>
> However in iBatis3 there are no checked execptions anymore.
>
> We are using log4j. In log4j.properties we tried:
>
> log4j.logger.org.apache.ibatis=DEBUG
> log4j.logger.java.sql=DEBUG
>
> The sql statement logging is nice, but how to record if something goes
> wrong? Lets say an insert fails because of a constraint? There is some nice
> output in my unit tests, but I havent't figured out how retrieve the SQL
> Exection to log the in the application log.
>
> Thanks in advance!
>