Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Predefined log format selection

The select at compile time the log format from the list of the formats supplied by the Unit Test Framework

boost::unit_test::unit_test_log.set_format( boost::unit_test::output_format );

or for adding a format:

boost::unit_test::unit_test_log.add_format( boost::unit_test::output_format );
[Caution] Caution

boost::unit_test::unit_test_log_t::set_format above disables all formatters but the one provided as argument.

[Tip] Tip

See boost::unit_test::unit_test_log_t::set_format and boost::unit_test::output_format for more details

In regular circumstances you shouldn't use this interface. Prefer to use runtime parameters --log_format or --logger for predefined log format selection.

Example: Compile-time log format selection


#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>
using namespace boost::unit_test;

struct MyConfig {
  MyConfig() {
    unit_test_log.set_format( OF_XML );
  ~MyConfig() {}


BOOST_AUTO_TEST_CASE( test_case0 ) {
  BOOST_TEST( false );


> example --report_level=no
<TestLog><Error file="test.cpp" line="23">check false failed</Error></TestLog>