|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.log5j.Writer
public abstract class Writer
Extend this abstract class to create a new writer for log messages.
Any number of writers can be specified in Log5j configuration for any given
Logger
.
To set the Writer
for a particular Logger
set a
property with a name of
<logger-name>.writer.<writer-name>
and a value
which is the fully qualified class name of the Writer
.
All concrete classes that extend Writer
must have a
constructor that takes a Format
object and a Properties
object as arguments. For example;
public class MyWriter extends Writer { public MyWriter(Format format, Properties properties) { } ... }It must also, of course, implement the
write(String)
method which
writes the message to it's destination. This method must be thread-safe.
Many Writer
classes have their own configuration properties.
These are documented fully in the javadocs for those classes.
Constructor Summary | |
---|---|
protected |
Writer(Format format)
Any class that extends AbstractWriter must call this
constructor and provide suitable values for format . |
Method Summary | |
---|---|
Format |
getFormat(Format defaultFormat)
Return the log format object for this writer or defaultFormat if this writer has no specific format. |
abstract void |
write(java.lang.String message)
Write a single message to the log. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Writer(Format format)
AbstractWriter
must call this
constructor and provide suitable values for format
.
format
can be null
, in which case the
argument defaultFormat
will always be returned by
getFormat(Format)
.
format
- the Format
object for this
Writer
Method Detail |
---|
public final Format getFormat(Format defaultFormat)
defaultFormat
if this writer has no specific format.
defaultFormat
- a Format
object
Format
objectpublic abstract void write(java.lang.String message)
message
- the message to write
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |