I have some Java code that I'd like to instrument with log messages for debugging purposes. The final (compiled) production code, however, should not contain any logging as it would slow down the execution time. Is there any way in Java to disable a logger at compile time?
I am not afraid of the footprint a check inside the log method of a run-time enabled/disabled logger would add.
if (logging==enabled) {// do logging}
But I'd like to avoid parameter construction like the following in my production code:
Logger.log("undefined state" + state + " @ " + new Date());
I am using Sun's Java Compiler.