Está funcionando bien en el sistema de Windows local. Cuando lo implemento en un servidor Linux, no registra registros ni crea archivos de registro.
nlog.config
<?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" throwConfigExceptions="true"> <!-- enable asp.net core layout renderers --> <extensions> <add assembly="NLog.Web.AspNetCore"/> </extensions> <!-- the targets to write to --> <targets> <target name="errorLogFile" xsi:type="File" fileName="${currentdir}/logs/error/${date:format=yyyyMMdd}.txt" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${callsite}|${message} ${exception:format=tostring} ${newline} " /> <target name="infoLogFile" xsi:type="File" fileName="${currentdir}/logs/info/${date:format=yyyyMMdd}.txt" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${callsite}|${message} ${exception:format=tostring} ${newline} " /> </targets> <rules> <logger name="Microsoft.*" minlevel="Info" maxlevel="Warn" writeTo="" final="true" /> <logger name="*" minlevel="ERROR" writeTo="errorLogFile" /> <logger name="*" minlevel="Info" maxlevel="Warn" writeTo="infoLogFile" /> </rules> </nlog>Programa.cs > CreateHostBuilder
.ConfigureLogging((hostingContext, logging) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddConsole(); logging.AddDebug(); logging.AddEventSourceLogger(); // Enable NLog as one of the Logging Provider logging.AddNLog(); })