Skip to content

aspnet-request vars are empty in ASPNET Core 3.1 API #584

@jchapmantcg

Description

@jchapmantcg

Type: Question/Bug

  • All other vars like ${message} work, only the aspnet-request ones do not.

NLog version: 4.7.2

NLog.Web.AspNetCore version: 4.9.2

NLog.Extensions.Logging version: N/A

Platform: .NET Core 3.1

Current NLog config (xml or C#, if relevant)


// Console
config.AddTarget(new ConsoleTarget("logconsole"));

// Papertrail
var paperTrail = new SyslogTarget();
paperTrail.Name = "PaperTrail";
paperTrail.MessageCreation.Facility = NLog.Targets.Syslog.Settings.Facility.Local7;
paperTrail.MessageCreation.Rfc5424.AppName = "TESTAPP";
paperTrail.MessageSend.Protocol = NLog.Targets.Syslog.Settings.ProtocolType.Tcp;
paperTrail.MessageSend.Tcp.Server = "xxxxxxx";
paperTrail.MessageSend.Tcp.Port = xxxxxx;
paperTrail.MessageSend.Tcp.Tls = new NLog.Targets.Syslog.Settings.TlsConfig { Enabled = true };
paperTrail.Layout = "${uppercase:${level}}|${aspnet-Request-Method}|${aspnet-request-url:IncludeQueryString=true}|${message}|${exception:format=tostring}";
config.AddTarget(paperTrail);

config.AddRuleForAllLevels("PaperTrail");


_logger = NLogBuilder.ConfigureNLog(config).GetCurrentClassLogger();

In case of a BUG:

  • What is the current result?
    All ${aspnet-request-xxxx} vars are empty

  • What is the expected result?
    Values to be valid

  • Did you checked the Internal log?
    Yes. It did not show anything related.

  • Are there any workarounds? yes/no
    Not that I'm aware of.

  • Is there a version in which it did work?
    No.

  • Can you help us by writing an unit test?
    Yes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions