Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

where to write log info in the program.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David, Thanks.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic