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


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

Re: Question about loggers

Path csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: Question about loggers
Date Thu, 08 Mar 2012 07:22:09 -0800
Organization albasani.net
Lines 21
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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.albasani.net PDMBdUi9ezAlVcj4AYBPsKH+97N1mZCo3wUtXHoNdYeJyH4h5p3YSl76+13NaS89gJK14nE7UUY83S7lE6mYZ/ObsYNouOpN3zuE++3tUHSrOAj10eo3dWK5saDmzlgj
NNTP-Posting-Date Thu, 8 Mar 2012 15:22:11 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="N5IrIWQ8DasM0xcmK7QToojgNXDfLNvzAITY/azomKWbZ2Uxg4p0QniyIWej4pvfLCEF+3RD8vllTjl60/ABDWhQlTU665+lO2X0aj3qX4LNNMJFBwwmCNfe/aQ1Og5l"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
In-Reply-To <4f57fc25$0$290$14726298@news.sunsite.dk>
Cancel-Lock sha1:H3fDMZlNEDm04JTn5ZmQr1SNkZs=
Xref csiph.com comp.lang.java.programmer:12766

Show key headers only | 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