Reputation: 11
I'm developing a Java desktop app and was wondering what are the best practices for logging bugs and exceptions. I'd like to log the exceptions in a file that's sent to me when there's a problem. Are there any good frameworks for doing this or is it a retarded idea? Thanks a lot
Elsanto 696
Upvotes: 1
Views: 2462
Reputation: 1392
log4j is the de facto standard (with the standard Java logging framework a close second).
You should use Version 1.2.x for production use.
You can configure log4j via code (at runtime) or via a configuration file (either Java properties or XML format).
From the website:
The target of the log output can be a file, an OutputStream, a java.io.Writer, a remote log4j server, a remote Unix Syslog daemon, or many other output targets.
There is a SMTPAppender that can be configured for sending mails with log entries on specific conditions, in case eMail is what you meant by "sent to me".
Upvotes: 4
Reputation: 7851
Java4 Logging works pretty well, though it lacks some of the features in Log4j. The real problem is sending data from a user's PC to you directly - you would probably have to get their permission for this. The usual approach is to log to a file, and have the user give you that file in the event that there is a problem.
Upvotes: 1
Reputation: 89169
There are various Java Logging Frameworks out there. Pick one!
Upvotes: 3
Reputation: 240900
log4J is better framework to log
Here is good tutorial and article on log4j
Upvotes: 3