We're currently trying to log to a file without a date/time stamped filename and then rotate it once a day to have a date/time stamped name.
We're almost getting it to work using Target, Filename, ScanForFiles, Append and AutoFlush.
This kind of functionality can be implemented using logrotate:
Boost log does not appear to have quite the same rotation abilities.
Is there a way to do this easily using Boost Log or would you advise we use logrotate ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Boost.Log only implements functionality that is required from the logging application to rotate logs (file naming and simple collecting). It doesn't implement any collateral advanced features, such as log compression or mailing. This kind of things should be done by external utilities, be that logrotate or other tools. In my mind, the most flexible solution would be a combination of Boost.Log and external tools for further log processing.
If you choose to employ logrotate to collect the logs and find any problems, please let me know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For now we're just after the aforementioned rename from a non-date named file rotated to a date named file.
Is this part of the standard functionality of the planned boost log v2 or is it already there ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, the log file should contain date/time in its name from the start. More details are available here. I think, v2 won't have this feature but it may be added later.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've found 2 bugs when trying to use rotation and appending in conjunction with one another:
1) The file does not rotate unless atleast 2 messages have been logged.
2) Rotation does not truncate the output file when in append mode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We're currently trying to log to a file without a date/time stamped filename and then rotate it once a day to have a date/time stamped name.
We're almost getting it to work using Target, Filename, ScanForFiles, Append and AutoFlush.
This kind of functionality can be implemented using logrotate:
http://linux.die.net/man/8/logrotate
Boost log does not appear to have quite the same rotation abilities.
Is there a way to do this easily using Boost Log or would you advise we use logrotate ?
Boost.Log only implements functionality that is required from the logging application to rotate logs (file naming and simple collecting). It doesn't implement any collateral advanced features, such as log compression or mailing. This kind of things should be done by external utilities, be that logrotate or other tools. In my mind, the most flexible solution would be a combination of Boost.Log and external tools for further log processing.
If you choose to employ logrotate to collect the logs and find any problems, please let me know.
For now we're just after the aforementioned rename from a non-date named file rotated to a date named file.
Is this part of the standard functionality of the planned boost log v2 or is it already there ?
No, the log file should contain date/time in its name from the start. More details are available here. I think, v2 won't have this feature but it may be added later.
I've found 2 bugs when trying to use rotation and appending in conjunction with one another:
1) The file does not rotate unless atleast 2 messages have been logged.
2) Rotation does not truncate the output file when in append mode.
The following is a possible solution to the aforementioned problems:\newline
\newline
diff -r boost-log_revision_728/libs/log/src/text_file_backend.cpp boost-log_revision_728NEW/libs/log/src/text_file_backend.cpp\newline
1172a1173\newline
> std::ios_base::openmode fileOpenMode = m_pImpl->m_FileOpenMode;\newline
1177d1177\newline
< m_pImpl->m_File.is_open() &&\newline
1181c1181,1182\newline
< )\newline
--\newline
> ) &&\newline
> m_pImpl->m_File.is_open()\newline
1186a1188\newline
> fileOpenMode = std::ios_base::trunc | std::ios_base::out;\newline
1194c1196\newline
< m_pImpl->m_File.open(m_pImpl->m_FileName, m_pImpl->m_FileOpenMode);\newline
--\newline
> m_pImpl->m_File.open(m_pImpl->m_FileName, fileOpenMode);\newline