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.  [ 4 posts ] 
Author Message
 Post subject: Logging for multiple session factories in a managed environm
PostPosted: Tue Jan 31, 2006 8:10 am 
Newbie

Joined: Fri Sep 12, 2003 1:44 pm
Posts: 15
Hi,

I've been looking for a way to differentiate the log output of multiple SessionFactory instances in a JBoss server.

More specifically; I have multiple SessionFactory instances bound to JNDI in a single JBoss server instance. I want to be able to set the log level to DEBUG for SessionFactory 1 and all the Session's built using it, but keep the log level as INFO for the rest (Keeping every mapped class in a single SessionFactory is not an option for my case).

However, looking at the code of SessionFactoryImpl, the logger is declared as:
private static final Log log = LogFactory.getLog(SessionFactoryImpl.class);

which uses a logger named after the class name. And declared final.

So, I assume all hibernate log output should use the same Logger, hence no ability to differentiate the output.

Is there any way to overcome this limitation ?

Thanks,
Bulent Erdemir


Top
 Profile  
 
 Post subject: open source
PostPosted: Tue Jan 31, 2006 7:20 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
you could alter source a bit , for example make the log non static and provide a setter for the log, then in the code that creates those factories the log name can be specified.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Logging for multiple session factories in a managed environm
PostPosted: Wed Feb 01, 2006 4:13 am 
Newbie

Joined: Fri Sep 12, 2003 1:44 pm
Posts: 15
Thanks. That's what I thought in case there's no other way without modifying the source. (I've been thinking of some methods based on using different classloaders.)
I wonder how people have been living with this, because I think parametric log output modification/redirection is crucial in a managed environment.

I guess I'll make a patch and submit to hibernate developers.

Regards,
Bulent Erdemir


Top
 Profile  
 
 Post subject: classloaders
PostPosted: Wed Feb 01, 2006 12:30 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I would not recomment trying to mess with classloaders, it might have nasty side effects.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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