Class Generate
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=550
To 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 ClassesModifier and TypeClassDescriptionstatic final class
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 final class
Generates 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 theLogger
interface.(package private) static class
(package private) static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static String
private static void
generate
(String[] args, Generate.Type type) (package private) static void
generate
(String[] args, Generate.Type type, PrintStream printStream) static void
generateCustom
(String[] args, 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 void
generateExtend
(String[] args, PrintStream printStream) Generates source code for extended logger wrappers that provide convenience methods for the specified custom levels.(package private) static String
generateSource
(String classNameFQN, List<Generate.LevelInfo> levels, Generate.Type type) (package private) static String
javadocDescription
(List<Generate.LevelInfo> levels) private static void
usage
(PrintStream out, Class<?> generator) (package private) static boolean
-
Field Details
-
PACKAGE_DECLARATION
- See Also:
-
FQCN_FIELD
- See Also:
-
LEVEL_FIELD
- See Also:
-
FACTORY_METHODS
- See Also:
-
METHODS
- See Also:
-
-
Constructor Details
-
Generate
private Generate()
-
-
Method Details
-
generate
-
generateExtend
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
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
-
validate
-
usage
-
generateSource
static String generateSource(String classNameFQN, List<Generate.LevelInfo> levels, Generate.Type type) -
javadocDescription
-
camelCase
-