[Boost-bugs] [Boost C++ Libraries] #10926: Process ID insertion operator not internal filled

Subject: [Boost-bugs] [Boost C++ Libraries] #10926: Process ID insertion operator not internal filled
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-13 21:40:38


#10926: Process ID insertion operator not internal filled
---------------------------------+----------------------
 Reporter: Paul Long <plong@…> | Owner: andysem
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: log
  Version: Boost 1.57.0 | Severity: Cosmetic
 Keywords: |
---------------------------------+----------------------
 Process ID is formatted with ''leading'' 0's rather than internal 0's
 (thread ID is okay). This results in a log entry like this:

 {{{
 13:25:26.014303 DEBUG [000000x9b8/0x00000914] Gsid.cpp(302):MakeXfer >
 Start main
 }}}

 whereas it should look like this:

 {{{
 13:25:26.014303 DEBUG [0x000009b8/0x00000914] Gsid.cpp(302):MakeXfer >
 Start main
 }}}

 ...based on the following unsurprising code snippet.

 {{{
 logging::add_file_log
 (
     LogFile(),
     keywords::open_mode = std::ios::out | std::ios::app,
     keywords::filter = expr::attr<severity_level>("Severity") >=
 MinSeverity,
     keywords::rotation_size = MaxFileSize,
     keywords::max_size = MaxFileSize * MaxBackupIndex,
     keywords::format = expr::stream
         << expr::format_date_time<boost::posix_time::ptime>("TimeStamp",
 TimestampFormat())
         << " " << expr::attr<severity_level>("Severity")
         << " [" <<
 expr::attr<attrs::current_process_id::value_type>("ProcessID")
         << "/" <<
 expr::attr<attrs::current_thread_id::value_type>("ThreadID")
         << "] " << expr::format_named_scope("Scope", keywords::format =
 ScopeFormat())
         << " > " << expr::message
 );

 boost::shared_ptr<logging::core> pCore = logging::core::get();
 pCore->add_global_attribute(
     aux::default_attribute_names::timestamp(),
     attrs::local_clock());
 pCore->add_global_attribute(
     aux::default_attribute_names::process_id(),
     attrs::current_process_id());
 pCore->add_global_attribute("ProcessName",
     attrs::current_process_name());
 pCore->add_global_attribute(
     aux::default_attribute_names::thread_id(),
     attrs::current_thread_id());
 pCore->add_global_attribute("Scope", attrs::named_scope());
 }}}

 I believe the fix is to replace this line in libs/log/src/process_id.cpp:

 {{{
 io::ios_flags_saver flags_saver(strm, std::ios_base::hex |
 std::ios_base::showbase);
 }}}

 with this line:

 {{{
 io::ios_flags_saver flags_saver(strm, std::ios_base::hex |
 std::ios_base::internal | std::ios_base::showbase);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10926>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC