RE: [Trinidad] Redirect Logging to log4j

2007-10-31 Thread Kuhn, Harald
Hi to all, 
 
I 've enhanced this class a little.
ResourceBundles and Formatted Messages are handeled correctly, now.
 
Please feel free to publish this version on the wiki.
 
Kind regards
 
  Harald
 
** 
Harald Kuhn 
AirPlus International 
Business Information Services 
Phone:   +49 (0) 61 02 204-821 
Fax: +49 (0) 61 02 204-139 
E-Mail:   [EMAIL PROTECTED] 
Internet:   http://www.airplus.com/ www.airplus.com 
** 



Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263 
Neu-Isenburg · Germany · Geschäftsführer: Patrick W. Diemer (Vorsitz), Lutz 
Logemann · Vorsitzender des Aufsichtsrates: Stephan Gemkow · Handelsregister: 
Amtsgericht Offenbach/Main, HRB 8119

-Original Message-
From: Kuhn, Harald [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 01, 2007 4:38 PM
To: MyFaces Discussion
Subject: [Trinidad] Redirect Logging to log4j



Hi, 

as we are using log4j as logging framework (tomcat internal and webapps), I 
tried to redirect the log output of Trinindad to log4j.

I used the code provided by 
 http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging 
http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging 

The output is actually redirected from JDK-Logging -- commons-logging -- 
log4j. 
But there is a little difference: 

Output from JDK-Logging: 
01.10.2007 16:23:17 org.apache.myfaces.trinidadinternal.config.ConfigParser 
parseConfigFile 
INFO: Trinidad is running in debug mode. Do not use in a production 
environment. See:/WEB-INF/trinidad-config.xml 
01.10.2007 16:23:17 
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl _checkTimestamp 
INFO: Apache Trinidad is running with time-stamp checking enabled. This should 
not be used in a production environment. See the 
org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml

Same output redirected to log4j: 
2007-10-01 16:18:48,687   INFO  
org.apache.myfaces.trinidadinternal.config.ConfigParser: RUNNING_IN_DEBUG_MODE 
2007-10-01 16:18:49,078   INFO  
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl: 
TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION

As JDK Logging has a method java.util.logging.Logger.getLogger(name, 
resourceBundleName) 
I think this would cause the problem. And RUNNING_IN_DEBUG_MODE and 
TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION are just the keys into the 
RessourceBundle.

Is this assumption right? 

Before a deeper inspection of the code provided by the wiki page, I would 
kindly ask, if there is already a solution for this problem?

Kind regards 

  Harald 


** 
Harald Kuhn 
AirPlus International 
Business Information Services 
Phone:   +49 (0) 61 02 204-821 
Fax: +49 (0) 61 02 204-139 
E-Mail:   [EMAIL PROTECTED] 
Internet:   http://www.airplus.com www.airplus.com 
** 



Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263 
Neu-Isenburg · Germany · Geschäftsführer: Patrick W. Diemer (Vorsitz), Lutz 
Logemann · Vorsitzender des Aufsichtsrates: Stephan Gemkow · Handelsregister: 
Amtsgericht Offenbach/Main, HRB 8119




JavaLoggingToCommonLoggingRedirector.java
Description: JavaLoggingToCommonLoggingRedirector.java


Re: [Trinidad] Redirect Logging to log4j

2007-10-31 Thread Stephen Friedrich

A more elegant way is to make the nested class a top-level class and throw away 
the rest.
You can then put this into your logging.properties to always enable the 
redirection:
handlers = org.apache.wiki.JDKLogHandler
org.apache.wiki.JDKLogHandler = ALL


BTW: These lines are completely superfluous:
   // switch back to raw Message
   message = record.getMessage();
If an exception is thrown the message will not have been assigned yet anyway.

And I think you can just as well throw away the check for parameters.


Kuhn, Harald wrote:

Hi to all,
 
I 've enhanced this class a little.

ResourceBundles and Formatted Messages are handeled correctly, now.
 
Please feel free to publish this version on the wiki.
 
Kind regards
 
  Harald
*//* 
*/**/*

*/Harald Kuhn/*
*/AirPlus International/*
*/Business Information Services/*
*/Phone:   +49 (0) 61 02 204-821/*
*/Fax: +49 (0) 61 02 204-139/*
*/E-Mail:   [EMAIL PROTECTED]/*
*/Internet:  /**/_www.airplus.com_/* http://www.airplus.com/*//*
*/**/*


Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263 
Neu-Isenburg · Germany · Geschäftsführer: Patrick W. Diemer (Vorsitz), 
Lutz Logemann · Vorsitzender des Aufsichtsrates: Stephan Gemkow · 
Handelsregister: Amtsgericht Offenbach/Main, HRB 8119***//**//**//*


-Original Message-
*From:* Kuhn, Harald [mailto:[EMAIL PROTECTED]
*Sent:* Monday, October 01, 2007 4:38 PM
*To:* MyFaces Discussion
*Subject:* [Trinidad] Redirect Logging to log4j

Hi,

as we are using log4j as logging framework (tomcat internal and 
webapps), I tried to redirect the log output of Trinindad to log4j.


I used the code provided by
_http://wiki.apache.org/myfaces/Trinidad_and_Common_Logging_

The output is actually redirected from JDK-Logging -- commons-logging 
-- log4j.

But there is a little difference:

Output from JDK-Logging:
01.10.2007 16:23:17 
org.apache.myfaces.trinidadinternal.config.ConfigParser parseConfigFile
INFO: Trinidad is running in debug mode. Do not use in a production 
environment. See:/WEB-INF/trinidad-config.xml
01.10.2007 16:23:17 
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl 
_checkTimestamp
INFO: Apache Trinidad is running with time-stamp checking enabled. This 
should not be used in a production environment. See the 
org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in 
WEB-INF/web.xml


Same output redirected to log4j:
2007-10-01 16:18:48,687   INFO  
org.apache.myfaces.trinidadinternal.config.ConfigParser: 
RUNNING_IN_DEBUG_MODE
2007-10-01 16:18:49,078   INFO  
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl: 
TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION


As JDK Logging has a method java.util.logging.Logger.getLogger(name, 
resourceBundleName)
I think this would cause the problem. And RUNNING_IN_DEBUG_MODE and 
TIMESTAMP_CHECKING_ENABLED_SHOULDNOT_IN_PRODUCTION are just the keys 
into the RessourceBundle.


Is this assumption right?

Before a deeper inspection of the code provided by the wiki page, I 
would kindly ask, if there is already a solution for this problem?


Kind regards

  Harald


*/**/*
*/Harald Kuhn/*
*/AirPlus International/*
*/Business Information Services/*
*/Phone:   +49 (0) 61 02 204-821/*
*/Fax: +49 (0) 61 02 204-139/*
*/E-Mail:   [EMAIL PROTECTED]/*
*/Internet:  /**/_www.airplus.com_/* http://www.airplus.com*//*
*/**/*



Lufthansa AirPlus Servicekarten GmbH · Hans-Böckler-Straße 7 · 63263 
Neu-Isenburg · Germany · Geschäftsführer: Patrick W. Diemer (Vorsitz), 
Lutz Logemann · Vorsitzender des Aufsichtsrates: Stephan Gemkow · 
Handelsregister: Amtsgericht Offenbach/Main, HRB 8119***//**//**//*