...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
syslog_backendwhen IPv6 address is used for the syslog server. (GH#181)
max_size_decorwas used on a formatting stream,
std::codecvt::do_lengthincorrectly accessed the input buffer and caused a buffer overflow.
text_file_backend, added support for appending to a previously written log file, when file rotation is used and log file names use file counters. For this to work, the target storage directory must be the same as the directory where the active log file is written, and
text_file_backend::scan_for_filesmust be called prior to emitting any log records to discover the last file counter used in the target storage directory. Previously, in such a configuration the sink backend would generate a new file name instead of appending to the last written one.
collectorinterface has changed:
scan_for_filesmethod returns a
scan_resultstructure that contains information collected during the scan;
is_in_storagemethod added for testing if a path refers to a file within the target storage directory.
invoke_manipstream manipulator that can be used for injecting user's function into a stream output expression.
text_file_backend::scan_for_filesmultiple times, and the second and the following calls don't find any new files. (GH#179)
char32_tfor compatibility with C++17 and later. (PR#159)
std::bytetype to receive methods of the inter-process message queue.
nt62tag in the version namespace to denote the target OS ABI. For example, the version namespace could be named as
v2_mt_nt62. This name will be part of all symbols exported by the library. Use the
BOOST_USE_WINAPI_VERSIONmacro consistenly when building Boost and your code to request the minimum target Windows version.
reliable_message_queue::open_or_createor the equivalent constructor. Multiple threads or processes calling
open_or_createconcurrently with sending or receiving messages from the same queue could end up corrupting the queue contents and potentially crashing the process. (GH#162)
b2 installfailing on Windows because of missing
BOOST_LOG_WITHOUT_SETTINGS_PARSERSis defined. (GH#164)
std::ios_base::appfile open mode in
text_file_backendnow also implies
std::ios_base::ate. This fixes incorrect accounting for the initial size of the log file opened for appending. (GH#151)
unbounded_fifo_queuepolicy of the
asynchronous_sinkfrontend. The race could be detected by TSAN, but it was not a real problem on most current CPU architectures and compilers. (GH#139)
channel_logger), the channel attribute is now deep-copied from the original logger. This means that modifying the channel in the new logger will no longer affect the original logger.
std::allocator<void>in template parameters with a new tag type
boost::log::use_std_allocatorto silence libc++ warnings about the former being deprecated in C++17 and later. The tag indicates that the instantiated template should be using a specialization of
std::allocatorinternally to allocate dynamic memory, so the change has no functional effect. (GH#141)
__MSVCRT_VERSION__macro on MinGW and MinGW-w64. This macro is used to select the target C runtime library. Defining this macro caused incompatibility with UCRT, which is available as an option in recent MinGW-w64. (PR#149)
text_file_backendwhen generating the target file name (based on the pattern set by
set_target_file_name_patternmethod) when the log file is rotated. The backend used to use the next value of file counter, which could cause some counter values to be skipped on application restarts. (GH#125)
basic_sink_frontendwith an atomic. This should silence clang-cl warnings about deprecated uses of
asynchronous_sinkfrontend, resolved a possible conflict between
runis called from a user's thread instead of the internal dedicated thread spawned by the frontend.
feed_recordsmethods will wait for
flushto complete, if one is in progress. Additionally,
stopnow explicitly doesn't wait for the ongoing record feeding operation to complete. (GH#131)
ip_versionnamed parameter on the sink backend construction (by default, IPv4 is assumed). When an address is obtained as a result of host name resolution, only addresses with matching IP version are considered. (GH#119)
range_manipstream manipulator that can be used for outputting elements of a range, optionally separated by a delimiter.
tuple_manipstream manipulator that can be used for outputting elements of a tuple or any other heterogeneous sequence, optionally separated by a delimiter.
optional_manipstream manipulator that can be used for outputting optionally present values.
core::flushnow performs a flush on the default sink used for trivial logging, when no sinks are registered.
openlogcall. Such implementations could access already freed memory on each
syslogcall, resulting in undefined behavior. (GH#97)
rotation_at_time_point(boost::gregorian::greg_day(1))) could be silently ignored and not happen. (GH#98)
::rotate_filecould throw if there were no log records written yet and target file name pattern was set. The method would attempt to rename a missing file, which would result in an exception. Note that
rotate_filemay still throw because of a missing log file, if the file being rotated is removed by a third party.
std::allocator_traitsto improve compatibility with C++20 allocators.
basic_formatting_ostream. The string view can now participate in character code conversion on output.
auto_newlineformatter and stream manipulator. It can be used to ensure that formatted output always ends with a newline while avoiding duplicate newlines.
auto_newline_modeenum either in the
auto_newline_modenamed parameter of the backend constructor or by calling the
set_auto_newline_modemethod on the backend post-construction. The
auto_newline_modenamed parameter is also supported in the convenience functions for initializing sinks. When initializing from settings or a config file, the behavior is controlled by the new "AutoNewline" parameter of the sink.
The default behavior with regard to trailing newlines has changed slightly
compared to the previous Boost.Log releases. The backends will now only add
a trailing newline if there isn't one in the formatted log message string
already. In previous releases a newline was added unconditionally. In general,
users are advised to configure their formatters so that the trailing newline
is added there, if needed (e.g. by using
formatnamed parameters to sink constructors and convenience functions for initializing sinks. For example, it is now possible to specify C++11 lambda functions directly in these parameters. (GH#63)
boost::log::trivial::severity_level. For filters, the support is limited to attributes with "Severity" name. This relieves the user from having to register filter and formatter factories in order to use
boost::log::trivial::severity_levelwith filters and formatters parsed from strings or settings. Note that any other custom severity level enums must still be registered, as before.
scan_for_filesmethod would not find files matching that pattern in the target storage, leaving them unmanaged. In particular, such files would not be deleted to free target storage. (GH#78)
basic_record_ostreamto make it possible to overload stream output operators for pointers to user-defined types. User-defined
std::basic_ostreamand a pointer argument should now be picked up by the compiler when the pointer is being written to one of Boost.Log streams. (GH#84)
text_file_backend::set_target_file_name_patternmethod call or "TargetFileName" sink parameter in the settings). This pattern will be used to generate a new file name when the file is finished writing and is about to be collected. Therefore, the original (active) file name can be set to a stable pattern (e.g. "app.log") so that appending to a previously written file works. Then the target file name can include a timestamp or a counter (e.g. "app-2019-01-05.log"), so that different rotated files don't conflict in the target storage.
file_collector::scan_for_files. Note that this configuration is still not fully supported and may result in premature file deletion if multiple sinks write files directly into the common target storage directory. It is recommended to configure sinks to write log files into directories different from the target storage directory.
std::allocator_traitswhere possible to work with allocators. This should improve compatibility with C++ post C++17.
file_collector::scan_for_filesthat caused zero file counter to be returned if the target directory contained a file with the maximum counter value in the name. This used to cause incorrectly named log files in the target directory after the user's application restart.
type_info_wrapper. As previously suggested, Boost.TypeIndex is recommended as a replacement.
enable_final_rotationbackend constructor parameter or similarly named method, or with the
EnableFinalRotationparameter in the settings.
BOOST_LOG_WITHOUT_IPCmacro at library build time. Thanks to Lingxi Li for the initial patch.
max_size_decor. The new decorator allows to limit the output of its adopted formatter up to the specified length. This can be useful with the new inter-process sink backend.
boost::basic_string_refand its specializations is deprecated; users are encouraged to switch to
boost::basic_string_view, which is now supported for output to the formatting streams. The support for
boost::basic_string_refwill be removed in future releases.
max_filesnamed parameter to the
add_file_logcalls or as the "MaxFiles" parameter for the sink in the settings file. Thanks to Erich Keane for the patch. (#8746)
BOOST_LOG_USE_WINNT6_APIis no longer used by the library. The target Windows version should be configured by defining macro
BOOST_USE_WINAPI_VERSIONto the desired WinAPI version (e.g. 0x0501 for Windows XP). This macro is used in multiple different Boost libraries besides Boost.Log.
unbounded_fifo_queuepolicy. The updated queue has improved performance in case of heavy thread contention (hundreds and thousands of logging threads) on POSIX-compatible systems.
wchar_ttype is disabled. Added a note of discouragement to the configuration section. (#11541)
boost_log_setuplibrary on POSIX-like systems.
invalid_typeexceptions thrown by the library now have
typeindex::type_indexattached as the description of the offending type. The type was previously identified by
type_info_infoerror information now contains
type_info_wrapper. This is the error info that can be used to obtain the type info from
type_info_wrapper. If the
attribute_valueobject is empty, the returned
type_indexis default-constructed (i.e. refers to the
voidtype). User-defined attribute value implementations should be similarly changed (the
attribute_value::impl::get_type()virtual method now also returns
type_info_wrappercomponent has been deprecated and will be removed in future releases. Boost.TypeIndex is recommended as a replacement.
attribute_value_setconstructor in some cases. The inserted elements could have made some previously inserted elements not findable. The constructor from
attribute_sets could leave some of the attribute values acquired from attributes not findable. (#11190)
attribute_set::insert()in some cases. The inserted elements could have made some previously inserted elements not findable. (#11106)
attribute_value_set::size()if a large number of attribute values are inserted into the set. (#11148)
record_view. The operators behave the same way as the similar operators of
attribute_value_set(i.e. return an
attribute_valueidentified by the name).
depthnamed parameter. (#9123)
boost/log/support/std_regex.hppis included, one can use
std::regexexpressions with string matching filters.
BOOST_LOG_USE_BOOST_XPRESSIVEat Boost.Log build time the user can select which regex implementation will be used by the library internally for the string matching filters parsed from strings and settings. Note that this selection does not affect string matching filters in expressions.
dumpmanipulator output on AVX2-enabled CPUs (e.g. Intel Haswell).
get_attributemethod of loggers.
locked_backend()function implementation of synchronous and asynchronous sink frontends.
block_on_overflowstrategy was used.
add_valuemanipulator produce garbage attribute values when using with immediate integer constants. (#9320)
BOOST_LOG_WITHOUT_DEFAULT_FACTORIES. By defining this macro the user can disable compilation of the default filter and formatter factories used by settings parsers. This can substantially reduce binary sizes while still retaining support for settings parsers. Note that when this macro is defined the user will have to register all attributes in the library.
boost/log/utility/intrusive_ref_counter.hppis deprecated and will be removed in future releases. Its contents have been reworked and moved to Boost.SmartPtr, as
boost/log/utility/explicit_operator_bool.hppis deprecated and will be removed in future releases. Its contents have been moved to Boost.Utility, as
boost/log/utility/empty_deleter.hppis deprecated and will be removed in future releases. Its contents have been moved to Boost.Utility, as
timerattribute generating incorrect time readings on Windows on heavy thread contention when
QueryPerformanceCounterAPI was used.
basic_formatting_ostreamno longer derives from
std::basic_ostream, but rather reimplements its and its base classes interface closely. This solves problems with overloading
basic_formatting_ostreamand user-defined types. This will break user's code if it relied on the inheritance from the standard stream types (such as passing
basic_formatting_ostreamobject as an argument to a function receiving
std::basic_ostream). Please, use the
stream()member function to access the standard stream. This change will not break the code that outputs user-defined types to a
basic_formatting_ostreamstream while there are only
operator<<overloads for the standard stream types - the code will compile and use the standard operator overloads, as before.
BOOST_LOG_USE_COMPILER_TLSconfiguration macro is defined.
add_valuemanipulator with MSVC.
dumpoutput manipulator for printing binary data.
BOOST_LOG_NO_COMPILER_TLSconfiguration macro has been replaced with
BOOST_LOG_USE_COMPILER_TLSwith the opposite meaning. The support for compiler intrinsics for TLS is now disabled by default.
BOOST_LOG_NO_SETTINGS_PARSERS_SUPPORTmacro renamed to
BOOST_LOG_WITHOUT_SETTINGS_PARSERS. The new macros allow to selectively disable support for the corresponding sink backends.
BOOST_LOG_USE_WINNT6_APImacro. The code compiled without the macro defined will still be able run on NT5, but when run on NT6 it will be more efficient. With the macro defined the resulting code will not run on NT5, but will be a little more efficient on NT6 than without the macro.
record_views. Records are now moved from when pushed to the core for further processing. This is done in order to eliminate the possibility of unsafe record modification after pushing to the core. As a consequence, log records can no longer be copied, only moving is allowed. Record views can be copied and moved; copying is a shallow operation.
to_logmanipulator allows to customize formatting for particular types and attributes without changing the regular streaming operator. Also, the
add_valuemanipulator can be used in logging expressions to attach attribute values to the record.
attribute_valueclass in various components of the library is no longer pointed to with
shared_ptrs but instead is handled by value. This allowed to simplify attribute value handling in simple cases.
attributebase class, which holds the reference to the implementation. All attributes now have to be created by value rather than wrapped into
shared_ptrby user, which makes the code more concise.
attributeto the actual attribute type. This can be useful when the concrete attribute factory provides additional interfaces.
getmethod. Use the
extractfunction as a replacement.
attribute_name. It is constructible from strings, so in most cases users won't need to change the code. See here for more information.
attributesdirectory. The header
utilityhas been replaced with headers
attributesdirectory. The two new headers define the revised API of attribute value extraction and visitation, respectively. See here for more details.
current_thread_idattribute no longer uses
boost::thread::idtype for thread identification. An internal type is used instead, the type is accessible as
current_thread_id::value_type. The new thread ids are taken from the underlying OS API and thus more closely correlate to what may be displayed by debuggers and system diagnostic tools.
current_process_nameattribute. The attribute generates a string with the executable name of the current process.
functorattribute has been renamed to
function. The generator function has been renamed from
make_function. The header has been renamed from
BOOST_LOG_INLINE_GLOBAL_LOGGER_CTOR_ARGS). Also, the macros no longer define the
get_loggerfree function for logger acquisition. Use
logger::getinstead. See here for more information.
BOOST_LOG_STREAM_CHANNEL_SEV(as well as their shorthands
BOOST_LOG_CHANNEL_SEV) macros that allow to specify channel name for the log record.
basic_formatting_sink_backendclass template, which indicates to the frontend that record formatting is required. This breaks user-side API of the library: the formatter and locale has to be set to the frontend rather than backend.
asynchronous_sinkclass template now allows to specify record queueing strategy. Several strategies provided, including
unbounded_fifo_queue(the default) and
unbounded_ordering_queuewhich cover the functionality of asynchronous sink frontends in 1.x releases. See the asynchronous sink frontend docs for more details.
Appendconfiguration file parameter for text file sinks. If this parameter is set to
true, the sink will append log records to the existing log file instead of overwriting it.
Filters and formatters:
basic_formatter. Both new types implement type erasure and provide function calling operators to invoke the stored filter or formatter.
expressionsnamespace. Attribute placeholders are now interoperable with other template expressions based on Boost.Phoenix. All template expression headers now reside in the
BOOST_LOG_ATTRIBUTE_KEYWORDmacro). Keywords can be used in template expressions instead of attribute placeholders and also as a key in container lookups.
falsein such cases, the formatter will result in empty string instead of the value. The behavior can be changed by calling
or_throwmember functions on the attribute value placeholder in the filtering/formatting expression.
csv_decor. The generic character decorator is named
push_recordif a sink throws and the exception is suppressed by the exception handler set in the core.
type_visitorinstance by value, and the visitor is no longer a base for the actual receiver of the dispatched value. Instead, the visitor now refers to the receiver, if one is capable to consume the value. The
visitmethod has been renamed to
operator (). The static type dispatcher now requires a reference to the receiver on construction, it doesn't imply that the receiver derives from the dispatcher anymore.
slim_stringutility has been removed. There is no replacement.
This release mostly fixes bugs in the code and documentation.
This release mostly fixes bugs in the code and documentation. The next major release (2.0) will contain breaking changes and feature additions. The 1.0 branch will not receive any feature updates.
BOOST_LOG_NO_COMPILER_TLSduring the library build process. The macro also affects other platforms, which may be useful if your compiler does not support TLS.
rotation_intervalkeyword is no longer available. The same functionality is achieved with the new
time_based_rotationkeyword and the
rotation_at_time_intervalpredicate. See here for more details.
supportdirectory. Top level library headers now mostly include nested headers.
keywordsnamespace. There are no longer nested
attributes, etc. All keywords have been extracted into separate headers in the
init_log_to_filenow accept more customization options as named arguments.
No one really remembers these dark ages...