Sets options for a console appender.
setOptions(options: any): ConsoleAppender
|options||A JSON object with options. See the Remarks sections below.|
The ConsoleAppender itself.
The JSON object can have the following fields:
|number||TRACE||Numeric severity. Only log messages with a severity equal or higher than this can be sent to the server.|
|regular expression||(empty)||If not empty, log messages only get processed if this regular expression matches the user agent string of the browser.|
|regular expression||(empty)||If not empty, log messages only get processed if this regular expression matches the IP address(es) of the sender of the request (details below). If you use this, be sure to set the IP address via the setOptions method of the JL object.|
|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.|
|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.
|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.
|number||0||Sets the size of the buffer used with sendWithBufferLevel and storeInBufferLevel.|
|number||1||Allows you to improve performance by sending multiple log messages in one go, rather than one by one.|
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.
Working out the IP address of the sender of a request
Working out the IP address of original sender of an HTTP request (that is, the user's browser) is not as simple as looking at the source address in the request.
If your web server sits behind a load balancer, the source of the final request to the web server is not the browser, but the load balancer. The request may also have been passed on through intermediate proxies, causing the same issue.
The most common (but non-standard) solution to this is that proxies and load balancers (such as AWS' Elastic Load Balancer) send an X-Forwarded-For request header with the IP addresses of the browser and any proxies that the request passed through, except for the final source address. JSNLog uses this request header to work out the IP address of the actual browser and the proxies and/or load balancer that the request passed through.
JSNLog reports the IP address(es) of the sender(s) of the request as a string of text containing a comma separated list. First is the browser itself, then intermediate proxies (in the order in which they were reached) and then the load balancer if there is one:
Browser IP address, Proxy 1, ..., Proxy N [, Load Balancer]