When and where to use a logger

Joined
Mar 23, 2009
Messages
8
Reaction score
0
This is not a java specific issue per say, though I am currently working in Java and using the Java logging API.

When is it appropriate to use a logger? The mighty Google (all hail) is curiously silent on the issue, so I'm guessing that I'm either retarded and everybody understands this, or just searching the wrong keywords; but humor me anyways:
*What kinds of applications should have loggers implemented, and in what capacity?
*What kind of events should the logger log, should it be critical messages only, or any change in the program status?
*What is the primary usage of a log, from a development standpoint?
*Is there "good coding", java-wise, when it comes to utilizing a logger (not specifically the Java logging API though, the good coding practices with that are pretty well documented).

Thanks for the input
-T

"Randomness is merely the limitations of man's knowledge"
 
Joined
Feb 11, 2009
Messages
12
Reaction score
0
Let me try to answer some of the questions
*What kinds of applications should have loggers implemented, and in what capacity?

Any application we you want to maintain. For example , if the user of the application reported an error - are you going to help him/her? If yes logging is required.

*What kind of events should the logger log, should it be critical messages only, or any change in the program status?

You can think about two kind of logging
1. developer logs - this will be used by the developers when some thing needs to be analyzed in the application. For example - how a particular problem happened?
For this best practice will be to have
info logs - e.g.- entering a method , leaving a method , details of parameters etc.
Warning logs - e.g.- some expected data was missing , continuing with default value
Severe/Critical logs -e.g.- some operation failed.

2. End user logs - this might be the logs which the users of the application will go through. Here it is enough to have details of failed operations, why it failed? possible corrective actions etc.


*What is the primary usage of a log, from a development standpoint?
Answered in the first question

*Is there "good coding", java-wise, when it comes to utilizing a logger (not specifically the Java logging API though, the good coding practices with that are pretty well documented).

One practice is ensuring that enough information is provided in the log messages and log levels are used properly.
 
Joined
Mar 23, 2009
Messages
8
Reaction score
0
Thank you, that helps, I think a logger is something I will wait to include in the project I'm developing.

Appreciate it
-T

"Randomness is merely the limitations of man's knowledge"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top