sgryphon / essential-diagnostics

Essential.Diagnostics contains additional trace listeners, filters and utility classes for the .NET Framework System.Diagnostics trace logging. Included are colored console, SQL database, rolling file, Seq logging server, and in-memory trace listeners, expression filters, activity and logical operation scopes, and configuration file monitoring.
Microsoft Reciprocal License
69 stars 25 forks source link

Add base directory path as option to rolling text writer #28

Open sgryphon opened 6 years ago

sgryphon commented 6 years ago

Could you please add in RollingTextWriter => private string GetCurrentFilePath(TraceEventCache eventCache)

Add an option to set the base directory, as the current options don’t work on a service unless you hard code the path, that does not work well when the installer has the ability to change the installation path.

             case "BASEDIR":
                        value = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
                        break;
lchengNetBall commented 6 years ago

In the App.config file, I have specified the log file to be written to the "Logs" folder under where the executable is running from. This is what is in the App.config file. "initializeData=".\Logs{ApplicationName}_{DateTime:yyyy-MM-dd}.log"

It looks like the log file is outputted to "C:\Windows\system32\Logs\" folder. Is this a known issue?

C:\Windows\system32\Logs\