Skip to content
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

Rolling file with Date variable from appsettings.json #21

Closed
galdaka opened this issue Mar 18, 2021 · 3 comments
Closed

Rolling file with Date variable from appsettings.json #21

galdaka opened this issue Mar 18, 2021 · 3 comments
Labels

Comments

@galdaka
Copy link

galdaka commented Mar 18, 2021

¿Is posible configure name of file with Date?

"File": {
  "Path": "logs\\app_{0:yyyy}-{0:MM}-{0:dd}.log",
  "Append": "True",
  "FileSizeLimitBytes": 1048576, // use to activate rolling file behaviour 1MB
  "MaxRollingFiles": 5 // use to specify max number of log files
}
@VitaliyMF
Copy link
Contributor

To resolve 'variables' in the log file name you need to define FormatLogFileName handler in Startup.cs: https://github.com/nreco/logging#change-log-file-name-on-the-fly

@galdaka
Copy link
Author

galdaka commented Mar 22, 2021

Hi,

What I intend is to unite the two characteristics: Rolling and custom format name in specific folder (Defined in appsettings.json). Is posible?

Thanks in advance,

@VitaliyMF
Copy link
Contributor

What I intend is to unite the two characteristics: Rolling and custom format name in specific folder (Defined in appsettings.json). Is posible?

This combination should work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants