title: NLog: LayoutRenderer cannot be found: 'aspnet-user-identity
body: <p>I try to implement NLog into my .NET Core Api web service.
  I want to log to an Oracle database. All works well through an nlog.config XML file.</p>
  
  <p>But the goal is to implement NLog config into appsettings.json and here problem occurs.
  I get the error set in title:</p>
  
  <blockquote>
    <p>LayoutRenderer cannot be found: 'aspnet-user-identity</p>
  </blockquote>
  
  <p>My config file is like this :</p>
  
  <pre><code>"NLog": {
      "autoReload": true,
      "throwConfigExceptions": true,
      "internalLogLevel": "info",
      "internalLogFile": "c:/app/log/dev/internal-appsetting-nlog.txt",
      "extensions": {
          "NLog.Extensions.Logging": {
              "assembly": [
                  "NLog.Extensions.Logging",
                  "NLog.Web.AspNetCore"
              ]
          }
      },
      "variables": {
          "var_logdir": "c:/app/log/dev"
      },
      "default-wrapper": {
          "type": "AsyncWrapper",
          "overflowAction": "Block"
      },
      "targets": {
          "all-file": {
              "type": "File",
              "fileName": "${var_logdir}/nlog-all-${shortdate}.log",
              "layout": {
                  "type": "JsonLayout",
                  "Attributes": [
                      {
                          "name": "timestamp",
                          "layout": "${date:format=o}"
                      },
                      {
                          "name": "level",
                          "layout": "${level}"
                      },
                      {
                          "name": "logger",
                          "layout": "${logger}"
                      },
                      {
                          "name": "message",
                          "layout": "${message:raw=true}"
                      },
                      {
                          "name": "properties",
                          "encode": false,
                          "layout": {
                              "type": "JsonLayout",
                              "includeallproperties": "true"
                          }
                      }
                  ]
              }
          },
          "db": {
              "type": "Database",
              "commandText": "INSERT INTO logtable (LOGLEVEL,LOGGER,MESSAGE,MACHINENAME,USERNAME,CALLSITE, THREADID,EXCEPTIONMESSAGE,STACKTRACE,SESSIONID) VALUES (:pLEVEL,:pLOGGER,:pMESSAGE,:pMACHINENAME, :pCALLSITE,:pTHREADID,:pEXCEPTIONMESSAGE,:pSTACKTRACE)",
              "parameters": [
                  {
                      "name": "@pLEVEL",
                      "layout": "${level}"
                  },
                  {
                      "name": "@pLOGGER",
                      "layout": "${logger}"
                  },
  
                  {
                      "name": "@pMESSAGE",
                      "layout": "${message}"
                  },
                  {
                      "name": "@pMACHINENAME",
                      "layout": "${machinename}"
                  },
                  {
                      "name": "@pUSERNAME",
                      "layout": "${aspnet-user-identity}"
                  },
                  {
                      "name": "@pCALLSITE",
                      "layout": "${callsite:filename=true}"
                  },
                  {
                      "name": "@pTHREADID",
                      "layout": "${threadid}"
                  },
                  {
                      "name": "@pEXCEPTIONMESSAGE",
                      "layout": "${exception}"
                  },
                  {
                      "name": "@pSTACKTRACE",
                      "layout": "${stacktrace}"
                  },
                  {
                      "name": "@pSESSIONID",
                      "layout": "${aspnet-sessionid}"
                  }
              ],
              "dbProvider": "Oracle.ManagedDataAccess.Client.OracleConnection, Oracle.ManagedDataAccess",
              "connectionString": "xxxxxxxxxxxx"
          }
      },
      "rules": [
          {
              "logger": "*",
              "minLevel": "Trace",
              "writeTo": "all-file"
          },
          {
              "logger": "*",
              "minLevel": "Trace",
              "writeTo": "db"
          },
          {
              "logger": "Microsoft.*",
              "maxLevel": "Info",
              "final": true
          }
      ]
  },
  </code></pre>
  
  <p>The internal debugger reports:</p>
  
  <pre><code>2019-10-09 16:48:48.6665 Info Adding target AsyncTargetWrapper(Name=all-file)
  2019-10-09 16:48:48.7859 Warn Error when setting property 'Layout' on 'NLog.Targets.DatabaseParameterInfo' Exception: System.ArgumentException: LayoutRenderer cannot be found: 'aspnet-user-identity'. Is NLog.Web not included?
     at NLog.Config.Factory`2.CreateInstance(String itemName)
     at NLog.Layouts.LayoutParser.GetLayoutRenderer(ConfigurationItemFactory configurationItemFactory, String name)
     at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, SimpleStringReader stringReader)
     at NLog.Layouts.LayoutParser.CompileLayout(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr, Boolean isNested, String&amp; text)
     at NLog.Layouts.SimpleLayout.set_Text(String value)
     at NLog.Internal.PropertyHelper.TryNLogSpecificConversion(Type propertyType, String value, Object&amp; newValue, ConfigurationItemFactory configurationItemFactory)
     at NLog.Internal.PropertyHelper.SetPropertyFromString(Object obj, String propertyName, String value, ConfigurationItemFactory configurationItemFactory)
  </code></pre>
  
  <p>Error occurs on <code>${aspnet-sessionid}</code>. If I comment out both layout, everything works well.</p>
  
  <p>I found different things on GitHub issue report but all I tried was a fail.</p>
  
  <p>Could someone help?</p>