|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Format
Implement this interface to create a new format for a log message.
Any concrete class that implements Format must have a
constructor that takes a single Properties object as an
argument. For example;
public class MyFormat implements Format {
public MyFormat(Properties properties) {
}
...
}
It must also, of course, implement the
format(String, String, Object[]) method returning a string
representation of the message exactly as it will be logged. This method must
be thread-safe.
A format can be specified in Log5j configuration for any given Logger
or Writer.
To set the Format for a particular Logger set a
property with a name of <logger-name>.format and a value
which is the fully qualified class name of the Format.
To set the Format for a particular Writer set a
property with a name of
<logger-name>.writer.<writer-name>.format and a
value which is the fully qualified class name of the Format.
Many Format classes have their own configuration properties.
These are documented fully in the javadocs for those classes.
| Method Summary | |
|---|---|
java.lang.String |
format(java.lang.String logName,
java.lang.String levelName,
java.lang.Object... objects)
Return a formatted String derived from a number of objects or primitives to append to a logger output stream. |
| Method Detail |
|---|
java.lang.String format(java.lang.String logName,
java.lang.String levelName,
java.lang.Object... objects)
logName - the name of the loggerlevelName - the logging level nameobjects - the array of objects or primitives providing Strings to
log
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||