public class SystemSupportLoggerAdapter extends AbstractSupportLoggerAdapter implements SupportLoggerAdapter
Default Implementation of SupportLoggerAdapter that sends all support log messages to the console (System.out
).
The following System Properties are supported to configure the behavior of this logger:
SystemSupportLoggerAdapter.showDateTime
- Set to true
if you want the current date and
time to be included in output messages. Default is true
SystemSupportLoggerAdapter.dateTimeFormat
- The date and time format to be used in the output messages.
The pattern describing the date and time format is defined by
SimpleDateFormat
.
If the format is not specified or is invalid, the number of milliseconds since start up will be output. SystemSupportLoggerAdapter.showThreadName
- Set to true
if you want to output the current
thread name. Defaults to false
.SystemSupportLoggerAdapter.showLogName
- Set to true
if you want the Logger instance name
to be included in output messages. Defaults to true
.SystemSupportLoggerAdapter.levelInBrackets
- Should the level string be output in brackets? Defaults
to true
.SystemSupportLoggerAdapter.showNonSupportLevels
- Show non-support level logs
(i.e. DEBUG, ERROR, FATAL, INFO, WARN) Defaults to false
.This implementation is heavily inspired by SLF4J's SimpleLogger.
Modifier and Type | Field and Description |
---|---|
static String |
DATE_TIME_FORMAT_KEY |
static String |
LEVEL_IN_BRACKETS_KEY |
static String |
SHOW_DATE_TIME_KEY |
static String |
SHOW_LOG_NAME_KEY |
static String |
SHOW_NON_SUPPORT_LEVELS_KEY |
static String |
SHOW_THREAD_NAME_KEY |
DEBUG, ERROR, FATAL, INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_INFO, LOG_LEVEL_SUPPORT, LOG_LEVEL_TRACE, LOG_LEVEL_WARN, SUPPORT, TRACE, WARN
Constructor and Description |
---|
SystemSupportLoggerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
debug(String message)
In order to be backwards compatible.
|
void |
debug(String message,
Throwable t) |
void |
error(String message) |
void |
error(String message,
Throwable t) |
void |
fatal(String message) |
void |
fatal(String message,
Throwable t) |
protected DateFormat |
getDateFormatter() |
protected String |
getFormattedDate() |
protected boolean |
getLevelInBrackets() |
String |
getName() |
protected boolean |
getShowDateTime() |
protected boolean |
getShowLogName() |
protected boolean |
getShowNonSupportLevels() |
protected boolean |
getShowThreadName() |
void |
info(String message) |
void |
info(String message,
Throwable t) |
void |
lifecycle(LifeCycleEvent lifeCycleEvent,
String message)
Generate a specialized SUPPORT level log message that includes a LifeCycleEvent
in the message.
|
protected void |
log(int level,
String message,
Throwable t) |
void |
setName(String name) |
void |
support(String message)
Generate a SUPPORT level log message
|
void |
support(String message,
Throwable t)
Generate a SUPPORT level log message with an accompanying Throwable
|
void |
warn(String message) |
void |
warn(String message,
Throwable t) |
protected void |
write(StringBuffer buf,
Throwable t) |
public static final String SHOW_DATE_TIME_KEY
public static final String DATE_TIME_FORMAT_KEY
public static final String SHOW_THREAD_NAME_KEY
public static final String SHOW_LOG_NAME_KEY
public static final String LEVEL_IN_BRACKETS_KEY
public static final String SHOW_NON_SUPPORT_LEVELS_KEY
public void support(String message)
support
in interface SupportLoggerAdapter
message
- the log messagepublic void support(String message, Throwable t)
support
in interface SupportLoggerAdapter
message
- the log messaget
- the exception to accompany the log message - will result in a stack track in the logpublic void lifecycle(LifeCycleEvent lifeCycleEvent, String message)
lifecycle
in interface SupportLoggerAdapter
lifeCycleEvent
- The module life cycle type for this log messagemessage
- the log messagepublic void debug(String message)
SupportLoggerAdapter
debug
in interface SupportLoggerAdapter
public void debug(String message, Throwable t)
debug
in interface SupportLoggerAdapter
public void error(String message)
error
in interface SupportLoggerAdapter
public void error(String message, Throwable t)
error
in interface SupportLoggerAdapter
public void fatal(String message)
fatal
in interface SupportLoggerAdapter
public void fatal(String message, Throwable t)
fatal
in interface SupportLoggerAdapter
public void info(String message)
info
in interface SupportLoggerAdapter
public void info(String message, Throwable t)
info
in interface SupportLoggerAdapter
public void warn(String message)
warn
in interface SupportLoggerAdapter
public void warn(String message, Throwable t)
warn
in interface SupportLoggerAdapter
protected void write(StringBuffer buf, Throwable t)
protected String getFormattedDate()
protected boolean getShowDateTime()
protected DateFormat getDateFormatter()
protected boolean getShowThreadName()
protected boolean getShowLogName()
protected boolean getLevelInBrackets()
protected boolean getShowNonSupportLevels()
public String getName()
getName
in interface SupportLoggerAdapter
public void setName(String name)
setName
in interface SupportLoggerAdapter
Copyright © 2022. All rights reserved.