[slf4j-dev] [Fwd: FW: FW: New logging]
Ralph Goers
ralph.goers at dslextreme.com
Wed Sep 24 15:38:59 CEST 2008
I'm posting this to the dev list to help maintain the public record.
-------- Original Message --------
Subject: FW: FW: New logging
Date: Wed, 24 Sep 2008 06:22:44 -0700
From: Goers, Ralph <Ralph.Goers at digitalinsight.com>
To: <rgoers at apache.org>
CC:
Thanks for the quick response. I will open a bug report for this.
-----Original Message-----
From: Ceki Gulcu [mailto:ceki at qos.ch]
Sent: Wednesday, September 24, 2008 2:49 AM
To: Goers, Ralph
Subject: Re: FW: New logging
Hi Ralph,
Thank you for your input. I agree that having to declare both an xlogger and a
logger is cumbersome. May I suggest that you enter a bug report for this item,
so that I can refer to it when describing the new release. Do I have your
permission to quote your message so that the rest of the SLF4J community is kept
informed? Alternatively, you could forward it to dev at slf4j yourself.
To keep the ball rolling, I've already committed relevant changes. In revision
1149, XLogger implements the org.slfj4j.Logger interface. Could you please have
a look?
http://svn.slf4j.org/viewvc?view=rev&revision=1149
Cheers,
Goers, Ralph wrote:
>
>
> *From:* Goers, Ralph
> *Sent:* Tuesday, September 23, 2008 2:58 PM
> *To:* Perrine, Andy; Buckley, Krista
> *Cc:* 'ceki at slf4j.org'
> *Subject:* RE: New logging
>
>
>
> I'm forwarding this to Ceki. For some reason it didn't dawn on me that
> XLogger doesn't extend Logger. This is why the version is marked as
> alpha0 by the way.
>
>
>
> You can certainly use the LoggerUtil.entering methods in our framework
> extensions until Ceki fixes this.
>
>
>
> FWIW , Logger logger = new XLogger(LoggerFactory.getLogger(name));
> wouldn't really amount to much in the way of extra garbage.
>
>
>
> *From:* Perrine, Andy
> *Sent:* Tuesday, September 23, 2008 2:52 PM
> *To:* Buckley, Krista; Goers, Ralph
> *Subject:* RE: New logging
>
>
>
> That's ugly and it's creating a lot of extra garbage to be collected
> compared to the previous version, surely there must be a better way?
>
>
> ------------------------------------------------------------------------
>
> *From:* Buckley, Krista
> *Sent:* Tuesday, September 23, 2008 2:49 PM
> *To:* Goers, Ralph
> *Cc:* Perrine, Andy
> *Subject:* RE: New logging
>
>
>
> So now that we discovered XLogger does not extend Logger, we are doing
> it this way. We use XLogger for entry, exit, catching, throwing; we use
> Logger for all else.
>
>
>
> import org.slf4j.Logger;
>
> import org.slf4j.LoggerFactory;
>
> import org.slf4j.ext.XLogger;
>
>
>
> public class AccountSelector
>
> {
>
> private Logger logger = LoggerFactory.getLogger(getClass().getName());
>
> private XLogger xlogger = new XLogger(logger);
>
>
>
> // No getLogger() method
>
>
>
> xlogger.entry();
>
>
>
> ve = new ValidationException("Password validation Failed
> (consecutive char)");
>
> logger.debug("Password must not contain more then the
> following consective characters: {}",
>
> passwordMaxConsecutive);
>
> xlogger.throwing(ve);
>
>
>
>
>
> logger.info("Password must not exceed the maximum length
> of {}", passwordMaxLength);
>
>
>
> try
>
> {
>
> ...
>
> }
>
> catch (Exception e)
>
> {
>
> xlogger.catching(e);
>
> }
>
>
>
> xlogger.exit(); // Alternately: xlogger.exit(result);
>
>
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the slf4j-dev
mailing list