Writer
ConsoleWriter
, FileWriter
, RollingFileWriter
, SharedFileWriter
public abstract class AbstractFormatPatternWriter extends java.lang.Object implements Writer
Constructor | Description |
---|---|
AbstractFormatPatternWriter(java.util.Map<java.lang.String,java.lang.String> properties) |
Modifier and Type | Method | Description |
---|---|---|
protected static ByteArrayWriter |
createByteArrayWriter(java.lang.String fileName,
boolean append,
boolean buffered,
boolean threadSafe,
boolean shared) |
Creates a
ByteArrayWriter for a file. |
protected static java.nio.charset.Charset |
getCharset(java.util.Map<java.lang.String,java.lang.String> properties) |
Extracts the charset from configuration.
|
protected static java.lang.String |
getFileName(java.util.Map<java.lang.String,java.lang.String> properties) |
Extracts the log file name from configuration.
|
java.util.Collection<LogEntryValue> |
getRequiredLogEntryValues() |
Gets all log entry values that are required for rendering a log entry by the defined format pattern.
|
protected java.lang.String |
render(LogEntry logEntry) |
Renders a log entry as string.
|
public AbstractFormatPatternWriter(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- Configuration for writerpublic java.util.Collection<LogEntryValue> getRequiredLogEntryValues()
getRequiredLogEntryValues
in interface Writer
protected static java.lang.String getFileName(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- Configuration for writerjava.lang.IllegalArgumentException
- Log file is not defined in configurationprotected static java.nio.charset.Charset getCharset(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- Configuration for writerprotected static ByteArrayWriter createByteArrayWriter(java.lang.String fileName, boolean append, boolean buffered, boolean threadSafe, boolean shared) throws java.io.FileNotFoundException
ByteArrayWriter
for a file.fileName
- Name of file to open for writingappend
- An already existing file should be continuedbuffered
- Output should be bufferedthreadSafe
- Created writer must be thread-safeshared
- Output file is shared with other processesjava.io.FileNotFoundException
- File does not exist or cannot be opened for any other reasonprotected final java.lang.String render(LogEntry logEntry)
logEntry
- Log entry to renderCopyright © 2018. All rights reserved.