How do i enable and use logging and tracing in my java program?
-
What do you mean by logging and tracing? You mean jvm logging?Kurt Du Bois– Kurt Du Bois2010-08-27 09:22:41 +00:00Commented Aug 27, 2010 at 9:22
-
I want to redirect my console output to other handlers and also would like to store such a log in any fileMagggi– Magggi2010-08-27 09:28:07 +00:00Commented Aug 27, 2010 at 9:28
7 Answers
If you want to start using logging in java, I advise you to start with the log4j FAQ and its manual which is a good introduction.
Comments
Without downloading third party libraries you could use Java Logging API - Tutorial
1 Comment
There are a number of well-known logging APIs for Java. The most well-known is Log4J. Since Java 1.4, there's also a logging API in the standard library, in the package java.util.logging.
There is also SLF4J, which is not a logging library itself, but an interface layer which you can put between your program and a logging library such as Log4J or java.util.logging. So, you use the SLF4J API, and SLF4J passes the log messages on to whatever logging library you configure. The advantage of this is that users of your program can plug in a different logging library if they want.
1 Comment
If you want to trace the execution of your Java code without having to add logging statements you can use a tool called InTrace.
NOTE: InTrace is a free and open source tool which I have written.
Comments
Jackplay is designed to assist you ing tracing/logging on your application methods without any code change or redeployment.
It also allows you to redefine a method body LIVE in JVM.
It presents easy to use Web based UI as control panel.