Skip to content

new file is not created with daily_file_sink #2828

Closed Answered by tt4g
330305020 asked this question in Q&A
Discussion options

You must be logged in to vote

daily_file_sink rotates to the "specified time" when the "date changes".
And spdlog::sinks::daily_filename_calculator adds only the year, month, and day to the filename, so if it rotates to the same day, nothing will happen because the log will be written to the same file.

/*
* Generator of daily log file names in format basename.YYYY-MM-DD.ext
*/
struct daily_filename_calculator
{
// Create filename for the form basename.YYYY-MM-DD
static filename_t calc_filename(const filename_t &filename, const tm &now_tm)
{
filename_t basename, ext;
std::tie(basename, ext) =

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by 330305020
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants