"Llewellyn Falco" <[EMAIL PROTECTED]> writes:

>as long as we are on the subject of logging...

>a pattern that has worked very well for us, and other companies i've talked 
>to is a static logging class.  this makes life a lot easier, and allows you 
>to swap out logging as desired, add convenience functions, even replace the 
>whole thing with a empty methods

>the basic idea is

>class Logger
>{
>  public static void log(int level, String text)
>{
>   otherLogger.log(level,text) ; // or however you want to wrap it.
>}
>}

If you do so, you must still create "otherLogger" in you Logger
class. What does this buy you? 

--- cut ---
private static final Log log = LogFactory.getLog(Foo.class);

and log.info(), log.debug(), log.warn()
--- cut ---

works well enough for me. ;-) 

>This way no loggers are passed around, no loggers are needlessly created, 
>just have everything in the velocity package log through their static class.

I don't understand. Do you suggest having multiple

--- cut --- 
public final class Logger {
static {
  myLogger = <jdk 1.4 way of getting a logger>
}

public static final void debug(String foo) {
  myLogger.debug(foo);
}
[...]
}
--- cut --- 

--- cut --- 
public final class Logger {
static {
  myLogger = <log4j way of getting a logger>
}

public static final void debug(String foo) {
  myLogger.debug(foo);
}
[...]
}
--- cut --- 

so that you can write Logger.debug(xxx) everywhere or do you suggest
to name them e.g. JDK14Logger, Log4JLogger? In the first case: How do
you get multiple classes with the same name in the jar. In the second
case: How do you resolve the different static class names at runtime?

        Best regards
                Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

                      4 - 8 - 15 - 16 - 23 - 42

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

Reply via email to