Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

495
Vistas
NLog unable to create log file on Linux server (ASP.NET Core application)

It is working fine on the local windows system. When I deploy it on a Linux server it is neither logging logs nor creating log files.

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>

Program.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();
            })
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda