August 14, 2022

How to load logging.properties for java.util.logging

In Java Logging APIs or java.util.logging, we use system property java.util.logging.config.file to define the location of the logging.properties file. Normally, we put the logging.properties at the src/main/resources, and project compile or build will copy it to the root of the classpath. And we can use LogManager or System.setProperty to load the logging.properties programmatically.

How to load logging.properties for java.util.logging Read More

Java Logging APIs Tutorial

This tutorial shows logging using the Java built-in logging APIs in the java.util.logging package. The java.util.logging is bundled with the Java since JDK 1.4. This Java logging APIs or java.util.logging is part of the Java JDK, suitable for the simple project which required only basic logging features like logs to console or a file. For more advanced logging features like log file rotation, sending email for error logs, send logs to a database, etc. There are many third-party logging frameworks like the logging facade SLF4j, or logging framework like Logback and Apache Log4j 2.

Java Logging APIs Tutorial Read More