public class LineFormattedTarget extends AbstractTarget
| Modifier and Type | Field and Description |
|---|---|
protected DateFormat |
dateFormater
The formatter to write the date as part of the logging statement.
|
protected boolean |
includeCategory
Indicates if the category for this target should added to the trace.
|
protected boolean |
includeDate
Indicates if the date should be added to the trace.
|
protected boolean |
includeLevel
Indicates if the level for the event should added to the trace.
|
protected boolean |
includeTime
Indicates if the time should be added to the trace.
|
protected String |
prefix
A prefix to prepend onto each logged message.
|
protected DateFormat |
timeFormatter
The formatter to write the time as part of the logging statement.
|
filters, id, level, loggerCount| Constructor and Description |
|---|
LineFormattedTarget()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getPrefix()
Returns prefix property.
|
void |
initialize(String id,
ConfigMap properties)
Initializes the target with id and properties.
|
protected void |
internalLog(String message)
Descendants of this class should override this method to direct the
specified message to the desired output.
|
boolean |
isIncludeCategory()
Returns includeCategory property.
|
boolean |
isIncludeDate()
Returns includeDate property.
|
boolean |
isIncludeLevel()
Returns includeLevel property.
|
boolean |
isIncludeTime()
Returns includeTime property.
|
void |
logEvent(LogEvent event)
This method handles a
LogEvent from an associated logger. |
void |
setIncludeCategory(boolean includeCategory)
Sets includeCategory property.
|
void |
setIncludeDate(boolean includeDate)
Sets includeDate property.
|
void |
setIncludeLevel(boolean includeLevel)
Sets includeLevel property.
|
void |
setIncludeTime(boolean includeTime)
Sets includeTime property.
|
void |
setPrefix(String prefix)
Sets prefix property.
|
addFilter, addLogger, containsFilter, getFilters, getId, getLevel, removeFilter, removeLogger, setFilters, setLevelprotected boolean includeDate
protected boolean includeTime
protected boolean includeLevel
protected boolean includeCategory
protected String prefix
protected DateFormat dateFormater
protected DateFormat timeFormatter
public void initialize(String id, ConfigMap properties)
initialize in interface Targetinitialize in class AbstractTargetid - id for the target which is ignored.properties - ConfigMap of properties for the target.public boolean isIncludeCategory()
true if category is included; false otherwise.public void setIncludeCategory(boolean includeCategory)
includeCategory - the include categorypublic boolean isIncludeDate()
true if date is included; false otherwise.public void setIncludeDate(boolean includeDate)
includeDate - the include datepublic boolean isIncludeLevel()
true if level is included; false otherwise.public void setIncludeLevel(boolean includeLevel)
includeLevel - the include levelpublic boolean isIncludeTime()
true if time is included; false otherwise.public void setIncludeTime(boolean includeTime)
includeTime - the include timepublic String getPrefix()
public void setPrefix(String prefix)
prefix - the prefix stringpublic void logEvent(LogEvent event)
LogEvent from an associated logger.
A target uses this method to translate the event into the appropriate
format for transmission, storage, or display.
This method will be called only if the event's level is in range of the
target's level.event - the log eventprotected void internalLog(String message)
message - String containing preprocessed log message which may
include time, date, category, etc. based on property settings,
such as includeDate, includeCategory,
etc.Copyright © 2015 The Apache Software Foundation. All rights reserved.