From d5c366e93ea19f286da2bdee16c0fdca8850b22a Mon Sep 17 00:00:00 2001
From: Roel Spilker @Slf4jprivate static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExample.class);@XSlf4jprivate static final org.slf4j.ext.XLogger log = org.slf4j.XLoggerFactory.getXLogger(LogExample.class);private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LogExample.class);
@XSlf4jprivate static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LogExample.class);+ By default, the category (or name) of the logger will be the type where the annotation was placed. This can be customised by specifying a value for the category.
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LogExample.class);
- By default, the category (or name) of the logger will be the type where the annotation was placed. This can be customised by specifying a value for the category.
+ By default, the topic (or name) of the logger will be the class name of the class annotated with the @Log annotation. This can be customised by specifying the topic parameter. For example: @XSlf4j(topic="reporting").
If a field called log already exists, a warning will be emitted and no code will be generated.
- A future feature of lombok's diverse log annotations is to find calls to the logger field and, if the chosen logging framework supports
- it and the log level can be compile-time determined from the log call, guard it with an if statement. This way if
- the log statement ends up being ignored, the potentially expensive calculation of the log string is avoided entirely. This does mean
- that you should NOT put any side-effects in the expression that you log.
+ A future feature of lombok's diverse log annotations is to find calls to the logger field and, if the chosen logging framework supports it and the log level can be compile-time determined from the log call, guard it with an if statement. This way if the log statement ends up being ignored, the potentially expensive calculation of the log string is avoided entirely. This does mean that you should NOT put any side-effects in the expression that you log.