question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use of NLog variables in internalLogFile setting

See original GitHub issue

Is there any way I could specify a variable in the <nlog /> attributes?

I know you cannot use layout variables, but it would be wonderful to be able to write in the .config something like: internalLogFile="c:/logs/Nlog.${processname}.log"

BTW: the issue has been mentioned in StackOverflow http://stackoverflow.com/questions/9428724/nlog-internal-log-not-working-with-asp-net-mvc

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
snakefootcommented, Oct 12, 2021

NLog ver. 4.6 add support for environment-variables like %appdata% or %HOME%, and using these basic layouts in internalLogFile=:

  • ${currentdir}
  • ${basedir}
  • ${tempdir}

NLog ver. 4.7 also adds this:

  • ${processdir}

See also: https://github.com/NLog/NLog/wiki/Internal-Logging

1reaction
304NotModifiedcommented, Oct 4, 2015

Yes, that’s the case. And then we should write an internal-internal-logger 😉

If there is a really great benefit to implement, we will add it as feature request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using GlobalDiagnosticsContext in NLog internalLogFile
I stepped through NLog code and it seems it only calls ExpandFilePathVariables to expand some known environment variables before setting the ...
Read more >
Logging Configuration File | Documentation
The logging can be customized by providing a configuration file to NLog, e.g. by creating an "nlog.config" file in the same folder as...
Read more >
NLog Tutorial - The essential guide for logging from C#
The ultimate tutorial for NLog. Learn about everything from logging and structured log messages to layout renderers and configuration of ...
Read more >
Logging with NLog in ASP.NET Core
NLog uses this configuration file to load the settings. ... and also a basic SQL command to log the NLog variables to the...
Read more >
Nlog - How to log certain actions into a seperate file?
Hi there, I am working on a Blazor Server application. I am using Nlog for logging. Here is my nlog configuration; <?xml version="1.0" ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found