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

532
Vistas
how to change the source value of the NLog eventlog target

Is there any possibility to change the source name of NLog.config dynamically if yes can any one please help me.

<targets>
<target xsi:type="EventLog" name="eventlog" layout="${callsite}:${message}" log="Application" **source="MyAwesomeSolution"**/>

this is the source name which i wanna change with parameters coming from other method to NLog.Config file. source="MyAwesomeSolution"

Thanks in advance.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use any predefined variable or your custom field in the source field.

e.g. source="${event-properties:item=customName}"

and in your code, you can fill this value

logger.Info("this event is coming from may {customName}", "my app");

or you can use

logger.SetProperty("customName", "my app");

or even

logger.WithProperty("customName", "my app").Info("test message");

for more details check out the documentation

https://github.com/NLog/NLog/wiki/EventProperties-Layout-Renderer#example

https://github.com/NLog/NLog/wiki/EventLog-target

over 4 years ago · Santiago Trujillo Denunciar
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