|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tenduke.diagnostics.Logger
public final class Logger
Class that works as a hub, taking in log entries and publishing them to subscribers.
Logger is used throughout 10Duke SDK libraries to write log events. By default the logger uses an instance of ConsoleLogWriter
for writing log entries to console. This behaviour can be changed by setting JVM system property
10duke.logger.logentrysubscriber.
Example Logger usage:
Logger.instance().addEntry(new LogEntry(
LogEntry.EventType.Info,
LogEntry.DebugLevel.VeryVerbose,
"This is an example log message"));
JVM system properties used in this class are described in the following table:
| System property | Description | Default value |
|---|---|---|
| 10duke.logger.logentrysubscriber |
Fully qualified class name of class that implements com.tenduke.diagnostics.LogEntrySubscriber and that is used for
writing log entries. Use empty String to disable default logging.
|
com.tenduke.diagnostics.ConsoleLogWriter
|
LogEntry| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_LOG_WRITER_KEY_NAME
Name of JVM system property key that is used to read name of class that is used as default log writer. |
| Method Summary | |
|---|---|
void |
addEntry(LogEntry logEntry)
Giving the logger a new log entry that needs to distributed to subscribers of this logger. |
static Logger |
createChainedLogger()
Creates new instance of logger. |
LogEntrySubscriber |
getDefaultLogWriter()
Get the default log writer. |
void |
initializeDefaultLogWriter(java.lang.String defaultLogWriterClassName)
Initializes default log writer to instance of class that implements LogEntrySubscriber. |
static Logger |
instance()
Returning handle to Logger singleton instance. |
void |
setDefaultLogWriter(LogEntrySubscriber logWriter)
Set the default log writer. |
void |
subscribe(LogEntrySubscriber subscriber)
Subscribe to log entries distributed by this logger. |
void |
unsubscribe(LogEntrySubscriber subscriber)
Unsubscribe from log entries distributed by this logger. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_LOG_WRITER_KEY_NAME
| Method Detail |
|---|
public void addEntry(LogEntry logEntry)
logEntry - The log entry to be distributed to the subscribers.public static Logger createChainedLogger()
public LogEntrySubscriber getDefaultLogWriter()
public void initializeDefaultLogWriter(java.lang.String defaultLogWriterClassName)
LogEntrySubscriber. If default log writer has been
earlier initialized, initialized it again replacing the earlier initialized default log writer.
defaultLogWriterClassName - Fully qualified class name for the default log writer. If null is given, default log writer class
name is read from 10duke.logger.logentrysubscriber JVM system property, or ConsoleLogWriter will be
used if the property is not defined. If empty String is given or defined by the JVM system property, no default log writer
will be used.public static Logger instance()
public void setDefaultLogWriter(LogEntrySubscriber logWriter)
Logger and subscribes the new
logWriter.
logWriter - Default log writer.public void subscribe(LogEntrySubscriber subscriber)
subscriber - The subscriberpublic void unsubscribe(LogEntrySubscriber subscriber)
subscriber - The subscriber.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||