<dependency>
<groupId>com.logging.utils</groupId>
<artifactId>logging-utils</artifactId>
<version>1.0.0</version>
</dependency>
import com.logging.utils.LoggingUtils;
public class MyApp {
private static final Logger logger = LoggingUtils.getLogger(MyApp.class);
public static void main(String[] args) {
LoggingUtils.initialize();
// ...
}
}
import com.logging.utils.LoggingUtils;
public class MyService {
private static final Logger logger = LoggingUtils.getLogger(MyService.class);
public void doSomething() {
// ...
}
}
properties
log4j.rootLogger = INFO, CONSOLE
log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} [%-5p] %C.%M() - %m%n