Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21805
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!goblin3!goblin1!goblin.stu.neva.ru!border1.hitnews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 27 Jan 2013 13:51:57 -0600 |
| From | Leif Roar Moldskred <leifm@dimnakorr.com> |
| Subject | Re: ultralog: new concept of logging API |
| Newsgroups | comp.lang.java.programmer |
| References | <0cfefb99-94f9-44e0-9b58-926818a9560d@googlegroups.com> <ke3s9v$md5$1@dont-email.me> <78bfbd4c-a257-44ed-ae03-73ceb19fab18@googlegroups.com> |
| User-Agent | tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (Linux/3.0.0-30-generic-pae (i686)) |
| Message-ID | <J_2dnYO2VrzAGJjMnZ2dnUVZ8oqdnZ2d@giganews.com> (permalink) |
| Date | Sun, 27 Jan 2013 13:51:57 -0600 |
| Lines | 59 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-bAPyAbSHerOLYvRZjlED4lKceX1/Q64JWUW0+myV2Sf58QUHeju3Fhmzaux6CT/vXxwREY6r8KgdpTC!i/+nJ1C3oZnZ6e7g/WSq3g22+sGcey1JWGzN9LvVNWXOHKg8FhkZbLdf34hameIQXO1NsaNI+mpE!ew== |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 3058 |
| Xref | csiph.com comp.lang.java.programmer:21805 |
Show key headers only | View raw
vladimirow@mail.ru wrote:
> For me the following:
>
> logger.userLoggedIn (userName, address);
>
> is clearer than
>
> logger.info ("User `" + userName + "' logged in from " + address);
>
> or
>
> logger.info ("User `{}' logged in from {}", userName, address);
>
> or
>
> logger.infoT ("User `{}' logged in from {}").p (userName).p (address).endT ();
>
> Anyway this is matter of personal preference.
Actually, I disagree with both claims, but regardless, even if you
prefer the first version, I fail to see the advantage in your way of
doing it compared to just doing this:
public SomeResult someMethod( Argument anArg ) {
/* Boring business stuff */
Result aResult = ...
/* Exciting logging stuff */
logResultDigest( anArg, aResult );
return aResult;
}
private void logResultDigest( Argument arg, SomeResult result ) {
String orderID = arg.getOrder().getID();
if( yeOldeLogger.isDebugEnabled() ) {
String resultDigest = expensiveDigestCalculation( result );
yeOldeLogger.debug( "Processed order {} in process {}. Result digest : {}",
orderID, this.processID, resultDigest );
}
else {
yeOldeLogger.info( "Processed order {} in process {}.",
orderID, this.processID );
}
}
To me, your way of doing it just introduces a pointless extra layer of
indirection into the code which provides little actual benefit. In my
experience, a particular log message is almost always tied to only one
specific point in the code, so it makes no sense to abstract it out
into an interface. (I actually think a good argument can be made that
writing identical log messages from multiple points in the good is a
strong suggestion that either your code is badly structured and should
be refactored, or that your logging scheme is badly thought out and
uninformative.)
--
Leif Roar Moldskred
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-26 22:05 -0800
Re: ultralog: new concept of logging API markspace <markspace@nospam.nospam> - 2013-01-27 10:39 -0800
Re: ultralog: new concept of logging API vladimirow@mail.ru - 2013-01-27 11:03 -0800
Re: ultralog: new concept of logging API Joerg Meier <joergmmeier@arcor.de> - 2013-01-27 20:48 +0100
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-27 20:15 -0800
Re: ultralog: new concept of logging API Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-01-27 13:51 -0600
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-27 19:57 -0800
Re: ultralog: new concept of logging API Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-28 05:23 -0400
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-28 01:32 -0800
Re: ultralog: new concept of logging API Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-28 05:37 -0400
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-28 02:06 -0800
Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-28 13:49 -0800
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 06:04 -0800
Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-29 10:19 -0800
Re: ultralog: new concept of logging API Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-01-29 13:10 -0600
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 11:34 -0800
Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-29 20:16 -0500
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 19:57 -0800
Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-29 22:56 -0800
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 23:19 -0800
Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-30 08:23 -0800
Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-30 16:54 +0000
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 13:33 -0800
Re: ultralog: new concept of logging API tisue@cs.nwu.edu (Seth Tisue) - 2013-01-30 16:37 -0500
Re: ultralog: new concept of logging API tisue@cs.nwu.edu (Seth Tisue) - 2013-01-30 16:33 -0500
Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:50 -0500
Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 10:38 +0000
Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:30 -0500
Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:30 -0500
Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 17:55 +0000
Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 10:48 +0000
Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:32 -0500
Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 17:58 +0000
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-31 21:49 -0800
Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:47 -0500
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 21:14 -0800
Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:43 -0500
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 21:11 -0800
Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 13:43 -0800
csiph-web