import com.logging.utils.Logger;
import com.logging.utils.LoggerFactory;
public class MyApp {
private static final Logger LOGGER = LoggerFactory.getLogger(MyApp.class);
public static void main(String[] args) {
LOGGER.debug("Debug log message");
LOGGER.info("Info log message");
LOGGER.warn("Warning log message");
LOGGER.error("Error log message");
try {
// Some code that may throw an exception
} catch (Exception e) {
LOGGER.error("An error occurred", e);
}
}
}
properties
logging.target=console,file
logging.level=debug
logging.file.path=/path/to/logs/myapp.log
logging.file.size=10MB
logging.file.maxBackupFiles=5
logging.exception.trace=true
logging.exception.traceDepth=10