Annotation Type Log4j2


@Retention(SOURCE)
@Target(TYPE)
public @interface Log4j2
Causes lombok to generate a logger field.

Complete documentation is found at the project lombok features page for lombok log annotations.

Example:

 @Log4j2
 public class LogExample {
 }
 
will generate:
 public class LogExample {
     private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LogExample.class);
 }
 
This annotation is valid for classes and enumerations.
See Also:
org.apache.logging.log4j.Logger, org.apache.logging.log4j.LogManager#getLogger(java.lang.Class), Log4j, CommonsLog, Log, Slf4j, XSlf4j, JBossLog, Flogger, CustomLog
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    java.lang.String topic  
  • Element Details

    • topic

      java.lang.String topic
      Returns:
      The category of the constructed Logger. By default, it will use the type where the annotation is placed.
      Default:
      ""