$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: john.groups_at_[hidden]
Date: 2007-11-05 20:46:40
Author: jtorjo
Date: 2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
New Revision: 40823
URL: http://svn.boost.org/trac/boost/changeset/40823
Log:
[logging]
v0.10.10, 6 nov 2007
- added and tested thread-safety (ts_write/on_dedicated_thread) for logger_format_write<>
- added 2 more scenarios: ts_loger_one_filter.cpp and ded_loger_one_filter.cpp
Added:
   sandbox/logging/boost/logging/format_ts.hpp   (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp   (contents, props changed)
   sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp   (contents, props changed)
Properties modified: 
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/   (props changed)
   sandbox/logging/lib/logging/tests/test_simple_tss/   (props changed)
Text files modified: 
   sandbox/logging/boost/logging/detail/forward_constructor.hpp             |     6 +                                       
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp               |     4 +                                       
   sandbox/logging/boost/logging/detail/use_format_write.hpp                |   123 ++++++++++++++++++++++++++++----------- 
   sandbox/logging/boost/logging/format/formatter/thread_id.hpp             |     2                                         
   sandbox/logging/boost/logging/format_all.hpp                             |     1                                         
   sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp             |    88 +++++++++++++++------------             
   sandbox/logging/boost/logging/writer/ts_write.hpp                        |    19 ++---                                   
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj    |    29 +++++++++                               
   sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp        |     4                                         
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp  |     1                                         
   sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp  |     1                                         
   sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp |     1                                         
   sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp   |     1                                         
   sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp   |     1                                         
   14 files changed, 194 insertions(+), 87 deletions(-)
Modified: sandbox/logging/boost/logging/detail/forward_constructor.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/forward_constructor.hpp	(original)
+++ sandbox/logging/boost/logging/detail/forward_constructor.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -40,6 +40,12 @@
         template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(a1,a2,a3,a4) {} \
         template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(a1,a2,a3,a4,a5) {}
 
+#define BOOST_LOGGING_FORWARD_CONSTRUCTOR_INIT(class_name,forward_to,init) \
+        template<class p1> class_name(const p1 & a1 ) : forward_to(a1) { init(); } \
+        template<class p1, class p2> class_name(const p1 & a1 , const p2 & a2) : forward_to(a1,a2) { init(); } \
+        template<class p1, class p2, class p3> class_name(const p1 & a1 , const p2 & a2, const p3 & a3) : forward_to(a1,a2,a3) { init(); } \
+        template<class p1, class p2, class p3, class p4> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4) : forward_to(a1,a2,a3,a4) { init(); } \
+        template<class p1, class p2, class p3, class p4, class p5> class_name(const p1 & a1 , const p2 & a2, const p3 & a3, const p4 & a4, const p5 & a5) : forward_to(a1,a2,a3,a4,a5) { init(); }
 
 
 #ifdef BOOST_MSVC
Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp	(original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -1,6 +1,10 @@
 /** 
 @page page_changelog Changelog
 
+v0.10.10, 6 nov 2007
+- added and tested thread-safety (ts_write/on_dedicated_thread) for logger_format_write<>
+- added 2 more scenarios: ts_loger_one_filter.cpp and ded_loger_one_filter.cpp
+
 v0.10.9, 3 nov 2007
 - added virtual destructor for logger<gather,default_> - many thanks Martin Baeker!
 - added TSS tests 
Modified: sandbox/logging/boost/logging/detail/use_format_write.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/use_format_write.hpp	(original)
+++ sandbox/logging/boost/logging/detail/use_format_write.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -29,9 +29,30 @@
 #include <boost/logging/process_msg/ostream_like.hpp>
 #include <boost/logging/detail/manipulator.hpp>
 #include <boost/logging/detail/find_gather.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
 
 namespace boost { namespace logging {
 
+namespace writer {
+    template<class msg_type, class base_type> struct on_dedicated_thread ;
+    template<class base_type> struct ts_write ;
+
+    /** 
+        @brief specify thread-safety of your logger_format_write class
+    */
+    namespace threading {
+        /** @brief not thread-safe */
+        struct no_ts {};
+        /** @brief thread-safe write. All writes are protected by a lock */
+        struct ts_write {};
+        /** @brief thread-safe write on a dedicated thread. Very efficient. Formatting & writing to destinations happens on the dedicated thread */
+        struct on_dedicated_thread {};
+    }
+}
+
+
+
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // specialize logger for format_write class
     //
@@ -50,36 +71,38 @@
             typedef typename boost::logging::format_and_write::use_cache<formatter_base, destination_base, cache_string> apply_format_and_write ;
             typedef typename msg_route::with_route<formatter_base, destination_base> router_type;
         };
-    }
 
-/** 
-_at_brief Makes it easier to use a logger with format_write class
+        template<class thread_safety, class gather_type, class format_write> struct find_writer_with_thread_safety {
+#ifdef BOOST_HAS_THREADS
+            // use ts_write
+            typedef writer::ts_write<format_write> type;
+#else
+            typedef format_write type;
+#endif
+        };
 
-You just define your <tt>logger<...> </tt> class like this:
+        template<class gather_type, class format_write> struct find_writer_with_thread_safety<boost::logging::writer::threading::no_ts,gather_type,format_write> {
+            typedef format_write type;
+        };
 
-_at_code
-typedef logger< use_format_write<format_base,destination_base> logger_type;
-_at_endcode
+        template<class gather_type, class format_write> struct find_writer_with_thread_safety<boost::logging::writer::threading::ts_write,gather_type,format_write> {
+            typedef writer::ts_write<format_write> type;
+        };
 
-instead of
+        template<class gather_type, class format_write> struct find_writer_with_thread_safety<boost::logging::writer::threading::on_dedicated_thread,gather_type,format_write> {
+            typedef typename gather_type::param param;
+            typedef typename boost::remove_reference<param>::type param_no_ref;
+            typedef typename boost::remove_const<param_no_ref>::type msg_type;
+    
+            typedef writer::on_dedicated_thread<msg_type, format_write> type;
+        };
+    }
 
-_at_code
-typedef logger< process_msg< 
-        gather::ostream_like::return_str<>, 
-        writer::format_write<formatter_base,destination_base> > > logger_type;
-_at_endcode
 
-FIXME need to have more template params
 
-_at_param format_base_type your formatter base class
-_at_param destination_base your destination base class
-_at_param thread_safety
-_at_param gather
-*/
 template<
             class format_base_type , 
             class destination_base_type ,
-            class thread_safety ,
             class gather 
     >
 struct use_format_write {
@@ -95,26 +118,58 @@
 };
 
 
+/** 
+@brief Makes it easier to use a logger with format_write class
+
+You just define your <tt>logger<...> </tt> class like this:
+
+@code
+typedef logger_format_write<format_base,destination_base> logger_type;
+@endcode
+
+instead of
+
+@code
+typedef logger_format_write< 
+        gather::ostream_like::return_str<>, 
+        writer::format_write<formatter_base,destination_base> > > logger_type;
+@endcode
+
+FIXME need to have more template params
+
+@param format_base_type your formatter base class
+@param destination_base your destination base class
+@param thread_safety
+@param gather
+*/
 template<class format_base, class destination_base, class thread_safety, class gather> 
 struct logger_format_write
     : logger< 
-            typename use_format_write<format_base, destination_base, thread_safety, gather>::gather_type,
-            writer::format_write<
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::format_base,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::destination_base,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::apply_format_and_write,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::router_type
-            > 
+            typename use_format_write<format_base, destination_base, gather>::gather_type,
+            typename detail::find_writer_with_thread_safety<
+                thread_safety,
+                typename use_format_write<format_base, destination_base, gather>::gather_type,
+                writer::format_write<
+                    typename use_format_write<format_base, destination_base, gather>::format_base,
+                    typename use_format_write<format_base, destination_base, gather>::destination_base,
+                    typename use_format_write<format_base, destination_base, gather>::apply_format_and_write,
+                    typename use_format_write<format_base, destination_base, gather>::router_type
+                > 
+            >::type
     >
 {
     typedef logger< 
-            typename use_format_write<format_base, destination_base, thread_safety, gather>::gather_type,
-            writer::format_write<
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::format_base,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::destination_base,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::apply_format_and_write,
-                typename use_format_write<format_base, destination_base, thread_safety, gather>::router_type
-            > 
+            typename use_format_write<format_base, destination_base, gather>::gather_type,
+            typename detail::find_writer_with_thread_safety<
+                thread_safety,
+                typename use_format_write<format_base, destination_base, gather>::gather_type,
+                writer::format_write<
+                    typename use_format_write<format_base, destination_base, gather>::format_base,
+                    typename use_format_write<format_base, destination_base, gather>::destination_base,
+                    typename use_format_write<format_base, destination_base, gather>::apply_format_and_write,
+                    typename use_format_write<format_base, destination_base, gather>::router_type
+                > 
+            >::type
     >
      logger_base_type;
 
Modified: sandbox/logging/boost/logging/format/formatter/thread_id.hpp
==============================================================================
--- sandbox/logging/boost/logging/format/formatter/thread_id.hpp	(original)
+++ sandbox/logging/boost/logging/format/formatter/thread_id.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -22,7 +22,7 @@
 #endif
 
 #include <boost/logging/detail/fwd.hpp>
-#include <boost/logging/formatter/convert_format.hpp>
+#include <boost/logging/format/formatter/convert_format.hpp>
 #include <boost/logging/detail/manipulator.hpp> // is_generic
 #include <sstream>
 
Modified: sandbox/logging/boost/logging/format_all.hpp
==============================================================================
--- sandbox/logging/boost/logging/format_all.hpp	(original)
+++ sandbox/logging/boost/logging/format_all.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -28,6 +28,7 @@
 #include <boost/logging/format/destination/file.hpp>
 #include <boost/logging/format/destination/rolling_file.hpp>
 
+
 // not tested yet
 //#include <boost/logging/format/destination/shared_memory.hpp>
 
Added: sandbox/logging/boost/logging/format_ts.hpp
==============================================================================
--- (empty file)
+++ sandbox/logging/boost/logging/format_ts.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -0,0 +1,43 @@
+// format_ts.hpp
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+#ifndef JT28092007_format_ts_HPP_DEFINED
+#define JT28092007_format_ts_HPP_DEFINED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/logging/format.hpp>
+
+#include <boost/logging/writer/ts_write.hpp>
+#include <boost/logging/writer/on_dedicated_thread.hpp>
+
+namespace boost { namespace logging {
+
+/** 
+@file boost/logging/format_ts.hpp
+
+Include this file when you're using @ref manipulator "formatters and destinations",
+and you want to define the logger classes, in a source file
+(using BOOST_DEFINE_LOG) and you've decided to use some form of thread-safety
+
+*/
+
+}}
+
+
+#endif
+
Modified: sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp
==============================================================================
--- sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp	(original)
+++ sandbox/logging/boost/logging/writer/on_dedicated_thread.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -32,8 +32,8 @@
 namespace boost { namespace logging { namespace writer {
 
 namespace detail {
-    template<class msg_type> struct dedicated_context {
-        dedicated_context() : is_working(true), write_period_ms(100) {}
+    template<class msg_type> struct dedicated_thread_context {
+        dedicated_thread_context() : is_working(true), write_period_ms(100) {}
 
         bool is_working;
         int write_period_ms;
@@ -41,7 +41,8 @@
         boost::logging::threading::mutex cs;
 
         // the thread doing the write
-        boost::shared_ptr<boost::thread> writer;
+        typedef boost::shared_ptr<boost::thread> thread_ptr;
+        thread_ptr writer;
 
         // ... so that reallocations are fast
         typedef boost::shared_ptr<msg_type> ptr;
@@ -67,77 +68,81 @@
 typedef gather::ostream_like::return_str<> string;
 
 // not thread-safe
-process_msg< string, write_to_cout> g_l;
+logger< string, write_to_cout> g_l;
 
 // thread-safe, on dedicated thread
-process_msg< string, on_dedicated_thread<string,write_to_cout> > g_l;
+logger< string, on_dedicated_thread<string,write_to_cout> > g_l;
 
 
 // not thread-safe
-process_msg< 
+logger< 
     string , 
-    format_write< 
-        format_base, 
-        destination_base, format_and_write::simple<string> > > g_l;
+    format_write<format_base, destination_base> > g_l;
 
 // thread-safe, on dedicated thread
-process_msg< 
+logger< 
     string , 
-    on_dedicated_thread<string, format_write< 
-        format_base, 
-        destination_base, format_and_write::simple<string> > > > g_l;
+    on_dedicated_thread<string, format_write< format_base, destination_base> > > g_l;
 @endcode
 
 */
 template<class msg_type, class base_type> 
 struct on_dedicated_thread 
         : base_type, 
-          boost::logging::manipulator::non_const_context<detail::dedicated_context<msg_type> > {
+          boost::logging::manipulator::non_const_context<detail::dedicated_thread_context<msg_type> > {
 
     typedef on_dedicated_thread<msg_type,base_type> self_type;
-    typedef detail::dedicated_context<msg_type> context_type;
+    typedef typename detail::dedicated_thread_context<msg_type> context_type;
+    typedef typename boost::logging::manipulator::non_const_context<detail::dedicated_thread_context<msg_type> > non_const_context_base;
 
     typedef boost::logging::threading::mutex::scoped_lock scoped_lock;
 
     on_dedicated_thread() {}
     BOOST_LOGGING_FORWARD_CONSTRUCTOR(on_dedicated_thread,base_type)
 
-    void write_period(int period_ms) {
-        scoped_lock lk( context_type::context().cs);
-        context_type::context().write_period_ms = period_ms;
+    /** 
+        @brief Sets the write period : on the dedicated thread (in milliseconds)
+    */
+    void write_period_ms(int period_ms) {
+        scoped_lock lk( non_const_context_base::context().cs);
+        non_const_context_base::context().write_period_ms = period_ms;
     }
 
     ~on_dedicated_thread() {
         boost::shared_ptr<boost::thread> writer;
-        { scoped_lock lk( context_type::context().cs);
-          context_type::context().is_working = false;
-          writer = context_type::context().writer;
+        { scoped_lock lk( non_const_context_base::context().cs);
+          non_const_context_base::context().is_working = false;
+          writer = non_const_context_base::context().writer;
         }
 
         if ( writer)
             writer->join();
+
+        // write last messages, if any
+        write_array();
     }
 
-    void operator()(const msg_type & msg) {
+    void operator()(const msg_type & msg) const {
         typedef typename context_type::ptr ptr;
+        typedef typename context_type::thread_ptr thread_ptr;
         ptr new_msg(new msg_type(msg));
 
-        scoped_lock lk( context_type::context().cs);
-        if ( !context_type::context().writer) 
-            context_type::context().writer = ptr( new boost::thread( boost::bind(&self_type::do_write,this) ));
+        scoped_lock lk( non_const_context_base::context().cs);
+        if ( !non_const_context_base::context().writer) 
+            non_const_context_base::context().writer = thread_ptr( new boost::thread( boost::bind(&self_type::do_write,this) ));
 
-        context_type::context().msgs.push_back(new_msg);
+        non_const_context_base::context().msgs.push_back(new_msg);
     }
 private:
-    void do_write() {
+    void do_write() const {
         const int NANOSECONDS_PER_SECOND = 1000 * 1000 * 1000;
 
         int sleep_ms = 0;
         while ( true) {
-            { scoped_lock lk( context_type::context().cs);
+            { scoped_lock lk( non_const_context_base::context().cs);
               // refresh it - just in case it got changed...
-              sleep_ms = context_type::context().write_period_ms;
-              if ( !context_type::context().is_working)
+              sleep_ms = non_const_context_base::context().write_period_ms;
+              if ( !non_const_context_base::context().is_working)
                   break; // we've been destroyed
             }
 
@@ -149,17 +154,22 @@
             to_wait.nsec %= NANOSECONDS_PER_SECOND ;
             boost::thread::sleep( to_wait);
 
-            typedef typename context_type::array array;
-            array msgs;
-            { scoped_lock lk( context_type::context().cs);
-              std::swap( context_type::context().msgs, msgs);
-              // reserve elements - so that we don't get automatically resized often
-              context_type::context().msgs.reserve( msgs.size() );
-            }
+            write_array();
+        }
+    }
+
+    void write_array() const {
+        typedef typename context_type::array array;
 
-            for ( typename array::iterator b = msgs.begin(), e = msgs.end(); b != e; ++b)
-                base_type::operator()(*(b->get()));
+        array msgs;
+        { scoped_lock lk( non_const_context_base::context().cs);
+          std::swap( non_const_context_base::context().msgs, msgs);
+          // reserve elements - so that we don't get automatically resized often
+          non_const_context_base::context().msgs.reserve( msgs.size() );
         }
+
+        for ( typename array::iterator b = msgs.begin(), e = msgs.end(); b != e; ++b)
+            base_type::operator()(*(b->get()));
     }
 };
 
Modified: sandbox/logging/boost/logging/writer/ts_write.hpp
==============================================================================
--- sandbox/logging/boost/logging/writer/ts_write.hpp	(original)
+++ sandbox/logging/boost/logging/writer/ts_write.hpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -34,7 +34,7 @@
     }
 
 /** 
-<tt>\#include <boost/logging/writer/ts_write.hpp> </tt>
+<tt>\#include <boost/logging/writer/on_dedicated_thread.hpp> </tt>
 
 Performs all writes in a thread-safe manner.
 In other words, makes sure that all operator() calls of base_type are called in a thread-safe manner.
@@ -45,25 +45,21 @@
 
 @code
 // not thread-safe
-process_msg< gather::ostream_like::return_str<>, write_to_cout> g_l;
+logger< gather::ostream_like::return_str<>, write_to_cout> g_l;
 
 // thread-safe
-process_msg< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l;
+logger< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l;
 
 
 // not thread-safe
-process_msg< 
+logger< 
     gather::ostream_like::return_cache_str<> , 
-    format_write< 
-        format_base, 
-        destination_base, format_and_write::simple<cache_string> > > g_l;
+    format_write< format_base, destination_base> > g_l;
 
 // thread-safe
-process_msg< 
+logger< 
     gather::ostream_like::return_cache_str<> , 
-    ts_write< format_write< 
-        format_base, 
-        destination_base, format_and_write::simple<cache_string> > > > g_l;
+    ts_write< format_write< format_base, destination_base > > > g_l;
 @endcode
 
 Depending on your scenario, you could prefer on_dedicated_thread class.
@@ -73,6 +69,7 @@
     template<class base_type> struct ts_write : base_type, ::boost::logging::manipulator::non_const_context<detail::ts_write_context> {
         typedef ::boost::logging::manipulator::non_const_context<detail::ts_write_context> non_const_context_base;
 
+        ts_write() {}
         BOOST_LOGGING_FORWARD_CONSTRUCTOR(ts_write,base_type)
 
         template<class msg_type> void operator()(msg_type msg) const {
Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj	(original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -212,6 +212,7 @@
                         <Tool
                                 Name="VCLinkerTool"
                                 LinkIncremental="2"
+				AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\thread\build\libboost_thread.lib\vc-8_0\debug\threading-multi"
                                 GenerateDebugInformation="true"
                                 SubSystem="1"
                                 TargetMachine="1"
@@ -692,6 +693,10 @@
 					>
                                 </File>
                                 <File
+					RelativePath="..\..\..\..\..\boost\logging\format_ts.hpp"
+					>
+				</File>
+				<File
                                         RelativePath="..\..\..\..\..\boost\logging\detail\format_write_detail.hpp"
 					>
                                 </File>
@@ -893,10 +898,23 @@
                                 </FileConfiguration>
                         </File>
                         <File
+				RelativePath="..\..\..\samples\scenarios\ded_loger_one_filter.cpp"
+				>
+				<FileConfiguration
+					Name="Test|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
                                 RelativePath="..\..\..\samples\scenarios\fastest_no_ostr_like.cpp"
 				>
                                 <FileConfiguration
                                         Name="Test|Win32"
+					ExcludedFromBuild="true"
 					>
                                         <Tool
                                                 Name="VCCLCompilerTool"
@@ -975,6 +993,17 @@
                                         />
                                 </FileConfiguration>
                         </File>
+			<File
+				RelativePath="..\..\..\samples\scenarios\ts_loger_one_filter.cpp"
+				>
+				<FileConfiguration
+					Name="Test|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
                 </Filter>
         </Files>
         <Globals>
Modified: sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/custom_fmt_dest.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -82,9 +82,10 @@
 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
 
 #include <boost/logging/format.hpp>
+using namespace boost::logging;
 
 // Step 3 : Specify your logging class(es)
-typedef boost::logging::logger_format_write< > log_type;
+typedef logger_format_write< default_, default_, writer::threading::no_ts > log_type;
 
 
 // Step 4: declare which filters and loggers you'll use (usually in a header file)
@@ -99,7 +100,6 @@
 BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
 
 
-using namespace boost::logging;
 
 // Example of custom formatter:
 // dump the no. of seconds since start of program
Added: sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/ded_loger_one_filter.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -0,0 +1,154 @@
+// ded_loger_one_filter.cpp
+//
+// A test of the Logging library with one logger and one filter. The logger is thread-safe, writing on a dedicated thread.
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example ded_loger_one_filter.cpp
+
+@copydoc ded_loger_one_filter
+
+@page ded_loger_one_filter ded_loger_one_filter.cpp Example
+
+
+This usage:
+- You have one @b thread-safe logger - the logging is done @ref boost::logging::writer::on_dedicated_thread "on a dedicated thread"
+- You have one filter, which is always turned on
+- You want to format the message before it's written 
+- The logger has several log destinations
+    - The output goes debug output window, and a file called out.txt
+    - Formatting - prefix each message by time, its index, and append enter
+
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
+
+In this example, all output will be written to the console, debug window, and "out.txt" file.
+It will look similar to:
+
+@code
+...
+30:33 [10] message 1
+30:33 [11] message 2
+30:33 [12] message 2
+30:33 [13] message 2
+30:33 [14] message 2
+30:33 [15] message 3
+30:33 [16] message 2
+30:33 [17] message 3
+30:33 [18] message 3
+30:33 [19] message 4
+30:33 [20] message 3
+30:33 [21] message 3
+30:33 [22] message 4
+30:33 [23] message 4
+30:33 [24] message 4
+30:33 [25] message 4
+30:33 [26] message 5
+30:33 [27] message 5
+30:33 [28] message 6
+30:33 [29] message 6
+30:33 [30] message 5
+30:33 [31] message 5
+30:33 [32] message 5
+30:33 [33] message 6
+30:33 [34] message 7
+...
+@endcode
+
+*/
+
+
+
+#define BOOST_LOG_COMPILE_FAST_OFF
+#include <boost/logging/format_fwd.hpp>
+// Step 1: Optimize : use a cache string, to make formatting the message faster
+BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
+
+#include <boost/logging/format_ts.hpp>
+#include <boost/logging/format/formatter/thread_id.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/xtime.hpp>
+
+using namespace boost::logging;
+
+// Step 3 : Specify your logging class(es)
+//          In our case, we're also writing on a dedidcated thread
+typedef logger_format_write< default_, default_, writer::threading::on_dedicated_thread > log_type;
+
+
+// Step 4: declare which filters and loggers you'll use (usually in a header file)
+BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DECLARE_LOG(g_l, log_type) 
+
+// Step 5: define the macros through which you'll log
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) 
+
+// Step 6: Define the filters and loggers you'll use (usually in a source file)
+BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DEFINE_LOG(g_l, log_type)
+
+void do_sleep(int ms) {
+    using namespace boost;
+    xtime next;
+    xtime_get( &next, TIME_UTC);
+    next.nsec += (ms % 1000) * 1000000;
+
+    int nano_per_sec = 1000000000;
+    next.sec += next.nsec / nano_per_sec;
+    next.sec += ms / 1000;
+    next.nsec %= nano_per_sec;
+    thread::sleep( next);
+}
+
+void use_log_thread() {
+    // Step 8: use it...
+    for ( int i = 0; i < 20; ++i) {
+        L_ << "message " << i ;
+        do_sleep(1);
+    }
+
+    // Step 9 : Enjoy!
+}
+
+void ts_logger_one_filter_example() {
+    // Step 7: add formatters and destinations
+    //         That is, how the message is to be formatted and where should it be written to
+
+    g_l->writer().add_formatter( formatter::idx() );
+    g_l->writer().add_formatter( formatter::time("$mm:$ss ") );
+    g_l->writer().add_formatter( formatter::append_newline() );
+    g_l->writer().add_destination( destination::file("out.txt") );
+    g_l->writer().add_destination( destination::dbg_window() );
+
+    for ( int i = 0 ; i < 5; ++i)
+        boost::thread t( &use_log_thread);
+
+    // allow for all threads to finish
+    do_sleep( 5000);
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+    ts_logger_one_filter_example();
+}
+
+#endif
+
+// End of file
+
Modified: sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_mul_logers.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -84,6 +84,7 @@
 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
 
 #include <boost/logging/format.hpp>
+#include <boost/logging/writer/ts_write.hpp>
 
 // Step 3 : Specify your logging class(es)
 typedef boost::logging::logger_format_write< > log_type;
Modified: sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_levels_one_logger.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -48,6 +48,7 @@
 
 #define BOOST_LOG_COMPILE_FAST_OFF
 #include <boost/logging/format.hpp>
+#include <boost/logging/writer/ts_write.hpp>
 
 using namespace boost::logging;
 // Step 3 : Specify your logging class(es)
Modified: sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/mul_loggers_one_filter.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -83,6 +83,7 @@
 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
 
 #include <boost/logging/format.hpp>
+#include <boost/logging/writer/ts_write.hpp>
 using namespace boost::logging;
 
 // Step 3 : Specify your logging class(es)
Modified: sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/no_levels_with_route.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -76,6 +76,7 @@
 BOOST_LOG_FORMAT_MSG( optimize::cache_string_several_str<> )
 
 #include <boost/logging/format.hpp>
+#include <boost/logging/writer/ts_write.hpp>
 
 using namespace boost::logging;
 
Modified: sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp
==============================================================================
--- sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp	(original)
+++ sandbox/logging/lib/logging/samples/scenarios/one_loger_one_filter.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -56,6 +56,7 @@
 BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
 
 #include <boost/logging/format.hpp>
+#include <boost/logging/writer/ts_write.hpp>
 
 using namespace boost::logging;
 
Added: sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp
==============================================================================
--- (empty file)
+++ sandbox/logging/lib/logging/samples/scenarios/ts_loger_one_filter.cpp	2007-11-05 20:46:38 EST (Mon, 05 Nov 2007)
@@ -0,0 +1,147 @@
+// ts_loger_one_filter.cpp
+//
+// A test of the Logging library with one logger and one filter. The logger is thread-safe
+
+// Boost Logging library
+//
+// Author: John Torjo, www.torjo.com
+//
+// Copyright (C) 2007 John Torjo (see www.torjo.com for email)
+//
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org for updates, documentation, and revision history.
+// See http://www.torjo.com/log2/ for more details
+
+
+/**
+@example ts_loger_one_filter.cpp
+
+@copydoc ts_loger_one_filter
+
+@page ts_loger_one_filter ts_loger_one_filter.cpp Example
+
+
+This usage:
+- You have one @b thread-safe logger
+- You have one filter, which is always turned on
+- You want to format the message before it's written 
+- The logger has several log destinations
+    - The output goes to console, debug output window, and a file called out.txt
+    - Formatting - prefix each message by its index, thread id, and append enter
+
+Optimizations:
+- use a cache string (from optimize namespace), in order to make formatting the message faster
+
+In this example, all output will be written to the console, debug window, and "out.txt" file.
+It will look similar to:
+
+@code
+[T5884] [1] message 0
+[T7168] [2] message 0
+[T7932] [3] message 0
+[T740] [4] message 0
+[T8124] [5] message 0
+[T5884] [6] message 1
+[T5884] [7] message 2
+[T740] [8] message 1
+[T7168] [9] message 1
+[T7932] [10] message 1
+[T8124] [11] message 1
+[T5884] [12] message 3
+[T7168] [13] message 2
+[T5884] [14] message 4
+[T740] [15] message 2
+[T7932] [16] message 2
+[T8124] [17] message 2
+[T7168] [18] message 3
+[T5884] [19] message 5
+...
+@endcode
+
+*/
+
+
+
+#define BOOST_LOG_COMPILE_FAST_OFF
+#include <boost/logging/format_fwd.hpp>
+// Step 1: Optimize : use a cache string, to make formatting the message faster
+BOOST_LOG_FORMAT_MSG( optimize::cache_string_one_str<> )
+
+#include <boost/logging/format_ts.hpp>
+#include <boost/logging/format/formatter/thread_id.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/xtime.hpp>
+
+using namespace boost::logging;
+
+// Step 3 : Specify your logging class(es)
+typedef logger_format_write< default_, default_, writer::threading::ts_write > log_type;
+
+
+// Step 4: declare which filters and loggers you'll use (usually in a header file)
+BOOST_DECLARE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DECLARE_LOG(g_l, log_type) 
+
+// Step 5: define the macros through which you'll log
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l, g_log_filter->is_enabled() ) 
+
+// Step 6: Define the filters and loggers you'll use (usually in a source file)
+BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts ) 
+BOOST_DEFINE_LOG(g_l, log_type)
+
+void do_sleep(int ms) {
+    using namespace boost;
+    xtime next;
+    xtime_get( &next, TIME_UTC);
+    next.nsec += (ms % 1000) * 1000000;
+
+    int nano_per_sec = 1000000000;
+    next.sec += next.nsec / nano_per_sec;
+    next.sec += ms / 1000;
+    next.nsec %= nano_per_sec;
+    thread::sleep( next);
+}
+
+void use_log_thread() {
+    // Step 8: use it...
+    for ( int i = 0; i < 50; ++i) {
+        L_ << "message " << i ;
+        do_sleep(1);
+    }
+
+    // Step 9 : Enjoy!
+}
+
+void ts_logger_one_filter_example() {
+    // Step 7: add formatters and destinations
+    //         That is, how the message is to be formatted and where should it be written to
+
+    g_l->writer().add_formatter( formatter::idx() );
+    g_l->writer().add_formatter( formatter::thread_id() );
+    g_l->writer().add_formatter( formatter::append_newline() );
+    g_l->writer().add_destination( destination::file("out.txt") );
+    g_l->writer().add_destination( destination::cout() );
+    g_l->writer().add_destination( destination::dbg_window() );
+
+    for ( int i = 0 ; i < 5; ++i)
+        boost::thread t( &use_log_thread);
+
+    // allow for all threads to finish
+    do_sleep( 5000);
+}
+
+
+
+#ifdef SINGLE_TEST
+
+int main() {
+    ts_logger_one_filter_example();
+}
+
+#endif
+
+// End of file
+