import org.apache.log4j.Logger; public class Example { private static final Logger logger = Logger.getLogger(Example.class); public void doSomething() { if (logger.isTraceEnabled()) { logger.trace("Entering doSomething method"); } // rest of the method code } }
import org.apache.log4j.Logger; public class Example { private static final Logger logger = Logger.getLogger(Example.class); public void doSomething(int value) { if (logger.isTraceEnabled()) { logger.trace("Entering doSomething method with value=" + value); } // rest of the method code } }The org.apache.log4j library is part of the Apache Logging Services project.