public class Log4j1_ANSIColorLayout
extends org.apache.log4j.PatternLayout
log4j.appender.stdout.layout = de.ipcon.tools.Log4j1_ANSIColorLayout
Colors are customizable. Allows usage of either explicit ANSI color texts, e.g. [1;31m for white, bold. Or a small set of constants: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET, none. Bold variants of most constants exist as well by adding "_BOLD", e.g. RED_BOLD
log4j.appender.stdout.layout.fatal=RED_BOLD log4j.appender.stdout.layout.error=RED # explicit ANSI color codes, identical to YELLOW log4j.appender.stdout.layout.warn=[2;33m # no explicit color, use default. log4j.appender.stdout.layout.info=none log4j.appender.stdout.layout.debug=[0;36m log4j.appender.stdout.layout.reset=[1;37m log4j.appender.stdout.layout.stacktrace=[0;31m log4j.appender.stdout.layout.defaultcolor=[0;0m
Modifier and Type | Class and Description |
---|---|
static class |
Log4j1_ANSIColorLayout.ANSI_FG
Foreground colors in ANSI, Background colors pendants start with 40.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_COLOR_ALL |
static java.lang.String |
DEFAULT_COLOR_DEBUG |
static java.lang.String |
DEFAULT_COLOR_ERROR |
static java.lang.String |
DEFAULT_COLOR_FATAL |
static java.lang.String |
DEFAULT_COLOR_INFO |
static java.lang.String |
DEFAULT_COLOR_STACKTRACE |
static java.lang.String |
DEFAULT_COLOR_WARN |
static java.lang.String |
END_COLOR |
Constructor and Description |
---|
Log4j1_ANSIColorLayout() |
Log4j1_ANSIColorLayout(java.lang.String string) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(org.apache.log4j.spi.LoggingEvent event) |
java.lang.String |
getAll() |
java.lang.String |
getDebug() |
java.lang.String |
getError() |
java.lang.String |
getFatal() |
java.lang.String |
getInfo() |
java.lang.String |
getStacktrace() |
java.lang.String |
getWarn() |
boolean |
ignoresThrowable() |
void |
setAll(java.lang.String inp) |
void |
setDebug(java.lang.String inp) |
void |
setDefaultColors()
set the color patterns to the defaults
|
void |
setError(java.lang.String inp) |
void |
setFatal(java.lang.String inp) |
void |
setInfo(java.lang.String inp) |
void |
setStacktrace(java.lang.String inp)
If set, then stacktraces use this explicit color.
|
void |
setWarn(java.lang.String inp) |
public static final java.lang.String DEFAULT_COLOR_ALL
public static final java.lang.String DEFAULT_COLOR_FATAL
public static final java.lang.String DEFAULT_COLOR_ERROR
public static final java.lang.String DEFAULT_COLOR_WARN
public static final java.lang.String DEFAULT_COLOR_INFO
public static final java.lang.String DEFAULT_COLOR_DEBUG
public static final java.lang.String DEFAULT_COLOR_STACKTRACE
public static final java.lang.String END_COLOR
public Log4j1_ANSIColorLayout()
public Log4j1_ANSIColorLayout(java.lang.String string)
public void setDefaultColors()
public java.lang.String getAll()
public void setAll(java.lang.String inp)
public java.lang.String getFatal()
public void setFatal(java.lang.String inp)
public java.lang.String getError()
public void setError(java.lang.String inp)
public java.lang.String getWarn()
public void setWarn(java.lang.String inp)
public java.lang.String getInfo()
public void setInfo(java.lang.String inp)
public java.lang.String getDebug()
public void setDebug(java.lang.String inp)
public java.lang.String getStacktrace()
public void setStacktrace(java.lang.String inp)
public boolean ignoresThrowable()
ignoresThrowable
in class org.apache.log4j.PatternLayout
public java.lang.String format(org.apache.log4j.spi.LoggingEvent event)
format
in class org.apache.log4j.PatternLayout
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.