2
0
mirror of https://github.com/boostorg/log.git synced 2026-02-09 23:22:32 +00:00
Commit Graph

28 Commits

Author SHA1 Message Date
Andrey Semashev
e823f88467 Added support for a separate target file name pattern in text file sink.
This allows to have different file names when actively writing the log file
and when rotating. In particular, this solves the problem with appending
to the previous file, when the log files are also collected and are supposed
to have distincs names.
2019-01-05 21:15:33 +03:00
Andrey Semashev
f8954f6662 Work around incorrect total file size estimate in file_collector.
If the text file sink backend used the file that was previously scanned
by file_collector as an old log file, on rotation the collector would
store a duplicate of the file info. If the file was removed due to
storage limits, the file info would still be stored despite the file
being deleted.

Also, in case if a file that is about to be rotated is deleted, don't
hard fail with an exception. This may happen if another process have deleted
the file or Boost.Log itself has. The latter can happen if multiple sinks
write directly into the common target storage and one of them invokes
file rotation, which due to the storage limits delete the file that
is currently being written by the other sink.
2018-10-30 04:29:49 +03:00
Andrey Semashev
7f75487d0b Fixed bad file counter returned from scan_for_files in case of counter overflow.
If the target directory contained a file with counter value of UINT_MAX in its
name, scan_for_files would always return the counter value of 0, even if such
file also existed in the directory. This caused incorrectly named log files to
appear in the target directory on user's application restart.

Also made sure that the returned counter value is zero if the scanning method
is not scan_matching or the file name pattern does not include the counter
placeholder. The returned counter should not have been used by the caller
in these cases anyway, but the returned value used to be bogus.
2017-08-15 16:09:50 +03:00
Andrey Semashev
68701167a1 Updated comments, renamed auto_flush parameter for clarity. 2016-11-27 23:10:34 +03:00
Andrey Semashev
38fd663541 Added a way to disable log file rotation on sink destruction.
This can be useful when the final rotation cannot be performed while global destructors are run (e.g. when a close handler depends on a global state).

It can also be useful to implement file appending with collector set up to a different target directory than the directory the backend writes to.
2016-11-27 22:53:32 +03:00
Andrey Semashev
a74e9d4a74 Added the get_current_file_name method to obtain the current log file
name from the text file sink backend.

Also make sure the close handler is not called when the file is not
open.
2016-10-16 17:37:14 +03:00
Andrey Semashev
b284e68200 Moved queue overflow policy handling to the IPC queue. Compilation fixes. 2016-04-14 19:32:03 +03:00
Erich Keane
5234253333 Added max_files option to text_file_backend's file_collector
As requested here: https://svn.boost.org/trac/boost/ticket/8746
this commit introduces the boost::log::keywords::max_files keyword
and implements this functionality in the file collector.

Additionally, the non-keyword make_collector call has max_files added as
a uintmax_t parameter, which has a default value as to not break
existing code.

The purpose of this is to limit the total number of files in the
collected logs.  If not specified, the limit will be
std::numeric_limits<uintmax_t>::max(), which is likely greater than the
capacity of the filesystem.
2015-12-29 11:07:41 -08:00
Andrey Semashev
a31ec74e51 Make sure that Windows API version is consistent for all sources.
Include winapi/config.hpp as soon as possible; avoid including even
Boost.Config before it so that it doesn't set Windows API version
accidentally by including some third party header. In all source files,
include detail/config.hpp or detail/setup_config.hpp first thing.

Moved all WinAPI config macros to the Jamfile.v2 and removed
windows_version.hpp as it was no longer needed. Also enabled inclusion of
windows.h while compiling the library.

Removed auto-linking with psapi.lib and advapi32.lib as it was no longer
working after ecf3114. Added linking with advapi32.lib to Jamfile.v2.
2015-12-20 21:05:28 +03:00
Andrey Semashev
d242967b52 Added a link to Boost.DateTime ticket for the facet visibility bug. 2015-10-04 23:05:43 +03:00
Andrey Semashev
284d5e6139 Added a workaround for incorrect file name generation in text file sink backend, when the file name contains date/time placeholders. Fixes #11691. 2015-10-04 18:37:05 +03:00
Andrey Semashev
ac70fa34c1 Removed use of auto_ptr. 2015-07-18 20:32:07 +03:00
Andrey Semashev
7ebfd3b6c4 Fixes #11016. Text file sink no longer creates lots of empty files if there is no free space on the file system. 2015-02-14 19:19:42 +03:00
Andrey Semashev
5bb604ee39 Updated copyright dates. 2015-01-25 17:32:33 +03:00
Andrey Semashev
755b2c27b7 Fixes #10700. Don't use vsnprintf_s on MSVC as it does not behave as the standard vsnprintf. Also corrected error checking for snprintf in different places. 2014-10-30 03:19:00 +03:00
Andrey Semashev
dfb3049a7c Extracted text_multifile_backend implementation to a separate file. 2014-06-22 18:46:17 +04:00
Andrey Semashev
7516f00cde Use low-level Qi extractors instead of qi::parse to reduce compile times and binary sizes. 2014-06-22 18:19:12 +04:00
Andrey Semashev
58cca56915 Added noexcept specifications. Simplified code in some cases. 2014-06-21 20:57:18 +04:00
Andrey Semashev
32b3e71432 Fixed compilation with MSVC for 32-bit x86. Removed use of Boost.Spirit and Boost.Phoenix in some cases to speed up compilation and reduce binary sizes. 2014-03-16 18:10:48 +04:00
Andrey Semashev
a21d096e4a Updated copyright notes to 2014. 2014-01-19 18:46:09 +04:00
Andrey Semashev
d3419b1091 Reapplied changeset [86160].
[SVN r86199]
2013-10-08 14:44:59 +00:00
Andrey Semashev
56bb6f2dca Temporarily reverted the last commit [86164], until 1.55 beta ships.
[SVN r86166]
2013-10-05 19:02:18 +00:00
Andrey Semashev
6e6ad59e52 Merged latest changes from trunk.
[SVN r86164]
2013-10-05 14:02:30 +00:00
Andrey Semashev
f01ecd2e7c Merged latest changes from trunk.
[SVN r85986]
2013-09-28 16:11:45 +00:00
Andrey Semashev
313a5b69cd Merged recent changes from trunk.
[SVN r85657]
2013-09-12 17:17:07 +00:00
Andrey Semashev
5204873fa9 Merged latest changes from trunk.
[SVN r85461]
2013-08-25 14:20:22 +00:00
Andrey Semashev
0be5080954 Corrected exception type when an unsupported placeholder is found in the file name pattern when scanning the filesystem.
[SVN r83862]
2013-04-13 12:43:44 +00:00
Andrey Semashev
a7c4e0e319 Boost.Log merged to trunk.
[SVN r83860]
2013-04-13 12:30:25 +00:00