[slf4j-dev] Re: TRACE level

Niclas Hedhman niclas at hedhman.org
Tue Jul 5 04:18:10 CEST 2005


On Tuesday 05 July 2005 03:57, Ceki Gülcü wrote:
> So, wdyt?

At first I am undecided. Somehow it feels very similar to what we did in 
LogKit as well as Avalon Logging API, but still not. Why not use child 
loggers instead? Direct comparison;

class HttpRequest {

   Logger mainLogger = LoggerFactory.getLogger(HttpRequest.class);
   Logger headerLogger = mainLogger.addChildLogger( "headers" );

   void doRequest() 
   {
       mainLogger.debug("Request URI is {}", uri);

       headerLogger.debug( "Headers follow." );
       for(int i = 0; i < header.length; i++) 
       {
           headerLogger.debug( "{}: {}", header[i].getName(), 
header[i].getValue());
       }
  
       ... do real work
   }
}


Automatically get the composite, less method signatures, more leverage on the 
rest of the logging framework. Less overhead ? Less "adaption" ?


Cheers
Niclas



More information about the slf4j-dev mailing list