Sweet, thats perfect.  Thanks

********************************************
Steve Ebersole
IT Integration Engineer
Vignette Corporation 
512.741.4195

Visit http://www.vignette.com

********************************************


-----Original Message-----
From: Mark Womack [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 12:57 PM
To: 'Log4J Users List'
Subject: RE: LocationInfo and Logging wrappers


Steve, 

If you are creating a wrapper and you want the correct location info, then
you just need to use the correct value for the caller's FQCN (fully
qualified class name).  Something like this:

public class MyWrapper {
...
    private static String FQCN = MyWrapper.class.getName();
...
    private Logger logger;
...
    /**
      A wrapper method for a debug log message. */
    public void debug(Object message) {
        logger.log(FQCN, Priority.DEBUG, message, null);
    }
...
}

Then it should generate the correct location info.

hope it helps,
-Mark

> -----Original Message-----
> From: Ebersole, Steven [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 26, 2002 10:20 AM
> To: 'Log4J Users List'
> Subject: LocationInfo and Logging wrappers
> 
> 
> I know all the arguments about obtaining LocationInfo being slow.  
> 
> That being said, I am looking at using "wrapper" classes around log4j
> Loggers (sort of similiar to what jakarta commons does).  We find the
> LocationInfo invaluable in most logging cases for their 
> debug/investagation
> value.  However doing this wrapping will cause the LocationInfo to be
> generated "incorrectly".  
> 
> A simple way around would be to create my wrapper as a 
> subclass of Logger
> (creating an appropriate LoggerFactory).  However, I have 
> seen that this
> practice is now discouraged.  The only other simple way I can 
> seem to see is
> to modify the LocationInfo source to take into account that the actual
> location is not the line directly after the name of the 
> Category/Logger in
> the stack trace, but is actually X lines after the Category/Logger.
> 
> Is there another way I am missing?
> 
> If not, any huge pros and/or cons to either approach above?
> 
> 
> 
> ********************************************
> Steve Ebersole
> IT Integration Engineer
> Vignette Corporation 
> 512.741.4195
> 
> Visit http://www.vignette.com
> 
> ********************************************
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to