public class TextProtocol extends FileProtocol
TextProtocol is used for writing plain text log files. This
class is used when the 'text' protocol is specified in the
connections string. See the
SmartInspect.setConnections(java.lang.String) method for a list of available protocol options.
The public members of this class are threadsafe.
fConnected| Constructor and Description |
|---|
TextProtocol() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildOptions(ConnectionsBuilder builder)
Overridden.
|
protected String |
getDefaultFileName()
Returns the default filename for this log file protocol.
|
protected Formatter |
getFormatter()
Returns the formatter for this log file protocol.
|
protected String |
getName()
Overridden.
|
protected boolean |
isValidOption(String name)
Overridden.
|
protected void |
loadOptions()
Overridden.
|
protected void |
writeFooter(OutputStream stream)
Overridden.
|
protected long |
writeHeader(OutputStream stream,
long size)
Overridden.
|
getStream, internalConnect, internalDisconnect, internalWritePacketaddListener, composeLogHeaderPacket, connect, disconnect, dispatch, dispose, doError, failed, getAppName, getAsyncEnabledDefaultValue, getAsyncQueueDefaultValue, getBooleanOption, getBytesOption, getCaption, getHostName, getIntegerOption, getLevelOption, getReconnectDefaultValue, getRotateOption, getSizeOption, getStringOption, getTimespanOption, handleException, implConnect, implDisconnect, implDispatch, implWritePacket, initialize, internalDispatch, internalReconnect, internalWriteLogHeader, isAsynchronous, removeListener, reset, scheduleWritePacket, setAppName, setHostName, writePacketprotected String getName()
getName in class FileProtocolprotected Formatter getFormatter()
The standard implementation of this method returns an instance of the TextFormatter class. Derived classes can change this behavior by overriding this method.
getFormatter in class FileProtocolprotected String getDefaultFileName()
getDefaultFileName in class FileProtocolprotected long writeHeader(OutputStream stream, long size) throws IOException
writeHeader in class FileProtocolstream - The stream to which the header should be written tosize - Specifies the current size of the supplied streamIOException - io exceptionprotected void writeFooter(OutputStream stream)
The implementation of this method does nothing. Derived class may change this behavior by overriding this method.
writeFooter in class FileProtocolstream - The stream to which the footer should be written toprotected void buildOptions(ConnectionsBuilder builder)
buildOptions in class FileProtocolbuilder - The ConnectionsBuilder object to fill with the current options
of this protocolprotected boolean isValidOption(String name)
| Valid Options | Default Value | Description |
|---|---|---|
| indent | false | Indicates if the logging output should automatically be indented like in the Console |
| pattern | "[%timestamp%] %level%: %title%" | Specifies the pattern used to create a text representation of a packet |
For detailed information of how a pattern string can look like, please have a look at the documentation of the PatternParser class, especially the PatternParser.setPattern method.
The following table lists all valid options, their default values and descriptions for this text file protocol. For a list of options common to all file protocols, please have a look at the isValidOption method of the parent class. Please note that this text protocol does not support log file encryption.
SiAuto.Si.setConnections("text()");
SiAuto.Si.setConnections("text(filename=\"log.txt\", append=true)");
SiAuto.Si.setConnections("text(filename=\"log.txt\")");
SiAuto.Si.setConnections("text(maxsize=\"16MB\")");
}
isValidOption in class FileProtocolname - The option name to validate.protected void loadOptions()
loadOptions in class FileProtocolCopyright © 2023. All rights reserved.