Class Generate
- java.lang.Object
-
- org.apache.logging.log4j.core.tools.Generate
-
public final class Generate extends java.lang.ObjectGenerates source code for custom or extended logger wrappers.Usage:
To generate source code for an extended logger that adds custom log levels to the existing ones:
java org.apache.logging.log4j.core.tools.Generate$ExtendedLogger <logger.class.name> <CUSTOMLEVEL>=<WEIGHT> [CUSTOMLEVEL2=WEIGHT2 [CUSTOMLEVEL3=WEIGHT3] ...]Example of creating an extended logger:
java org.apache.logging.log4j.core.tools.Generate$ExtendedLogger com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550To generate source code for a custom logger that replaces the existing log levels with custom ones:
java org.apache.logging.log4j.core.tools.Generate$CustomLogger <logger.class.name> <CUSTOMLEVEL>=<WEIGHT> [CUSTOMLEVEL2=WEIGHT2 [CUSTOMLEVEL3=WEIGHT3] ...]Example of creating a custom logger:
java org.apache.logging.log4j.core.tools.Generate$CustomLogger com.mycomp.MyLogger DEFCON1=350 DEFCON2=450 DEFCON3=550
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGenerate.CustomLoggerGenerates source code for custom logger wrappers that only provide convenience methods for the specified custom levels, not for the standard built-in levels.static classGenerate.ExtendedLoggerGenerates source code for extended logger wrappers that provide convenience methods for the specified custom levels, and by extendingorg.apache.logging.log4j.spi.ExtendedLoggerWrapper, inherit the convenience methods for the built-in levels provided by theLoggerinterface.(package private) static classGenerate.LevelInfo(package private) static classGenerate.Type
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringFACTORY_METHODS(package private) static java.lang.StringFQCN_FIELD(package private) static java.lang.StringLEVEL_FIELD(package private) static java.lang.StringMETHODS(package private) static java.lang.StringPACKAGE_DECLARATION
-
Constructor Summary
Constructors Modifier Constructor Description privateGenerate()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.StringcamelCase(java.lang.String customLevel)private static voidgenerate(java.lang.String[] args, Generate.Type type)(package private) static voidgenerate(java.lang.String[] args, Generate.Type type, java.io.PrintStream printStream)static voidgenerateCustom(java.lang.String[] args, java.io.PrintStream printStream)Generates source code for custom logger wrappers that only provide convenience methods for the specified custom levels, not for the standard built-in levels.static voidgenerateExtend(java.lang.String[] args, java.io.PrintStream printStream)Generates source code for extended logger wrappers that provide convenience methods for the specified custom levels.(package private) static java.lang.StringgenerateSource(java.lang.String classNameFQN, java.util.List<Generate.LevelInfo> levels, Generate.Type type)(package private) static java.lang.StringjavadocDescription(java.util.List<Generate.LevelInfo> levels)private static voidusage(java.io.PrintStream out, java.lang.Class<?> generator)(package private) static booleanvalidate(java.lang.String[] args)
-
-
-
Field Detail
-
PACKAGE_DECLARATION
static final java.lang.String PACKAGE_DECLARATION
- See Also:
- Constant Field Values
-
FQCN_FIELD
static final java.lang.String FQCN_FIELD
- See Also:
- Constant Field Values
-
LEVEL_FIELD
static final java.lang.String LEVEL_FIELD
- See Also:
- Constant Field Values
-
FACTORY_METHODS
static final java.lang.String FACTORY_METHODS
- See Also:
- Constant Field Values
-
METHODS
static final java.lang.String METHODS
- See Also:
- Constant Field Values
-
-
Method Detail
-
generate
private static void generate(java.lang.String[] args, Generate.Type type)
-
generateExtend
public static void generateExtend(java.lang.String[] args, java.io.PrintStream printStream)Generates source code for extended logger wrappers that provide convenience methods for the specified custom levels.- Parameters:
args- className of the custom logger to generate, followed by a NAME=intLevel pair for each custom log level to generate convenience methods forprintStream- the stream to write the generated source code to
-
generateCustom
public static void generateCustom(java.lang.String[] args, java.io.PrintStream printStream)Generates source code for custom logger wrappers that only provide convenience methods for the specified custom levels, not for the standard built-in levels.- Parameters:
args- className of the custom logger to generate, followed by a NAME=intLevel pair for each custom log level to generate convenience methods forprintStream- the stream to write the generated source code to
-
generate
static void generate(java.lang.String[] args, Generate.Type type, java.io.PrintStream printStream)
-
validate
static boolean validate(java.lang.String[] args)
-
usage
private static void usage(java.io.PrintStream out, java.lang.Class<?> generator)
-
generateSource
static java.lang.String generateSource(java.lang.String classNameFQN, java.util.List<Generate.LevelInfo> levels, Generate.Type type)
-
javadocDescription
static java.lang.String javadocDescription(java.util.List<Generate.LevelInfo> levels)
-
camelCase
static java.lang.String camelCase(java.lang.String customLevel)
-
-