where | the programme |
when | during execution |
what | anything that can be evaluated |
where | log file / console / DB / ... |
when | post factum |
what | only logged messages |
https://en.wikipedia.org/wiki/Tachograph#/media/File:Tachoscheibe.jpg
https://en.wikipedia.org/wiki/Electrocardiography#/media/File:12leadECG.jpg
/path/to/bin/gradle wrapper --gradle-version 4.3.1
./gradlew init --type java-application
https://en.wikipedia.org/wiki/Scribe#/media/File:Escribano.jpg
dependencies {
compile "org.slf4j:slf4j-api:1.7.25"
runtimeOnly "ch.qos.logback:logback-classic:1.2.3"
}
logger.debug("Fancy log statement with param1 {} and param2 {}",
param1, getParam2());
catch(Exception e) {
logger.debug("Aw, snap, an exception...", e);
}
// assume SLF4J is bound to logback in the current environment
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
// print logback's internal status
StatusPrinter.print(lc);
Logback configuration manual
<contextName>logging-example-simple</contextName>
<jmxConfigurator />
[user: %mdc{username}] - %msg %n