I need to track some particular Javascript events in my Sitecore (8.2) logs so that I can see how often it's firing. I have some ideas for how I could make my own api to write to the Sitecore logs, but I'm wondering if there's any way out of the box to write to the Sitecore logs from Javscript?

  • I have seen these messages in the startup logs for years, but never investigated: sitecore.logging.client.dll (Sitecore Logging, Lets you insert loggers in your JavaScript, and automatically sends the log messages to a server side component that stores them in your existing server side logs. Interfaces with Sitecore.Logging. Ideal for logging JavaScript exceptions to the server, including a stack trace. Documentation and examples are at jsnlog.com, 13.0.0-r00036.24) So it should be possible.
    – jrap
    Commented Jul 25, 2019 at 19:48

1 Answer 1


Sitecore supports client-side event logging using JSNLog. Sitecore client logging uses JSNLog which has been wrapped to allow Sitecore to configure it via a patch and to make use of the existing Log4net logging. There is an OOTB configuration file called Sitecore.JSNLog.config on app_config/include/Sitecore.

To enable client-side logging you need to add jsnlog.js file before all the script in your layout. You just need to add below line for this


this will add a script tag -

<script type="text/javascript" src="/sitecore/shell/controls/lib/jsnlog/jsnlog.min.js"></script>

After that, you are ready to add the log into Sitecore log folder. a simple way to add info in the log is like this -

JL().info("log message for test");

try {

catch(e) {
   JL().fatalException("Exception info", e);

You may need to update the Sitecore.JSNLog.config file for the level (DEBUG|ERROR|INFO) of logging. for example, An AjaxAppender doesn't allow INFO level via Sitecore client log.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.