Created
September 28, 2023 15:14
-
-
Save maroph/723f395a68d532019217be7cd2a0150c to your computer and use it in GitHub Desktop.
SLF4J Simple Logging Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mypackage; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class SimpleLogging { | |
static final Logger cLog; | |
static { | |
System.setProperty("org.slf4j.simpleLogger.showLogName", "true"); | |
System.setProperty("org.slf4j.simpleLogger.showThreadName", "true"); | |
System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); | |
// https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html | |
System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "dd-MM-YYYY,kk:mm:ss.SSSZ"); | |
// level: "off", "error", "warn", "info", "debug", "trace" | |
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info"); | |
System.setProperty("org.slf4j.simpleLogger.log.mypackage", "debug"); | |
cLog = LoggerFactory.getLogger(SimpleLogging.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment