-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: SQL queries showing up twice in log?
PostPosted: Tue Apr 25, 2006 5:30 pm 
Newbie

Joined: Thu Feb 02, 2006 2:42 am
Posts: 8
I have my log4j file set up to log the sql queries from hibernate.

<logger name="org.hibernate.SQL" >
<level value="debug"/>
<appender-ref ref="ConsoleAppender"/>
</logger>

However each query it runs seems to display twice in the log. Anyone else have this problem? I don't have the show sql property set in the hibernate config (first thing I thought of). Could I have done something wrong that is really causing it to run each query twice?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 6:38 pm 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
can you post an example. usually hibernate logs the hql and than the sql that is being executed

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 6:49 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Definitely check the above posters suggestion first.

If you're sure it's the *exact* same statement being logged (and not the SQL and HQL version as suggested above), then check your log4j configuration - it could be that you have two different appenders attached to the same logger/category and outputting to the same place.

You'll need to get more familiar with Log4j configuration regardless of which is the problem, they will both involve modifying the Log4j config file to fix.

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject: For upgradation of oracle 9i t0 10g release2
PostPosted: Wed Apr 26, 2006 3:47 am 
Newbie

Joined: Wed Apr 26, 2006 3:35 am
Posts: 1
Location: BAN
HI
presently i am using weblogic6.1 with SP3 and i am using oracle9i.
now i want upgrade my DB to Oracle 10g Release 2 (10.2.0.1.0)
for this upgradtion i need any cahnges to do.please let me know

_________________
Thanks & Best Regards

RAJU


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 5:45 pm 
Newbie

Joined: Thu Feb 02, 2006 2:42 am
Posts: 8
Thanks for the replies!

It is the exact same query in sql, it doesn't show the HQL query.

My entire log4j.xml is this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' >

<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>

<logger name="org.hibernate.SQL" >
<level value="debug"/>
<appender-ref ref="ConsoleAppender"/>
</logger>
<!--
<logger name="org.hibernate.cache" >
<level value="debug"/>
<appender-ref ref="ConsoleAppender"/>
</logger>
-->
<root>
<priority value ="info" />
<appender-ref ref="ConsoleAppender"/>
</root>

</log4j:configuration>

Here are a few example lines from the console.

DEBUG - select marketingm0_.mci_id as mci1_32_0_, marketingm0_.mci_name as mci2_32_0_, marketingm0_.mci_phone as mci3_32_0_, marketingm0_.mci_email as mci4_32_0_ from NEIL.manager_contact_info marketingm0_ where marketingm0_.mci_id=?
DEBUG - select marketingm0_.mci_id as mci1_32_0_, marketingm0_.mci_name as mci2_32_0_, marketingm0_.mci_phone as mci3_32_0_, marketingm0_.mci_email as mci4_32_0_ from NEIL.manager_contact_info marketingm0_ where marketingm0_.mci_id=?
DEBUG - select MIN(response0_.off_create_date) as col_0_0_ from NEIL.OFFER response0_ left outer join NEIL.offer_notes response0_1_ on response0_.OFF_ID=response0_1_.on_off_id where response0_.off_usr_id=? and response0_.off_status=?
DEBUG - select MIN(response0_.off_create_date) as col_0_0_ from NEIL.OFFER response0_ left outer join NEIL.offer_notes response0_1_ on response0_.OFF_ID=response0_1_.on_off_id where response0_.off_usr_id=? and response0_.off_status=?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 6:37 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Looks like you have ConsoleAppender attached to the org.hibernate.SQL logger. Hence the duplicate log statements.

You need to go start reading the Log4j doco to figure out how to do whatever it is you're trying to do.

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 6:41 pm 
Newbie

Joined: Thu Feb 02, 2006 2:42 am
Posts: 8
Thanks for the help. The problem was that the appender-ref in the logger was redundant and unnecessary.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.