Posted By

ff1959 on 10/22/09


Tagged

apache log4j commons


Versions (?)

get underlying log4 logger from commons logger


 / Published in: Java
 

This snippet shows how to get access to the underlying log4j logger when using apache commons logging.

  1. if(logger instanceof Log4JLogger)
  2. {
  3. Log4JLogger log4j = (Log4JLogger)logger;
  4. Logger underlyingLogger = log4j.getLogger();
  5. underlyingLogger.setLevel(Level.INFO);
  6. underlyingLogger.addAppender(new ConsoleAppender(
  7. new PatternLayout("%-5p [%t]: %m%n")));
  8. }

Report this snippet  

You need to login to post a comment.