Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12766

Re: Question about loggers

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: Question about loggers
Date 2012-03-08 07:22 -0800
Organization albasani.net
Message-ID <jjair3$63e$1@news.albasani.net> (permalink)
References <XnsA00FACCA4B5E9jpnasty@94.75.214.39> <4f57de3b$0$286$14726298@news.sunsite.dk> <XnsA00FC1E7AC0A8jpnasty@94.75.214.39> <4f57fc25$0$290$14726298@news.sunsite.dk>

Show all headers | View raw


Arne Vajhøj wrote:
> I would use a static logger and not call getLogger in every ctor.
>
> Not due to performance, because I don't think there will be much,
> but because I think it is nice to keep that type of non business
> logic out of the ctor, so that when one read the ctor one can focus
> on the real purpose of it.

I prefer instance loggers, as a rule but not always. For one thing this allows 
me to determine the logger's identity via a call to 'getClass()'. Mainly, 
though, it's the scope of the variable. In an instance context I prefer 
instance or local variables. In a static context I prefer local variables, 
occasionally static memebers. I determine the scope of the logger variable by 
the scope of its use.

Logging is a standard enough aspect that I don't find it offputting in the logic.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Question about loggers Novice <novice@example..com> - 2012-03-07 21:52 +0000
  Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 17:16 -0500
    Re: Question about loggers Novice <novice@example..com> - 2012-03-07 23:57 +0000
      Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:24 -0500
        Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-08 07:22 -0800
          Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 10:27 -0500
            Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-08 11:58 -0800
              Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 15:49 -0500
          Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-08 08:15 -0800
            Re: Question about loggers markspace <-@.> - 2012-03-08 10:05 -0800
              Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-08 13:50 -0500
              Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 07:11 -0800
                Re: Question about loggers Lew <noone@lewscanon.com> - 2012-03-09 07:45 -0800
                Re: Question about loggers markspace <-@.> - 2012-03-09 07:54 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:03 -0500
                Re: Question about loggers markspace <-@.> - 2012-03-09 09:10 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:27 -0500
                Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:56 -0800
                Re: Question about loggers Robert Klemme <shortcutter@googlemail.com> - 2012-03-09 20:29 +0100
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 11:04 -0500
                Re: Question about loggers markspace <-@.> - 2012-03-09 09:14 -0800
                Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 12:22 -0500
                Re: Question about loggers Lew <lewbloch@gmail.com> - 2012-03-09 10:58 -0800
  Re: Question about loggers markspace <-@.> - 2012-03-07 15:21 -0800
    Re: Question about loggers Novice <novice@example..com> - 2012-03-08 00:01 +0000
    Re: Question about loggers Arne Vajhøj <arne@vajhoej.dk> - 2012-03-07 19:21 -0500
      Re: Question about loggers Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-08 06:18 -0400

csiph-web