This project has moved. For the latest updates, please go here.


RollingFileTraceListener to use environment variable for root directory of the log files


app.config does not support Windows environment variables. There could be a few solutions:
  1. The application alters the config file at startup. The drawbak is, this requires high privilege, and miss trace info before the app codes run.
  2. Installer to alter the config during installation. This requires a lot scripting.
It will be more convenient to have
initializeData="%ProgramData%\My Company{ApplicationName}-{LocalDateTime:yyyy-MM-dd}.log"

Documentation later upon next release:
You may use Windows environment variable in front the the file path. For example:
initializeData="%ProgramData%\My Company{ApplicationName}-{LocalDateTime:yyyy-MM-dd}.log"

Please note, app.config does not support interpreting environment variables, thus you can not apply the same to TextWriterTraceListener in System.Diagnostics.


fretje wrote Apr 17, 2015 at 1:13 PM

This feature doesn't seem to be available in the latest version available on nuget (1.2.501).
Are there plans to update that version?

zijianhuang wrote May 8, 2015 at 6:27 AM

There have been only a few minor changes since last binary release. And this is an open source project, you should be easily grabbing the source codes and compile to get the latest features.