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

Trace and Debug messages not appearing #171

Closed
tymarats opened this issue Aug 30, 2017 · 4 comments
Closed

Trace and Debug messages not appearing #171

tymarats opened this issue Aug 30, 2017 · 4 comments

Comments

@tymarats
Copy link

Using NLog.Web.AspNetCore version 4.4.1. I have this configuration (modified from one of the tutorials):

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogLevel="Warn"
      internalLogFile="c:\temp\hosted-internal-nlog.txt">

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

  <!-- the targets to write to -->
  <targets>
    <!-- write logs to file -->
    <target xsi:type="File" name="allfile" fileName="c:\temp\hosted-nlog-all-${shortdate}.log"
                layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId.Id}|${logger}|${message} ${exception}" />

    <!-- another file log, only own logs. Uses some ASP.NET core renderers -->
    <target xsi:type="File" name="ownFile-web" fileName="c:\temp\hosted-nlog-own-${shortdate}.log"
            layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId.Id}|${logger}|${message} ${exception:format=tostring,data}|${aspnet-request-url}|${aspnet-mvc-action}" />

    <!-- write to the void aka just remove -->
    <target xsi:type="Null" name="blackhole" />
  </targets>

  <!-- rules to map from logger name to target -->
  <rules>
    <!--All logs, including from Microsoft-->
    <logger name="*" minlevel="Trace" writeTo="allfile" />

    <!--Skip Microsoft logs and so log only own logs-->
    <logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />
    <logger name="*" minlevel="Trace" writeTo="ownFile-web" />
  </rules>
</nlog>

Obviously, minlevel is set to "Trace", however, when I do this:

logger.LogInformation("Info log");
logger.LogDebug("Debug log");
logger.LogTrace("Trace log");

only the INFO line is actually visible in log files, while Trace and Debug lines never get logged.

@304NotModified
Copy link
Member

This issue is some where here already, please check the issues here or at https://github.com/NLog/NLog/issues

@304NotModified
Copy link
Member

Ps I'm currently very limited with time, so can't help searching

@tymarats
Copy link
Author

Thank you, I did the search, but I somehow missed it.
Duplicate of #167

@304NotModified
Copy link
Member

thanks!

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

No branches or pull requests

2 participants