Documentation Menu


Tag helper that generates JavaScript code to configure loggers and appenders.


<jl-javascript-logger-definitions request-id="..." />


request-id Optional. Request id to include in log messages sent by JSNLog to the server. See remarks.

Return Value

Script blocks that configure your JavaScript loggers and appenders.


This can only be used in ASP.NET Core web applications.

As part of the installation, you may have included a call to this tag helper in your pages.

It translates the server side configuration to JavaScript code that configures the client side loggers and appenders (details).


JSNLog gets the request id of the request, or if it can't, generates its own unique id. It sends that with all log messages to the server so log messages belonging to the same request can be correlated (details).

If however you generate your own request ids and you want JSNLog to use that instead, pass in your request id.

Ensure your web site uses jl-javascript-logger-definitions

To ensure that your web site can use the jl-javascript-logger-definitions tag helper:

  1. If your web site does not already have a _ViewImports.cshtml file, add an empty file with that name to your Views or Pages directory.
  2. Add this line to your _ViewImports.cshtml file:
    @addTagHelper "*, jsnlog"