• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Logging: Good idea or not ?

 
Ranch Hand
Posts: 45
Scala Mac OS X IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Scala Mac OS X IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Scala Mac OS X IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic