-->
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.  [ 2 posts ] 
Author Message
 Post subject: Log4j's debug level makes difference?
PostPosted: Thu Apr 29, 2004 3:12 am 
Newbie

Joined: Mon Sep 08, 2003 12:51 am
Posts: 19
Hi All,

I met a strange problem. My program only runs well when I use "debug" level of log4j. While I close "debug" option, it could not work. I wonder who ever met this?

I use hibernate 2.1.2.

Thanks,

Jun Huang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 7:34 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Two words: side effects.

Code like this:
Code:
if( log.isDebugEnabled() ){
  log.debug("size of collection: " + parent.getChildren().size());
}

Or objects that looks like this, that are subsequently used in a debug statement:
Code:
public class SideEffectObject{
...
public void toString(){
  this.internalState = "something";
  return super.toString()+internalState;
}
behave differently when debug is on/off.

Whenever somebody says "it's broken/works only when debug is on/off", in Java, it's always wither a side effect like one of the above or a race condition. And it's usually a side effect related issue.

Hibernate is subtle, especially when you have proxies and lazy collections flying around.
The issue is probably a side effect and is probably in your code rather than in the Hibernate code. Isolate the issue and then trace it in a debugger.

_________________
Cheers,
Shorn.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.