[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slf4j-user
Subject:    Re: [slf4j-user] Proper use of XLogger
From:       ceki <ceki () qos ! ch>
Date:       2012-05-29 8:51:40
Message-ID: 4FC48E1C.2060105 () qos ! ch
[Download RAW message or body]

Hi Aleks,

On 28.05.2012 23:32, Aleks M wrote:
> Hello,
> I have a class in which I want to trace the method calling flow using
> XLogger entry() and exit().
> Right now I have the following line in my class:
>
> private final static Logger logger = LoggerFactory.getLogger("main");
>
> I'm also using Logback together with SLF4J.
>
> If I add the following, will this return the same logger as the first
> line, since they have the same name?:
>
> private final static XLogger trace = XLoggerFactory.getXLogger("main");

Yes, it will be the same logger that will be returned.

> I'm asking since I only want XLogger to log when I turn up my regular
> logger to TRACE level.

Settings to regular loggers will apply to Xloggers as well.

> If I now add something like:
> trace.entry(param1, param2); to each of my methods,
> will I incur a heavy performance penalty when I have a log level less
> than TRACE, e.g. ERROR? I'm asking because I can't parametrize the log
> call like I can with a regular Logger.

The entry() method will just exit if the trace level is disabled for the 
logger in question.

HTH,

-- 
Ceki
http://twitter.com/#!/ceki
_______________________________________________
slf4j-user mailing list
slf4j-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic