There are 3 popular log/trace facilities commonly used in
Java: log4j, apache commons logging, and the JDK logger. Log4j and apache logging can intercept JDK logging (and, it think each other) so a mixed logging system is not only possible, but often done. For example, I think
Tomcat's presently using log4j, but deployed webapps don't have to.
You do not normally enable tracing - or any of the other logging levels for that matter internal to the application. At best, it's extra logic. At worst, something blows up in the middle of the night and you have to recompile the app to see what's wrong. So instead you use the logging config files.
The major Java loggers all allow you to fine-tune logging at the package level. This means not only that you can keep yourself from being buried alive in stuff from uninteresting parts of your own app, but that if you need to trace org.apache.commons.digester stuff, you won't automatically have to endure noise from org.apache.commons.collections.
So the simplest way to trace is :
The logging methods were designed for minimal overhead. You only need to check loglevels if you intend to format your log message using expensive operations that won't be used if the log isn't written. Use it only to bypass the expensive logic and never put application logic in a loglevel
test! Otherwise everytime you change the logging environment, the program will go bonkers.