Package ch.qos.logback.core
Class ConsoleAppender<E>
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.UnsynchronizedAppenderBase<E>
-
- ch.qos.logback.core.OutputStreamAppender<E>
-
- ch.qos.logback.core.ConsoleAppender<E>
-
- All Implemented Interfaces:
Appender<E>
,ContextAware
,FilterAttachable<E>
,LifeCycle
public class ConsoleAppender<E> extends OutputStreamAppender<E>
ConsoleAppender appends log events toSystem.out
orSystem.err
using a layout specified by the user. The default target isSystem.out
. For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#ConsoleAppender
-
-
Field Summary
Fields Modifier and Type Field Description protected ConsoleTarget
target
private static java.lang.String
WindowsAnsiOutputStream_CLASS_NAME
protected boolean
withJansi
-
Fields inherited from class ch.qos.logback.core.OutputStreamAppender
encoder, immediateFlush, lock
-
Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
ALLOWED_REPEATS, name, started
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description ConsoleAppender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTarget()
Returns the current value of the target property.private java.io.OutputStream
getTargetStreamForWindows(java.io.OutputStream targetStream)
boolean
isWithJansi()
void
setTarget(java.lang.String value)
Sets the value of the Target option.void
setWithJansi(boolean withJansi)
If true, this appender will output to a stream whichvoid
start()
Checks that requires parameters are set and if everything is in order, activates this appender.private void
targetWarn(java.lang.String val)
-
Methods inherited from class ch.qos.logback.core.OutputStreamAppender
append, closeOutputStream, encoderClose, encoderInit, getEncoder, getOutputStream, isImmediateFlush, setEncoder, setImmediateFlush, setLayout, setOutputStream, stop, subAppend, writeOut
-
Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
-
-
-
Field Detail
-
target
protected ConsoleTarget target
-
withJansi
protected boolean withJansi
-
WindowsAnsiOutputStream_CLASS_NAME
private static final java.lang.String WindowsAnsiOutputStream_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setTarget
public void setTarget(java.lang.String value)
Sets the value of the Target option. Recognized values are "System.out" and "System.err". Any other value will be ignored.
-
getTarget
public java.lang.String getTarget()
Returns the current value of the target property. The default value of the option is "System.out". See alsosetTarget(java.lang.String)
.
-
targetWarn
private void targetWarn(java.lang.String val)
-
start
public void start()
Description copied from class:OutputStreamAppender
Checks that requires parameters are set and if everything is in order, activates this appender.- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classOutputStreamAppender<E>
-
getTargetStreamForWindows
private java.io.OutputStream getTargetStreamForWindows(java.io.OutputStream targetStream)
-
isWithJansi
public boolean isWithJansi()
- Returns:
-
setWithJansi
public void setWithJansi(boolean withJansi)
If true, this appender will output to a stream which- Parameters:
withJansi
-- Since:
- 1.0.5
-
-