ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diran Ayandele <Adediran.Ayand...@Sun.COM>
Subject Re: Logging parameters
Date Tue, 11 Apr 2006 15:22:20 GMT
Hi Paul - if you're using log4j you can just set the following category 
in your appender to debug:
<category name="com.ibatis">
<priority value="debug" />
</category>

It will log the sql and then on a subsequent line log any regular 
parameters. If you use inline parameters ($value$) they will show up in 
the sql.

Diran

Paul Carr wrote:

> Hi all, is there a way to tell iBatis to log out the SQL and any 
> parameters upon throwing an SQLException ?
>
> i.e.. instead of logging “select name from person where name = $1”;
>
> make it log “select name from person where name = ‘Paul’;
>
> Infact….how do you make it log out the SQL query string in the first 
> place?
>
> -----Original Message-----
> *From:* Alexander Sack [mailto:pisymbol@gmail.com]
> *Sent:* 07 April 2006 18:45
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: iBatis within EAR files
>
> The client? The client is in my.jar which is a bunch of EJBs plus a 
> class wrapping a DAO. The war file is in a separate deployment. It 
> looks up an EJB interface, calls it. The interfaces are shared in a 
> common library outside both WAR and EAR (global scope).
>
> That eventually gets me inside my.jar. my.jar DAO wrapper classes 
> calles getResourceAsReader()"com/blah/blah)."
>
> The ibatis libraries are part of the my.jar MANIFEST within the EAR. 
> The ibatis libraries are in the EAR under a lib directory (MANIFEST 
> has Class-Path entres lib/ibatis.jar ,etc.)..
>
> The only way for me to get this to work is to use 
> Thread.currentThread().setContextClassLoader(myDAO.class.getClassLoader()) 
> before calling the getResourceAsReader() but then for a common 
> typeHandler callback defined in an external library (with global 
> scope) is not found. I'm not even sure if I really should have to do this.
>
> Thanks for the feedback,
>
> -aps
>
> On 4/7/06, *Jeff Butler* <jeffgbutler@gmail.com 
> <mailto:jeffgbutler@gmail.com>> wrote:
>
> What's the client? my.war? myejb.jar? Make sure that my.jar is in the 
> manifest classpath of the client.
>
> I have the ibatis*.jar files in the EAR on WebSphere and have no 
> troubles - but the different module's classpaths do need to be setup 
> properly.
>
> Jeff Butler
>
> On 4/7/06, *Alexander Sack* <pisymbol@gmail.com 
> <mailto:pisymbol@gmail.com> > wrote:
>
> Hello iBatis Folks,
>
> I have this problem when using iBatis within in an EAR (I posted this 
> in the JBoss Forum but so far no solution):
>
> my.ear
> my.jar
> my.jar/META-INF/MANIFEST.MF
> lib/ibatis*.jar
> my.jar/com/blah/blah/mapfile.xml
>
> The MANIFEST.MF file has Class-Path: lib/ibatis*.jar etc. When the EAR 
> gets deployed, the getResourceReader() can not find the map files 
> within the my.jar file! It seems that getResourceReader("com/blah
>
> /balh") can't find it in the current classpath. I noticed that the 
> iBatis Resource object is using the current thread's context 
> classloader which I'm not sure seems right to me for this scenario.
>
> If I set the currentThread.setContextClassLoader() to my objects class 
> loader, it can then find the map files witin the JAR but then can't 
> find a typeHandler class in a common library outside the EAR (EARs are 
> scoped). So this isn't going to work for me.
>
> Any clue on how to solve this or how I should load map files witin a 
> module in an EAR deployment? What's the best practices regarding 
> iBatis and EAR files?
>
> Thanks!
>
> -aps
>
>
>
> -- 
> "What lies behind us and what lies in front of us is of little concern 
> to what lies within us." -Ralph Waldo Emerson
>
>
>
>
>
>
> -- 
> "What lies behind us and what lies in front of us is of little concern 
> to what lies within us." -Ralph Waldo Emerson
>

Mime
View raw message