You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2007/12/05 22:28:41 UTC

svn commit: r601536 - in /logging/log4cxx/trunk/src/main/include/log4cxx: mdc.h ndc.h

Author: carnold
Date: Wed Dec  5 13:28:20 2007
New Revision: 601536

URL: http://svn.apache.org/viewvc?rev=601536&view=rev
Log:
LOGCXX-210: Prevent copy or assignment of MDC or NDC

Modified:
    logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h
    logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h?rev=601536&r1=601535&r2=601536&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/mdc.h Wed Dec  5 13:28:20 2007
@@ -40,14 +40,17 @@
         class LOG4CXX_EXPORT MDC
         {
         public:
-                /** String to string stl mp
+                /** String to string stl map.
                 */
                 typedef std::map<LogString, LogString> Map;
 
-        private:
-                const LogString& key;
-
-        public:
+                /**
+                 *  Places a key/value pair in the MDC for the current thread
+                 *    which will be removed during the corresponding destructor.  Both
+                 *    construction and destruction are expected to be on the same thread.
+                 *    @param key key
+                 *    @param value value.
+                 */
                 MDC(const LogString& key, const LogString& value);
                 ~MDC();
 
@@ -96,6 +99,10 @@
                 */
                 static void clear();
 
+        private:
+                MDC(const MDC&);
+                MDC& operator=(const MDC&);
+                const LogString key;                
         }; // class MDC;
 }  // namespace log4cxx
 

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h?rev=601536&r1=601535&r2=601536&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/ndc.h Wed Dec  5 13:28:20 2007
@@ -211,6 +211,9 @@
                 memory.
                 */
                 static void remove();
+        private:
+                NDC(const NDC&);
+                NDC& operator=(const NDC&);
         }; // class NDC;
 }  // namespace log4cxx