You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Honczar <al...@appi.com.br> on 2006/02/03 13:11:07 UTC

need suggestion about jdk 1.4 logging in Tomcat

Hi,

I need a suggestion about java logging within a context.
I´d like to have a way to isolate the jdk1.4 log between Tomcat contexts.

In my own lines of code, I create a JDK1.4 logger with an associated name, Handler and Formatter. This way, I have one log file per context.
My problem is when I add Frameworks like Struts and Hibernate to my context. I would like them logging into my current context log file.

Since they use commons logging, I´ve had to call LogManager.getLogManager().readConfiguration(InputStream is); in order to make the logging engine load my configurations and let me log where I wish.
But that affects in a global way. If I have only one context running, everything is fine, but with many, the last context that called readConfiguration redefines all the precedents.
I looked to the sources of the jdk and found it relies on the System Classloader...

I am a little bit trapped here, as I do not know how to redirect the log of the instances of hibernate and struts to the log of my context of tomcat.

I appreciate very much any suggestions.

TIA,
Alan Honczar


--------

AVISO LEGAL - Esta mensagem e seu conteúdo - inclusive anexos - são para uso exclusivo de seu(s) destinatário(s), podendo conter informações confidenciais e/ou legalmente privilegiadas sobre a APPI Tecnologia S/A. Qualquer modificação, retransmissão, disseminação, impressão ou utilização não autorizada fica estritamente proibida. Se você recebeu esta mensagem por engano, por favor informe ao remetente e apague o material e as cópias de sua máquina.

LEGAL ADVICE - This message - including any attachments - contains confidential and privileged information from APPI Tecnologia S/A intended for the named recipient(s) only. Any modification, copying, printing or distribution of this message or the taking of any action based on it is strictly prohibited. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system.

---------



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: need suggestion about jdk 1.4 logging in Tomcat

Posted by Boris Unckel <bo...@gmx.net>.
> Since they use commons logging, I´ve had to call
> LogManager.getLogManager().readConfiguration(InputStream is); in order to
make the logging engine
> load my configurations and let me log where I wish.
> But that affects in a global way. If I have only one context running,
> everything is fine, but with many, the last context that called
> readConfiguration redefines all the precedents.
> I looked to the sources of the jdk and found it relies on the System
> Classloader...
> 
> I am a little bit trapped here, as I do not know how to redirect the log
> of the instances of hibernate and struts to the log of my context of
tomcat.
> 
> I appreciate very much any suggestions.
Try x4juli at http://www.x4juli.org
You can configure per ThreadContextClassLoader (so per webapp).
Use one config file per webapp as shown in the examples for tomcat
in the distribution.

Second possibility is to use Tomcat JULI (x4juli is based on Tomcat JULI) it
supports TCCL, too.

I am interested in feedback what you test and your final decision and
solution.

Regards
Boris

Regards
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org