-
Notifications
You must be signed in to change notification settings - Fork 63
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
Get rolling file name index #53
Comments
When log file size limit is reached next filename is generated by adding an 'index' suffix. Number of indexes are limited by "MaxRollingFiles" setting. If you want to guarantee that log file remains the same you may set "FileSizeLimitBytes" = 0 (means 'no limit') + your "FormatLogFileName" handler can check current log file size from time to time (not on each call -- as this will add too much overhead) and return different filename if needed.
The latest log file = the file with the latest 'last write' timestamp. |
this is not my intention. My intention is to get somewhere current index value so I can get actual file name the provider writes into. Would be nice if you can expose this information in callback function as a parameter.
this is silly, but I guess there is no better way, right? |
Normally Microsoft.Logging.Extensions infractructure works as a 'black box' from app's code (that generates log messages) - as your app is fully isolated by ILogger interface from concrete logging providers (that handle these log messages somehow). For example, when you use ConsoleLoggerProvider you don't have an access to its implementation internals. However, I may assume that your app has some specifics and it should 'know' some internal details of the concrete logging provider. For instance, this can be a public property in |
right, there is a specific requirement in my case.
understood, thanks! I will see how this is important to us, maybe I can deal with sorting files by |
This is related to #5, but not exactly.
Here is my NReco.Logging registration with .NET DI:
Everything works ok with one exception: I loose current file name tracking when log file is rolled. By looking in Logs directory, I see that file names are appended with rolling index:
And I have no idea how to access this index so I reference to actual current file in
LogFilePath
property. Any ideas?The text was updated successfully, but these errors were encountered: