If the log file is configured for appending and rotation_size limit is set,
text_file_backend::consume would repeatedly attempt to reopen the log file with
a new counter value in attempt to find a file with a size below the
rotation_size limit. This logic breaks if the file name pattern does not
include a file counter placeholder, as it means the backend would repeatedly
attempt to open the same file, whose size would exceed the limit. The loop
would terminate after 2^32 iterations, but that may take a while.
Avoid this fallback if we know the file counter placeholder is missing
in the file name pattern.
Also, make fil size checks more robust against integer overflows.
Fixes https://github.com/boostorg/log/issues/252.
The wrap_filter helper can be used to inject user-defined filter
functions into Boost.Log filtering expressions.
Added implementation, tests, docs and examples.
Refs https://github.com/boostorg/log/issues/195.
This lets users to disable Boost.ASIO-related functionality and remove
the dependency on Boost.ASIO. This may be useful on platforms where
Boost.ASIO or its dependencies don't work or disabled.
Refs https://github.com/chriskohlhoff/asio/issues/1637.
* Make the library modular usable.
* Switch to library requirements instead of source. As source puts extra source in install targets.
* Clean up build dependencies.
* Remove external build references and avoid custom project loading.
* Use relative paths to declare config sub-projects.
* Add missing NO_LIB usage requirements.
* Add missing library ref.
* Add missing import-search for cconfig/predef checks.
* Add requires-b2 check to top-level build file.
* Update dependencies.
* Bump B2 require to 5.2
* Update copyright dates.
* Move inter-lib dependencies to a project variable and into the build targets.
* Remove custom symbolic project names for config subprojects. And use project root relative targets.
* Move private deps to the build project.
* Put back default boost locale link as locale build is now fixed.
* Set default address-model and architecture to avoid extra/custom detection logic. Put back missing check and config rules.
* Adjust doc build to avoid boost-root references.
* Fix ref to predef.jam location.
* Have B2 build use same deps as CML for per-target private/public.
* Add log dep to log_setup, as it's needed on some platforms.
* Add boost_log_with_support target to mirror CML.
* Fix platform specific winapi dependency spec.
If text_file_backend is set up to append to a previously written file, and
the actively written file name pattern does not include a file counter
placeholder but the target file name pattern does, we used to skip incrementing
the file counter in an attempt to generate the same file name as was last used,
so that we open the last used file for appending. While it did result in
reusing the last written file, since the counter was not incremented, the next
rotation would generate the last used target file name, which would result in
overwriting the last rotated file instead of adding a new file to the storage.
To mitigate this, only skip incrementing the counter if the file name pattern
for the actively written file actually has a counter placeholder. This way,
the counter will get incremented in the case described above, and on rotation
a new target file name will be generated.
Fixes https://github.com/boostorg/log/issues/245.
These specializations were deprecated in C++20, and libc++-19 now generates
deprecation warnings when using std::codecvt<char16_t> and
std::codecvt<char32_t> in C++20 and later modes.
This replaces boost::thread and most mutexes and condition variables with
std equivalents. It also adds support for std lock types to the strictest_lock
type trait.
This significantly, although not completely, reduces the dependency on
Boost.Thread.
Refs https://github.com/boostorg/log/issues/232.
This makes these sections better exposed to an impatient reader, as
that information is useful for better understanding of the rest of
the docs.
Also extracted installation sections to a separate file.
Related to https://github.com/boostorg/log/issues/226.
Boost.ASIO does not compile in C++11 mode on gcc prior to 5 as it uses
std::align.
Clang prior to 16 does not support libstdc++13 that is installed in
GHA ubuntu-22.04 image by default in C++20 mode. Use libstdc++11
instead.
Boost.Log supports compilers that do not qualify as C++11 compilers
for Boost.Regex, even if they are compiling in C++11 mode. In that
case, we still need to link with Boost.Regex v4 prebuilt library.
For more recent compilers, Boost.Regex v5 is used, and that is
a header-only library. This commit removes linking with Boost.Regex
when this is detected at configure time.
Note that only Boost.Build is updated. CMake doesn't need to be
updated since even header-only libraries need to be listed as
dependencies.
Closes https://github.com/boostorg/log/pull/219.
In text_file_backend, we try to avoid exceeding the rotation_size limit when we
open a new file, potentially in append mode. To do so, we check the combined
size of the opened file and the formatted log record to write against this
limit. It was possible that the log record alone exceeds the limit, which makes
this check always fail and cause an infinite loop of rotating files.
To avoid this, don't perform the check if the file size is 0, which is the case
when a new file is created. In this case, we will write the log record (thus
exceeding the rotation_size limit) and then rotate the file upon the next
log record we write.
Closes https://github.com/boostorg/log/issues/209.
Apparently, std::codecvt::do_length in libstdc++ from gcc 11.2 accesses
input characters outside the input range if max is specified larger than
the input range. This causes buffer overflow and a crash. Use the input
range size as the max limit, which should have the same effect as the
previous hardcoded limit.
gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105857
The manipulator allows to inject user's function into a stream output
expression. The manipulator will pass a reference to the stream to
the user's function as the first parameter, optionally followed by
additional arguments passed to the manipulator construction.
Previously, text_file_backend would generate a new file name when the file
name pattern contained a file counter placeholder, which prevented appending
to the file. Appending was only possible when the active file name was
stable across process restarts (effectively, this prohibited the file counter
to be used in the active file name).
This commit adds support for appending in such configuration. The file
collector has been updated to return the last found file counter during
filesystem scanning, and the sink backend doesn't increment it when the initial
file is opened, when appending is enabled, and when the file to be opened
exists and, if file collector is used, is in the target storage of the file
collector. In all other cases the file counter is incremented, which leaves
the behavior unchanged.
Closes https://github.com/boostorg/log/issues/179.
This prevents the file counter from being reset to zero if scan_for_files
is called multiple times, and subsequent calls don't find any new files.
Reported in https://github.com/boostorg/log/issues/179.
Use byte shuffle instead of arithmetics and masking to convert half-bytes
to characters.
Since the new algorithm more heavilly relies on pshufb, and it is slow
on some older Intel Atom CPUs, retain the old implementation and use it
when we know pshufb is slow. We might drop it eventually.
When settings parsers were disabled by a config macro, boost_log_setup would
be empty, and MSVC linker would produce no library at all. This broke
installing Boost.Log, as Boost.Build would expect a library file to be present.
We're adding a dummy export from the library as a workaround, so that the
library is always created, even if empty. This workaround should be considered
temporary, until we can disable the library proper after a Boost.Build bug
is fixed:
https://github.com/bfgroup/b2/issues/104
Closes https://github.com/boostorg/log/issues/164.
Closes https://github.com/boostorg/log/pull/165.
This is to indicate that the minimum target Windows version is Windows 8.
This is important for Boost.Atomic as it enables using WaitOnAddress API,
which further affects binary representation of the event object in Boost.Log.
The open_or_create implementation assumed that the created shared memory
size of 0 meant that the shared memory segment was freshly created. This
is not the case if multiple threads call open_or_create and check the
segment size before one of them resizes it. This could result in
initializing the shared memory multiple times and even corrupting it
if other threads were sending or receiving messages in the mean time.
While at it, converted the use of atomics in shared memory to ipc_atomic.
Fixes https://github.com/boostorg/log/issues/162.
This ensures that the writing position is actual immediately after the
log file is opened for appending. This fixes incorrect accounting for
the initial file size with MSVC and possibly other compilers.
Closes https://github.com/boostorg/log/issues/151.