This is the purpose of the Logger.isXXXEnabled() call. Any debugging that is executed on a per message basis should be a trace level message that is enclosed inside of a test for that priority level being active. This allows for enabling tracing with very fine control at runtime and one of the primary reasons for basing logging on log4j. This incurs a minimal overhead. The current Logger class is a subclass of the log4j Category and this will be changed next week, but that will not change the usage pattern which is as follows:
import org.jboss.logging.Logger; public abstract class SomeClass { protected Logger log = Logger.create(Some.class or whatever category name); protected void register(EntityEnterpriseContext ctx, Transaction tx) { boolean trace = log.isTraceEnabled(); if( trace ) log.trace("register, ctx="+ctx+", tx="+tx); } } > The cost of constructing all the message strings, even if they aren't used, > can add considerable overhead to the system (if you don't believe me then > create a test and see). Remember I managed to get somewhere between a 10 to > 20 times speed improvement by improving the serialisation code and removing > these debug statements from inside the inner loop. If you really, really > want them then place them behind a static final boolean flag i.e. > > if(DEBUG) log.debug("a message"); > > so that we can easily set the flag to false and recompile a higher > performance version of the engine. With the static flag set to false the > compiler removes the line completely, so there is no performance hit at all. > > Thanks David. > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development