The file name rule for daily rotate log?
- Dominant language
- C++
- Stars
- 211
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
I posted a [thread on stackoverflow](https://stackoverflow.com/questions/46094193/boost-log-doesnt-write-log-to-the-file-which-has-max-file-counter-or-create-new) few months ago, no one answered it. It's not very urgent since it is only log file name so I just left it.
Recently I noticed that the [changelog of 1.66.0](http://www.boost.org/doc/libs/1_66_0/libs/log/doc/html/log/changelog.html) said it has been fixed.
For me I still have some issues about the file name. I can see some log file names after I upgrade boost to 1.66.0 just like it behaves in 1.65.1.
Here's the code:
```
logging::wsettings settings;
settings["Core"]["Filter"] = L"%Severity% >= debug";
settings["Core"]["DisableLogging"] = false;
settings["Sinks.File"]["Destination"] = L"TextFile";
settings["Sinks.File"]["FileName"] = L"App_%Y-%m-%d.%N.log";
settings["Sinks.File"]["Format"] = L"%TimeStamp% [%ThreadID%] %Severity(format=\"%-7s\")% - %Message%";
settings["Sinks.File"]["AutoFlush"] = true;
settings["Sinks.File"]["RotationTimePoint"] = L"00:00:00";
settings["Sinks.File"]["RotationSize"] = 10 * 1024 * 1024;
settings["Sinks.File"]["Target"] = filePath_;
settings["Sinks.File"]["ScanForFiles"] = L"All";
settings["Sinks.File"]["Append"] = true;
```
Here's some log file examples:
> App_2018-01-09.7.log
> App_2018-01-10.8.log
> App_2018-01-10.0.log
> App_2018-01-11.1.log
> App_2018-01-11.0.log
> (Sorted by creation time ASC)
My understanding is that **the counter** and **date-time part** are **unrelated**, the counter increases whenever a new file is being created. Is my understanding correct?
But this makes the file names confusing. For example:
1. Start app on 2018-01-11, then the file name is App_2018-01-11.0.log
2. A new filename will be created as App_2018-01-12.1.log tomorrow
3. If I restart app tomorrow, then a new filename created as App_2018-01-12.0.log
Is this the **current behavior**?
If so, my **suggestion** is to reset the file counter for a new day like this:
1. Start app on 2018-01-11, then the file name is App_2018-01-11.0.log
2. A new filename created as App_2018-01-12.0.log tomorrow
3. If I restart app tomorrow, then a new filename will be created as App_2018-01-12.0.log
4. If the file becomes too large, then the file counter will be increased when creating new file name.
Does this make sense?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.