Documentation Menu


If you use .Net, click here.

Firstly, download jsnlog.js and add it to your site.

The second step is to let your server receive log messages from jsnlog.js. Two things are in play here:

  1. The URL where you will receive log messages;
  2. The format of the log messages.

URL where you will receive log messages

The built in AJAX appender by default sends all log messages to this url:


You can change this using the defaultAjaxUrl field in the JL setOptions Method.

Format of the log messages

The AJAX appender sends log requests with:

JSON string

The JSON string has this format:

    r:  "request id", // Obsolete. May be empty string.
    lg: [
        { l: level, m: 'message', n: 'logger name', t: timestamp },

Please note that a single JSON message to the server can contain multiple log messages. This is because the AJAX appender can be configured to batch messages, for example 2 log messages per JSON message to the server.

About the individual fields:

Field Description
request id Obsolete. Do not use.
level Numeric severity of the log message.
message Message to be logged.
logger name Name of the logger.
timestamp The time the message was logged by your JavaScript. This is the number of milliseconds since 1 January 1970 00:00:00 UTC, according to the client machine's clock.

JSNLog-RequestId request header with request id

The request id is used to identify all log requests that were generated by the same user. To use this facility, set the request id in your JavaScript after the page has loaded to some unique string, using the JL setOptions Method.

The jsnlog.js library then includes that request id in all log requests.

If you don't set the request id, jsnlog.js uses the empty string.

The request id is sent in a custom HTTP request header, JSNLog-RequestId. This way, server side code can easily determine whether a request is a log request from jsnlog.js, or some other request (such as a simple page request).