Documentation Menu

setOptions Method

Sets options for a console appender.

Definition

setOptions(options: any): ConsoleAppender

Parameters

options A JSON object with options. See the Remarks sections below.

Return Value

The ConsoleAppender itself.

Remarks

The JSON object can have the following fields:

Field Type Default Description
level
optional
number TRACE Numeric severity. Only log messages with a severity equal or higher than this can be sent to the server.
userAgentRegex
optional
regular expression (empty) If not empty, log messages only get processed if this regular expression matches the user agent string of the browser.
ipRegex
optional
regular expression (empty) If not empty, log messages only get processed if this regular expression matches the IP address(es) from which the page was loaded. If you use this, be sure to set the IP address via the setOptions method of the JL object.
disallow
optional
regular expression (empty) If not empty, log messages are suppressed if they match this regular expression. If an object is being logged, it is converted to a JSON string, which is then matched.
storeInBufferLevel
optional
number ALL If the severity of the log message is equal or greater than this, but smaller than level, the log message will not be sent to the server, but stored in an internal buffer.

If bufferSize is 0 or less, the log message is simply ignored.

sendWithBufferLevel
optional
number OFF If the severity of a log message is equal or greater than this, not only the log message but also all log messages stored in the internal buffer will be sent to the server.

This allows you to store low priority trace messages in the internal buffer, and only send them when a high priority fatal message is sent.

bufferSize
optional
number 0 Sets the size of the buffer used with sendWithBufferLevel and storeInBufferLevel.
batchSize
optional
number 1 Allows you to improve performance by sending multiple log messages in one go, rather than one by one (details).
batchTimeout
optional
number (no timeout) Usefull when batching log messages. If set, log messages are guaranteed to be sent within this period (in milli seconds), even if the batch size has not been reached yet (details).

Logger level and appender level

Notice that both loggers and appenders have a level. This means that a log message must have a severity that is equal or higher than both these levels in order to be processed.