import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MyClass { private static final Log LOGGER = LogFactory.getLog(MyClass.class); public void someMethod() { try { // do something that may throw an exception } catch (Exception e) { LOGGER.error("An error occurred in someMethod", e); } } }
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MyClass { private static final Log LOGGER = LogFactory.getLog(MyClass.class); public void someMethod(String arg) { if (arg == null) { LOGGER.error("Argument 'arg' cannot be null"); return; } // do something with 'arg' } }
commons-logging commons-logging 1.2