markmcdowell / NLog.Targets.ElasticSearch

NLog target for Elasticsearch
MIT License
176 stars 89 forks source link

Does not work with NLog.Web.AspNetCore 5 #161

Closed venca-x closed 2 years ago

venca-x commented 2 years ago

After upgrade to NLog.Web.AspNetCore 5, does not work

snakefoot commented 2 years ago

If you are using enableJsonLayout="true" then you are waiting for this bug-fix: https://github.com/markmcdowell/NLog.Targets.ElasticSearch/pull/159 (The workaround while waiting for the bug-fix to be released is to explicit assign pipeline="").

If not using enableJsonLayout="true", then you should enable NLog Internal Logging and look for warnings and errors.

snakefoot commented 2 years ago

Notice NLog 5 also includes the breaking change NLog Extensions assemblies will not load automatically

So you explicit specify the extension in NLog.config:

  <extensions>
    <add assembly="NLog.Targets.ElasticSearch"/>
  </extensions>

See also NLog.config example at https://github.com/markmcdowell/NLog.Targets.ElasticSearch

Alternative you can include the extension-assembly-name in the target-type-alias (New syntax introduced with NLog5)