Skip to content

LayoutRenderers ${callsite} and ${callsite-linenumber} stopped working since 5.3.9 release #1036

@jaguarxii

Description

@jaguarxii

Type (choose one):

  • Bug

NLog version: 5.3.9 / 5.3.10

NLog.Web.AspNetCore version: 5.3.9 / 5.3.10

NLog.Extensions.Logging version: 5.3.9 / 5.3.10

Platform: .NET 8.0

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

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogLevel="Warn"
      internalLogFile="${basedir}/log/internal-nlog.txt">

  <!-- Load the ASP.NET Core plugin -->
  <extensions>
    <add assembly="NLog.Web.AspNetCore"/>
  </extensions>

  <!-- the targets to write to -->
  <targets>
     <target xsi:type="File" name="appLog" fileName="${basedir}/log/${when:when='${environment:ASPNETCORE_ENVIRONMENT}'='Production':inner=${date:format=yyyyMMdd_HH}:else=${date:format=yyyyMMdd}}-mibarriofacil.log" keepFileOpen="false"
            layout="${longdate} | ${uppercase:${level}} | IP: ${aspnet-Request-Ip} | IsAuth: ${aspnet-user-isauthenticated} - U:${aspnet-user-claim:ULogin} - B:${aspnet-user-claim:BName}${newline} &#009;&#009;CallSite: ${callsite} | line: ${callsite-linenumber}${newline} &#009;&#009;${message} | ${exception:format=tostring} | Stack: ${stacktrace}${newline}" 
            />
  </targets>

  <rules>
    <!--Skip non-critical Microsoft logs and so log only own logs-->
    <logger name="System.*" finalMinLevel="Warn" />    <!-- Insert at the top -->
    <logger name="Microsoft.*" finalMinLevel="Warn" /> <!-- Insert at the top -->
    <logger name="mbf.*" minlevel="Trace" writeTo="appLog" /> <!-- General app log -->
  </rules>
</nlog>

In case of a BUG:

  • What is the current result?
--- VERSION 5.3.9, 5.3.10
2024-05-07 08:40:45.9629 | TRACE | IP: ::ffff:127.0.0.1 | IsAuth: 1 - U:soportemibarriofacil@gmail.com - B:EDIFICIO CARAVAGGIO
 		CallSite: Microsoft.Extensions.Logging.LoggerExtensions.Log | line: 0
 		Inicio |  | Stack: BoroughPersonService.hasAccess => LoggerExtensions.LogTrace => LoggerExtensions.Log

2024-05-07 08:40:50.3440 | TRACE | IP: ::ffff:127.0.0.1 | IsAuth: 1 - U:soportemibarriofacil@gmail.com - B:EDIFICIO CARAVAGGIO
 		CallSite: Microsoft.Extensions.Logging.LoggerExtensions.Log | line: 0
 		Ok  |  | Stack: BoroughPersonService.hasAccess => LoggerExtensions.LogTrace => LoggerExtensions.Log
  • What is the expected result?
--- VERSION 5.3.8
2024-05-07 08:41:26.9621 | TRACE | IP: ::ffff:127.0.0.1 | IsAuth: 1 - U:soportemibarriofacil@gmail.com - B:EDIFICIO CARAVAGGIO
 		CallSite: mbf.Services.BoroughPersonService.hasAccess | line: 1191
 		Inicio |  | Stack: <no type>.lambda_method2 => HomeController..ctor => BoroughPersonService.hasAccess

2024-05-07 08:41:30.9673 | TRACE | IP: ::ffff:127.0.0.1 | IsAuth: 1 - U:soportemibarriofacil@gmail.com - B:EDIFICIO CARAVAGGIO
 		CallSite: mbf.Services.BoroughPersonService.hasAccess | line: 1209
 		Ok  |  | Stack: <no type>.lambda_method2 => HomeController..ctor => BoroughPersonService.hasAccess
  • Did you checked the Internal log?
    Yes, has no errors or warnings

  • Please post full exception details (message, stacktrace, inner exceptions)
    There are no exceptions or warnings

  • Are there any workarounds?
    No

  • Is there a version in which it did work?
    It worked up to version 5.3.8

  • Can you help us by writing an unit test?
    No

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