Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

537
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!