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


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

Re: dependency injection and loggers

Newsgroups comp.lang.java.programmer
Date 2013-01-05 12:24 -0800
References <e3230fa7-b672-49e0-a7ef-dfb55a9180b5@googlegroups.com> <kc6rjn$fl2$1@dont-email.me> <50e70f03$0$80098$742ec2ed@news.sonic.net> <50e79d8e$0$281$14726298@news.sunsite.dk>
Message-ID <c50e1006-1d27-4801-9ac9-6574506883b2@googlegroups.com> (permalink)
Subject Re: dependency injection and loggers
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Arne Vajhøj wrote:
> Kevin McMurtrie wrote:
>> My biggest peeve about most
>> loggers is that they don't indent multi-line log entries nicely
> 
> I would recommend avoiding multi-line entries completely.

I'm not sure which side of the debate this supports, but for log files the 
single largest issue tends to be readability.

On most projects I've seen, programmers (including me) toss log statements 
rather willy-nilly into the code, if we use them at all. 

Many programmers (not including me) threw fancy-schmancy emphasis into their 
logs, such as 

  logger.debug("* ====== variable not yet assigned or assigned to null ====== *!");

Note I deliberately chose 'debug' level to emphasize the point, which is that 
in the morass of detail log messages, combined with the boilerplate of 
date, thread ID, log level, etc., this stuff makes it deucedly hard to extract 
information that is 

        actually useful for troubleshooting

.

No one looks at the logs until they need them, and then, OMFG crappy log 
statements make life hard. "===" just distracts, and what variable? Where?

Personally I find terse, info-laden log statements with intelligent use of 
the verbosity hierarchy in a consistent pattern sprinkled with low-level 
stacktraces as required serve best.

Live downstream of your own effluents - use your own log output to trace and 
troubleshoot your code. Make trouble for your code just so you can do that.

Getting screwed by your own log output is very instructive. I've been there.

-- 
Lew

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


Thread

dependency injection and loggers Tomer <tomerbd1@gmail.com> - 2013-01-04 04:00 -0800
  Re: dependency injection and loggers markspace <markspace@nospam.nospam> - 2013-01-04 07:13 -0800
    Re: dependency injection and loggers Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-01-04 09:18 -0800
      Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-04 22:27 -0500
        Re: dependency injection and loggers Wayne <nospam@all.invalid> - 2013-01-04 23:33 -0500
          Re: dependency injection and loggers Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-05 11:55 -0400
            Re: dependency injection and loggers Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-01-05 10:01 -0800
              Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 15:17 -0500
              Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 16:37 -0500
        Re: dependency injection and loggers Lew <lewbloch@gmail.com> - 2013-01-05 12:24 -0800
          Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-05 16:41 -0500
    Re: dependency injection and loggers Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-04 10:31 -0800
      Re: dependency injection and loggers Lew <lewbloch@gmail.com> - 2013-01-04 11:36 -0800
        Re: dependency injection and loggers Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-04 11:57 -0800
      Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-04 22:28 -0500
  Re: dependency injection and loggers Arne Vajhøj <arne@vajhoej.dk> - 2013-01-04 22:24 -0500

csiph-web