Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jaguarxii opened this issue May 7, 2024 · 1 comment · Fixed by #1037
Labels

Comments

@jaguarxii
Copy link

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

@snakefoot
Copy link
Contributor

snakefoot commented May 7, 2024

Thank you so much for reporting this. Released new version of NLog.Web.AspNetCore:

And updated NLog.Web-unit-test to prevent this from happening again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants