Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging: Good idea or not ?

 
John Donoghue
Ranch Hand
Posts: 45
IntelliJ IDE Mac OS X Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering what people thought about logging. The Monkhouse & Camerlengo book includes it. On the other hand, it clutters the code and decreases readability. It isn't a requirement, and is a place to lose points it you make a silly mistake (like inconsistent names or misconfigure a class and sending a bunch of logging output to the standard output/error). So do people think it is a good idea on balance?

Thanks,

John
[ December 27, 2007: Message edited by: John Donoghue ]
 
Jonathan Wolter
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using logging, and I will include it in my final submission. I even wrote my own logging formatter (OneLineLogFormatter) to make the log file more readable.

Benefits I see outweigh the costs.

Logging clarifies the Concurrency code, and makes for better understood code, imho.

jaw
 
John Donoghue
Ranch Hand
Posts: 45
IntelliJ IDE Mac OS X Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I will use logging.
Also, sorry of for all the typos in the original message. My thumbs are way bigger than the keys on that stupid Blackberry.


-John
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11865
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Donoghue:
On the other hand, it clutters the code and decreases readability.
Hmmm - maybe. The same argument could be used against including comments. I personally find that a well placed log message will work instead of a comment when I am reading the code, and simultaneously give me good debugging information when I am trying to look at a run that has a problem.
Originally posted by John Donoghue:
It isn't a requirement,
Very true, and we do argue several times throughout the book that going beyond the requirements can be against your best interests (and there is even a comment to that effect in your instructions). I personally feel that this is one area where a little step outside the minimum requirements is actually a good thing, and shows a little more professionalism.
Originally posted by John Donoghue:
...and is a place to lose points it you make a silly mistake

True.
Originally posted by John Donoghue:
...(like inconsistent names ...

Perhaps - I think this sort of problem could happen even just as easily with comments in the code, so I don't see it as a particular problem.
Originally posted by John Donoghue:
or misconfigure a class and sending a bunch of logging output to the standard output/error).

I think this is possibly a reason for the logging - these sorts of errors will then be apparent when you run the application, rather than when the assessor steps through your code.

Regards, Andrew
 
John Donoghue
Ranch Hand
Posts: 45
IntelliJ IDE Mac OS X Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew,

Thanks for taking the time to respond. I have been waffling about this for a while, but in the past week I've hit a couple of places where the having the logging code would help, so I believe that you are correct.

-John

BTW: I love the book. Thanks to you and Terry for writing it.
[ January 01, 2008: Message edited by: John Donoghue ]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic