logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Log4J Wrapping
Date Tue, 04 Jun 2002 22:18:47 GMT
Jeroen,

 From a very quick look at what you are trying to do, I suggest you create
an object type say MyObject that includes duration, userS, userR,
etc. and use that object when logging. You should also implement the
toString() method to return appropriate information.

Probably a better approach is to use the MDC.

At 11:20 04.06.2002 -0500, Frissaer, Jeroen wrote:
>Hi,
>
>My company is planning the use of Log4J within its applications (J2EE).  To
>serve our needs we will have to modify the Log4J API.  We must use a wrapper
>class in order to avoid recoding of the Log4J core each time we will change
>Log4J versions.
>
>Modifying the Log4J API will look something like this:
>instead of using Logger.debug(Object message) we want to use
>Logger.debug(long duration, String UserSession, String userRequest, String
>Resource, String ...)
>
>I tried making such a wrapper class with limited success.  It looks like
>this:
>
>package org.apache.log4j;
>
>import org.apache.log4j.LogManager;
>import org.apache.log4j.spi.*;
>
>
>public class MyWrapper {
>
>     public static Logger myLogger;
>     protected static LoggerRepository repository;
>
>     public static void getMyLogger(String name) {
>         myLogger = LogManager.getLogger(name);
>
>     }
>
>     public static void debug(long duration, String userS, String userR,
>String result, String locInf, String res1, String addAtt1, String addAtt2,
>String addAtt3) {
>         //if(repository.isDisabled(Level.DEBUG_INT))
>         //return;
>         if(Level.DEBUG.isGreaterOrEqual(myLogger.getEffectiveLevel())) {
>             myForcedLog(myLogger.getName(), Level.DEBUG, duration, userS,
>userR, result, locInf, res1, addAtt1, addAtt2, addAtt3);
>         }
>     }
>
>Has anyone done similar things before?  And would be kind enough to share
>some ideas with me?
>What do you, Log4J - Java experts, think of this wrapping?  Are there better
>ways to solve the problem?
>
>Thanks in advance
>Jeroen

--
Ceki

SUICIDE BOMBING - A CRIME AGAINST HUMANITY
Sign the petition: http://www.petitiononline.com/1234567b
I am signatory number 22106. What is your number?


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message