Documentation Menu

Setting the url to send logs to

By default, the jsnlog.js library sends all log requests to the URL /jsnlog.logger. This page shows how to change this.

An AjaxAppender goes through these steps to work out what url to send log requests to:

  1. If has its own url, it will use that - set the url option of the AjaxAppender.

    Note that the default appender does not have its own url, so it will always default to step 2.

  2. If it doesn't have its own url, it will use the default Ajax url - set the defaultAjaxUrl option of the global JL object.
  3. If you didn't set the default Ajax url, it finally falls back to /jsnlog.logger.

If you send the log requests to a domain different from that of your site (such as logger.mydomain.com/jsnlog.logger), make sure the server side end point where you receive log requests implements the CORS protocol. Otherwise the browser won't send log requests to your end point.