The library has a separately compiled part which should be built as described in the Getting Started guide. One thing should be noted, though. If your application consists of more than one module (e.g. an exe and one or several dll's) that use Boost.Log, the library must be built as a shared object. If you have a single executable, you may build the library as a static library.
The library supports a number of configuration macros:
Table 1.1. Configuration macros
Macro name |
Effect |
---|---|
|
If defined in user code, the library will assume the binary is built as a dynamically loaded library ("dll" or "so"). Otherwise it is assumed that the library is built in static mode. This macro must be either defined or not defined for all translation units of user application that uses logging. This macro can help with auto-linking on platforms that support it. |
|
Same as |
|
If defined, disables multithreading support. Affects the compilation of both the library and users' code. The macro is automatically defined if no threading support is detected. |
|
If defined, enables support for narrow character logging. Affects the compilation of both the library and users' code. |
|
If defined, enables support for wide character logging. Affects the
compilation of both the library and users' code. If neither |
|
This macro is is only useful on Windows. It affects the compilation
of both the library and users' code. If defined, disables support
for the |
|
Affects only the compilation of the library. If for some reason support for the native SysLog API is not detected automatically, define this macro to forcibly enable it |
|
Affects only the compilation of the library. If defined, none of the facilities related to the parsers for settings will be built. This can substantially reduce the binary size. |
|
Affects only the compilation of users' code. If defined, some deprecated shorthand macro names will not be available. |
|
Affects the compilation of both the library and users' code. This macro is Windows-specific. If defined, the library makes use of the Windows NT 6 (Vista, Server 2008) and later APIs to generate more efficient code. This macro will also enable some experimental features of the library. Note, however, that the resulting binary will not run on Windows prior to NT 6. In order to use this feature Platform SDK 6.0 or later is required. |
|
Affects only the compilation of the library. This macro disables
support for compiler intrinsics for thread-local storage. Defining
it may solve problems if Boost.Log is used in context of delay-loaded
libraries on Windows (that is, if Boost.Log is loaded with a |
You can define configuration macros in the bjam
command line, like this:
bjam --with-log variant=release define=BOOST_LOG_USE_CHAR define=BOOST_LOG_USE_WINNT6_API stage
However, it may be more convenient to define configuration macros in the "boost/config/user.hpp" file in order to automatically define them both for the library and user's projects. If none of the options are specified, the library will try to support the most comprehensive setup, including support for all character types and features available for the platform.
The logging library uses several other Boost libraries that need building too. These are Boost.Filesystem, Boost.System, Boost.DateTime, Boost.Thread and Boost.Regex. Refer to their documentation for detailed instructions on the building procedure.
One final thing should be added. The library requires run-time type information (RTTI) to be enabled for both the library compilation and user's code compilation. Normally, this won't need anything from you except to verify that RTTI support is not disabled in your project.