|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.java.io.LogWriter
A LogWriter
allows an application to incapsulate an output
stream and dumps its logs on it.
To control the different kinds of log messages they are separated into channels that can be activated setting to true the right property.
The configurations that control this writer are:
Inner Class Summary | |
protected class |
LogWriter.Agent
Class implementing the background logging. |
Field Summary | |
boolean |
active
Tells if this log is active |
static java.lang.String |
CH_EXCEPTION_TRACING
String identifier for the exception tracing channel. |
static java.lang.String |
CH_QUEUE_STATUS
|
Configurations |
configurations
Configuration parameters. |
static java.lang.String |
DEFAULT_DATEFORMAT
This string control the standard date format used used for log timestamping. |
static java.lang.String |
DEFAULT_IDENTIFIER
This string identifies this log writer and its used to differentiate between configurations. |
static java.lang.String |
KEYWORD_CHANNEL
|
static java.lang.String |
KEYWORD_DATEFORMAT
|
static java.lang.String |
KEYWORD_FILE
|
static java.lang.String |
KEYWORD_QUEUE_MAXAGE
|
static java.lang.String |
KEYWORD_QUEUE_MAXSIZE
|
static java.lang.String |
KEYWORD_TIMESTAMP
|
protected SimpleQueue |
logQueue
Log message queue. |
Constructor Summary | |
LogWriter(Configurations configurations)
Constructs this class and gets output file from configurations. |
|
LogWriter(java.io.OutputStream output,
Configurations configurations)
Constructs this class with the output stream to encapsulate using default identifier. |
|
LogWriter(java.io.OutputStream output,
java.lang.String identifier,
Configurations configurations)
Constructs this class with the output stream to encapsulate. |
|
LogWriter(java.lang.String identifier,
Configurations configurations)
Constructs this class using identifier to discriminate between configuration parameters and gets output file from configurations. |
|
LogWriter(java.io.Writer output,
Configurations configurations)
Constructs this class with the output writer to encapsulate using default identifier. |
|
LogWriter(java.io.Writer output,
java.lang.String identifier,
Configurations configurations)
Constructs this class with the output writer to encapsulate. |
Method Summary | |
void |
flush()
Flush the log. |
boolean |
isActive()
Tells if it is active. |
boolean |
isActive(java.lang.String channel)
Tells if the given channel is active. |
void |
log(java.lang.String channel,
java.lang.String message)
Prints the log message on the right channel. |
void |
log(java.lang.String channel,
java.lang.Throwable t)
Prints the error message and stack trace if channel enabled. |
void |
log(java.lang.Throwable t)
Deprecated. |
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_IDENTIFIER
public static final java.lang.String DEFAULT_DATEFORMAT
public static final java.lang.String KEYWORD_DATEFORMAT
public static final java.lang.String KEYWORD_TIMESTAMP
public static final java.lang.String KEYWORD_CHANNEL
public static final java.lang.String KEYWORD_FILE
public static final java.lang.String KEYWORD_QUEUE_MAXAGE
public static final java.lang.String KEYWORD_QUEUE_MAXSIZE
public static final java.lang.String CH_QUEUE_STATUS
public static final java.lang.String CH_EXCEPTION_TRACING
public Configurations configurations
public boolean active
protected SimpleQueue logQueue
Constructor Detail |
public LogWriter(Configurations configurations) throws java.io.IOException
configurations
- the configurations needed at initialization.public LogWriter(java.lang.String identifier, Configurations configurations) throws java.io.IOException
identifier
- the identifier for this log writer.configurations
- the configurations needed at initialization.public LogWriter(java.io.Writer output, Configurations configurations) throws java.io.IOException
output
- the output writer to encapsulate.configurations
- the configurations needed at initialization.public LogWriter(java.io.OutputStream output, Configurations configurations) throws java.io.IOException
output
- the output stream to encapsulate.configurations
- the configurations needed at initialization.public LogWriter(java.io.OutputStream output, java.lang.String identifier, Configurations configurations) throws java.io.IOException
output
- the output stream to encapsulate.identifier
- the identifier for this log writer.configurations
- the configurations needed at initialization.public LogWriter(java.io.Writer output, java.lang.String identifier, Configurations configurations) throws java.io.IOException
output
- the output writer to encapsulate.identifier
- the identifier for this log writer.configurations
- the configurations needed at initialization.Method Detail |
public boolean isActive()
public boolean isActive(java.lang.String channel)
channel
- the channel to test.public void log(java.lang.String channel, java.lang.String message)
A "channel" is a virtual log that may be enabled or disabled by setting the property "identifier".channel.???=true where ??? is the channel identifier that must be passed with the message. If a channel is not recognized or its property is set to false the message is not written.
channel
- the channel to put the message on.name
- the message to log.public void log(java.lang.String channel, java.lang.Throwable t)
t
- the error thrown.public void log(java.lang.Throwable t)
public void flush()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |