Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

where to write log info in the program.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when writing code, I don't know whether or not to write logo info in some place.

For exmaple, should I write "enter f()" in function "f()"?
I don't know which detail degree should be the log info.

Can somebody tell me the the strategy of writting log info.
Some articles about writting log info will be better.

Thanks very much.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no rules for this-it just depends on what you want to log. Method entry is usually a debug/or trace level, though, sine you don't normally care-you just want to know that it did something right (or wrong). And the logging framework itself may log the method name-depends on what you're using and how it's configured. I don't put that kind of info into log statements, just useful info.

(I sometimes handle entry/exit via AOP, since I don't normally need that kind of detail, but it all depends.)
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David, Thanks.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In generally its upto the user to decide what he wants to put in logs. Depending on critically of the errors log can be made at different level.
In my view, i place the exception in log level "ERROR" and user input(intermidiate calculation data) in log level 'DEBUG', so that its easy to debug when there are errors.

In general for a application log level "ERROR" is enabled, So we should try to write less details in it as it may impact the performance.
 
It's just a flesh wound! Or a tiny ad:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic