Skip to content

Commit

Permalink
Fix NLog orchard-tenant-name returns None. (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
awyl authored and sebastienros committed Jun 15, 2018
1 parent 81d4759 commit 4c31e6b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text;
using System.Text;
using NLog;
using NLog.LayoutRenderers;
using NLog.Web.LayoutRenderers;
using OrchardCore.Environment.Shell;
using OrchardCore.Hosting.ShellBuilders;

namespace OrchardCore.Logging
{
Expand All @@ -18,8 +18,8 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
{
var context = HttpContextAccessor.HttpContext;

// If there is no ShellSettings in the Features then the log is rendered from the Host
var tenantName = context.Features.Get<ShellSettings>()?.Name ?? "None";
// If there is no ShellContext in the Features then the log is rendered from the Host
var tenantName = context.Features.Get<ShellContext>()?.Settings?.Name ?? "None";
builder.Append(tenantName);
}
}
Expand Down

0 comments on commit 4c31e6b

Please sign in to comment.