Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

539
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda