-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create the log file by process name? #411
Comments
You're best off asking stuff like this on stackoverflow - anyone that watches this repo watches the |
Enrichers don't work for filenames, only for log message templates. I don't believe there is a way to name the log file based on the process name while using JSON config. Instead, I think you'll need to configure the loggewr in code instead. You probably already know this if you've tried writing an enricher, but you can get the process name (without the file extension) by using: System.Diagnostics.Process.GetCurrentProcess().ProcessName |
@cocowalla Thank you. At the moment, I have a workaround to implement this. I add a PlaceHolder flag such as ${InstanceName} in the path, and then read the appsettings.json and replace the PlaceHolder with the process name, then LogConfiguration reads from the configuration. But I think it is not too nice.
|
I create a common trace library for other solutions. But I can not find a way to configure the path dynamicly.
I tried to create a enrich to add a property named InstanceName, but it does not work.
The text was updated successfully, but these errors were encountered: