Skip to content

Issues with logging in WorkerService project after upgrading to v6.0.1 #5928

@elfico

Description

@elfico

Hi! Thanks for reporting this bug!

NLog version: 6.0.1

Platform: .NET9 (Worker Service)

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

<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogFile=".\logs\internal.log"
	  internalLogToConsole="true"
	  throwConfigExceptions="true"
      internalLogLevel="Info">

	<!-- the targets to write to -->
	<targets>
		<!-- write logs to file -->
		<target xsi:type="File" name="fileLog" fileName=".\logs\nlog-all-${shortdate}.log"
				layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}" />
	</targets>

	<!-- rules to map from logger name to target -->
	<rules>
		<logger name="*" minlevel="Info" writeTo="fileLog" />
		<logger name="*" minlevel="Error" writeTo="fileLog" />
		<!--<logger name="*" minlevel="Error" writeTo="fileLog, mailLog" />-->
	</rules>

</nlog>

<!--link https://github.com/nlog/NLog/wiki/Mail-target-->
  • What is the current result?
    There is no output for both the internal log and the application log.

  • What is the expected result?
    There should be at least 1 log file.

  • Did you check the Internal log?
    Yes, I did. Added some configuration, but nothing yet

  • Please post full exception details (message, stacktrace, inner exceptions)
    Attached is the screenshot showing what the logger looks like when inspected.

  • Are there any workarounds? yes/no
    No workaround that I know of.

  • Is there a version in which it did work?
    Downgrading to version 5.4.0 solves the issue

  • Can you help us by writing a unit test?
    Yes, I can.

I have also developed a minimal reproducible version here: https://github.com/elfico/nlog-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report / Bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions