ahmed allam
ahmed allam

Reputation: 379

boost log rotate_file raise error when trying to rotate empty file?

I am using boost log and every period i manually change log file so i need to use rotate_file.
when there is logs in file every thing works fine.
when the file is empty but i need to close it and open next one ,rotate_file give error related to file system????
how can i rotate file which is empty???
i need to use rotate_file on locked_backend having empty file without any logs.
i tried to locked_backend->close_file() but it gives error due to being private to backend.

Upvotes: 0

Views: 137

Answers (1)

Andrey Semashev
Andrey Semashev

Reputation: 10644

When you haven't written any log records, and there wasn't a previous log file with a name matching the filename pattern you set, there isn't any log file (i.e. it's not an empty file, but there is no file at all). In that case rotating the file manually will throw, indicating a failure. It is up to you how to deal with that exception. You can ignore it if you want to.

Upvotes: 1

Related Questions