Test version with boost instead of std
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29f1706..24d1d5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,9 @@
 get_directory_property( HAS_LIBESMTP DIRECTORY src/main/include DEFINITION HAS_LIBESMTP )
 get_directory_property( HAS_ODBC DIRECTORY src/main/include DEFINITION HAS_ODBC )
 get_directory_property( HAS_SYSLOG DIRECTORY src/main/include DEFINITION HAS_SYSLOG )
+get_directory_property( THREAD_IMPL DIRECTORY src/main/include DEFINITION THREAD_IMPL )
+get_directory_property( SMART_PTR_IMPL DIRECTORY src/main/include DEFINITION SMART_PTR_IMPL )
+get_directory_property( MUTEX_IMPL DIRECTORY src/main/include DEFINITION MUTEX_IMPL )
 
 foreach(varName HAS_STD_LOCALE  HAS_ODBC  HAS_MBSRTOWCS  HAS_WCSTOMBS  HAS_FWIDE  HAS_LIBESMTP  HAS_SYSLOG)
   if(${varName} EQUAL 0)
@@ -129,6 +132,9 @@
 message(STATUS "  Using libESMTP .................. : ${HAS_LIBESMTP}")
 message(STATUS "  ODBC library .................... : ${HAS_ODBC}")
 message(STATUS "  syslog .......................... : ${HAS_SYSLOG}")
+message(STATUS "  thread implementation ........... : ${THREAD_IMPL}")
+message(STATUS "  smart pointer implementation .... : ${SMART_PTR_IMPL}")
+message(STATUS "  mutex implementation ............ : ${MUTEX_IMPL}")
 
 if(BUILD_TESTING)
 message(STATUS "Applications required for tests:")
diff --git a/src/cmake/boost-fallback/LICENSE b/src/cmake/boost-fallback/LICENSE
new file mode 100644
index 0000000..56eb5b8
--- /dev/null
+++ b/src/cmake/boost-fallback/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Robert Middleton
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/src/cmake/boost-fallback/README.md b/src/cmake/boost-fallback/README.md
new file mode 100644
index 0000000..537fde6
--- /dev/null
+++ b/src/cmake/boost-fallback/README.md
@@ -0,0 +1,14 @@
+To use:
+
+1. Include boost-fallback.cmake in your project
+2. If desired, use the provided header file to switch between the various
+ implementations:
+
+```
+include(boost-fallback/boost-fallback.cmake)
+
+set(NAMESPACE_ALIAS some_namespace)
+configure_file(boost-fallback/boost-std-configuration.h.cmake
+    boost-fallback/boost-std-configuration.h)
+target_include_directories( executable-name PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/boost-fallback )
+```
diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
new file mode 100644
index 0000000..0f91ac3
--- /dev/null
+++ b/src/cmake/boost-fallback/boost-fallback.cmake
@@ -0,0 +1,82 @@
+#include(${CMAKE_MODULE_PATH}/FindPackageHandleStandardArgs.cmake)
+
+# Checks for classes in std::, falling back to boost if the requested
+# classes are not available
+#
+# Available classes to check for:
+# thread
+# mutex
+# shared_mutex
+#
+# Variables set:
+# ${prefix}_
+
+#function(_boost_fallback_thread)
+#    try_compile(HAS_STD_THREAD "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+#	"${CMAKE_CURRENT_LIST_DIR}/test-stdthread.cpp")
+
+
+#    find_package(boost_thread COMPONENTS thread)
+#endfunction()
+
+## check for boost fallback instead of std:: classes
+## arg1: prefix for variables to set
+## arg2: list of classes to check for
+#function(boost_fallback prefix classes)
+#endfunction()
+
+#
+# This module checks for C++ standard classes and their boost counterparts
+#
+# Thread variables set:
+# STD_THREAD_FOUND - if std::thread is found
+# Boost_THREAD_FOUND - if boost::thread is found
+#
+# Mutex variables set:
+# STD_MUTEX_FOUND - if std::mutex is found
+# STD_SHARED_MUTEX_FOUND - if std::shared_mutex is found
+# Boost_MUTEX_FOUND - if boost::mutex is found
+# Boost_SHARED_MUTEX_FOUND - if boost::shared_mutex is found
+#
+# Smart pointer variables set:
+# STD_SHARED_PTR_FOUND - if std::shared_ptr is found
+# Boost_SHARED_PTR_FOUND - if boost::shared_ptr is found
+
+include(FindThreads)
+
+try_compile(STD_THREAD_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-stdthread.cpp")
+try_compile(STD_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-stdmutex.cpp")
+try_compile(STD_SHARED_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-stdsharedmutex.cpp")
+try_compile(STD_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-stdsharedptr.cpp")
+
+find_package(Boost COMPONENTS thread)
+try_compile(Boost_SHARED_PTR_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedptr.cpp")
+try_compile(Boost_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-boostmutex.cpp")
+try_compile(Boost_SHARED_MUTEX_FOUND "${CMAKE_BINARY_DIR}/boost-fallback-compile-tests"
+    "${CMAKE_CURRENT_LIST_DIR}/test-boostsharedmutex.cpp"
+    LINK_LIBRARIES Threads::Threads
+)
+
+# Link the target with the appropriate boost libraries(if required)
+function(boostfallback_link target)
+    if(NOT ${STD_THREAD_FOUND})
+        if(${Boost_THREAD_FOUND})
+           find_package(Boost COMPONENTS thread)
+           target_link_libraries( ${target} PUBLIC Boost::thread)
+        endif()
+    endif()
+    if(NOT ${STD_SHARED_MUTEX_FOUND})
+        if(${Boost_SHARED_MUTEX_FOUND})
+           find_package(Boost COMPONENTS thread)
+           target_link_libraries( ${target} PUBLIC Boost::thread)
+        endif()
+    endif()
+endfunction()
+
+
diff --git a/src/cmake/boost-fallback/boost-std-configuration.h.cmake b/src/cmake/boost-fallback/boost-std-configuration.h.cmake
new file mode 100644
index 0000000..58e3eca
--- /dev/null
+++ b/src/cmake/boost-fallback/boost-std-configuration.h.cmake
@@ -0,0 +1,78 @@
+#ifndef BOOST_STD_CONFIGURATION_H
+#define BOOST_STD_CONFIGURATION_H
+
+#cmakedefine01 STD_THREAD_FOUND
+#cmakedefine01 Boost_THREAD_FOUND
+#cmakedefine01 STD_MUTEX_FOUND
+#cmakedefine01 Boost_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_MUTEX_FOUND
+#cmakedefine01 Boost_SHARED_MUTEX_FOUND
+#cmakedefine01 STD_SHARED_PTR_FOUND
+#cmakedefine01 Boost_SHARED_PTR_FOUND
+
+#if STD_THREAD_FOUND
+#include <thread>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::thread thread;
+}
+#elif Boost_THREAD_FOUND
+#include <boost/thread.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::thread thread;
+}
+#endif
+
+#if STD_MUTEX_FOUND
+#include <mutex>
+#include <condition_variable>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::mutex mutex;
+    template <typename T>
+    using unique_lock = std::unique_lock<T>;
+    typedef std::condition_variable condition_variable;
+}
+#elif Boost_MUTEX_FOUND
+#include <boost/thread.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::mutex mutex;
+    template <typename T>
+    using unique_lock = boost::unique_lock<T>;
+    typedef boost::condition_variable condition_variable;
+}
+#endif
+
+#if STD_SHARED_MUTEX_FOUND
+#include <shared_mutex>
+namespace ${NAMESPACE_ALIAS} {
+    typedef std::shared_mutex shared_mutex;
+    template <typename T>
+    using shared_lock = std::shared_lock<T>;
+}
+#elif Boost_SHARED_MUTEX_FOUND
+#include <boost/thread/shared_mutex.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    typedef boost::shared_mutex shared_mutex;
+    template <typename T>
+    using shared_lock = boost::shared_lock<T>;
+}
+#endif
+
+#if STD_SHARED_PTR_FOUND
+#include <memory>
+namespace ${NAMESPACE_ALIAS} {
+    template <typename T>
+    using shared_ptr = std::shared_ptr<T>;
+    template <typename T>
+    using weak_ptr = std::weak_ptr<T>;
+}
+#elif Boost_SHARED_PTR_FOUND
+#include <boost/smart_ptr.hpp>
+namespace ${NAMESPACE_ALIAS} {
+    template <typename T>
+    using shared_ptr = boost::shared_ptr<T>;
+    template <typename T>
+    using weak_ptr = boost::weak_ptr<T>;
+}
+#endif
+
+#endif /* BOOST_STD_CONFIGURATION_H */
diff --git a/src/cmake/boost-fallback/test-boostmutex.cpp b/src/cmake/boost-fallback/test-boostmutex.cpp
new file mode 100644
index 0000000..f10d0fc
--- /dev/null
+++ b/src/cmake/boost-fallback/test-boostmutex.cpp
@@ -0,0 +1,6 @@
+#include <boost/thread.hpp>
+
+int main(int argc, char** argv){
+	boost::mutex mutex;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-boostsharedmutex.cpp b/src/cmake/boost-fallback/test-boostsharedmutex.cpp
new file mode 100644
index 0000000..3f88de6
--- /dev/null
+++ b/src/cmake/boost-fallback/test-boostsharedmutex.cpp
@@ -0,0 +1,6 @@
+#include <boost/thread/shared_mutex.hpp>
+
+int main(int argc, char** argv){
+	boost::shared_mutex mtx;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-boostsharedptr.cpp b/src/cmake/boost-fallback/test-boostsharedptr.cpp
new file mode 100644
index 0000000..3371640
--- /dev/null
+++ b/src/cmake/boost-fallback/test-boostsharedptr.cpp
@@ -0,0 +1,10 @@
+#include <boost/smart_ptr.hpp>
+
+struct foo{
+	int x;
+};
+
+int main(int argc, char** argv){
+	boost::shared_ptr<foo> fooptr;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-boostthread.cpp b/src/cmake/boost-fallback/test-boostthread.cpp
new file mode 100644
index 0000000..2c9cdf7
--- /dev/null
+++ b/src/cmake/boost-fallback/test-boostthread.cpp
@@ -0,0 +1,6 @@
+#include <boost/thread.hpp>
+
+int main(int argc, char** argv){
+	boost::thread th;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-stdmutex.cpp b/src/cmake/boost-fallback/test-stdmutex.cpp
new file mode 100644
index 0000000..3805ed6
--- /dev/null
+++ b/src/cmake/boost-fallback/test-stdmutex.cpp
@@ -0,0 +1,6 @@
+#include <mutex>
+
+int main(int argc, char** argv){
+	std::mutex mutex;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-stdsharedmutex.cpp b/src/cmake/boost-fallback/test-stdsharedmutex.cpp
new file mode 100644
index 0000000..a99a272
--- /dev/null
+++ b/src/cmake/boost-fallback/test-stdsharedmutex.cpp
@@ -0,0 +1,6 @@
+#include <shared_mutex>
+
+int main(int argc, char** argv){
+	std::shared_mutex shared;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-stdsharedptr.cpp b/src/cmake/boost-fallback/test-stdsharedptr.cpp
new file mode 100644
index 0000000..b5af4d5
--- /dev/null
+++ b/src/cmake/boost-fallback/test-stdsharedptr.cpp
@@ -0,0 +1,10 @@
+#include <memory>
+
+struct foo{
+	int x;
+};
+
+int main(int argc, char** argv){
+	std::shared_ptr<foo> fooptr;
+	return 0;
+}
diff --git a/src/cmake/boost-fallback/test-stdthread.cpp b/src/cmake/boost-fallback/test-stdthread.cpp
new file mode 100644
index 0000000..9d8b4f6
--- /dev/null
+++ b/src/cmake/boost-fallback/test-stdthread.cpp
@@ -0,0 +1,6 @@
+#include <thread>
+
+int main(int argc, char** argv){
+	std::thread th;
+	return 0;
+}
diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt
index 78dc535..892ae65 100644
--- a/src/main/cpp/CMakeLists.txt
+++ b/src/main/cpp/CMakeLists.txt
@@ -162,5 +162,4 @@
   VERSION ${LIBLOG4CXX_LIB_VERSION}
   SOVERSION ${LIBLOG4CXX_LIB_SOVERSION}
 )
-target_compile_features(log4cxx PUBLIC
-    cxx_std_17)
+boostfallback_link(log4cxx)
diff --git a/src/main/cpp/action.cpp b/src/main/cpp/action.cpp
index b4b3851..d652cf5 100644
--- a/src/main/cpp/action.cpp
+++ b/src/main/cpp/action.cpp
@@ -39,7 +39,7 @@
  */
 void Action::run(log4cxx::helpers::Pool& pool1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	if (!interrupted)
 	{
@@ -62,7 +62,7 @@
  */
 void Action::close()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 	interrupted = true;
 }
 
diff --git a/src/main/cpp/appenderskeleton.cpp b/src/main/cpp/appenderskeleton.cpp
index 423c43b..42a30ca 100644
--- a/src/main/cpp/appenderskeleton.cpp
+++ b/src/main/cpp/appenderskeleton.cpp
@@ -38,7 +38,7 @@
 		tailFilter(),
         pool()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	closed = false;
 }
 
@@ -51,7 +51,7 @@
 	  tailFilter(),
       pool()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	closed = false;
 }
 
@@ -69,7 +69,7 @@
 
 void AppenderSkeleton::addFilter(const spi::FilterPtr& newFilter)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 	if (headFilter == 0)
 	{
@@ -84,7 +84,7 @@
 
 void AppenderSkeleton::clearFilters()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	headFilter = tailFilter = 0;
 }
 
@@ -95,7 +95,7 @@
 
 void AppenderSkeleton::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
 {
-	std::shared_lock lock(mutex);
+	log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
 	doAppendImpl(event, pool1);
 }
@@ -138,7 +138,7 @@
 
 void AppenderSkeleton::setErrorHandler(const spi::ErrorHandlerPtr errorHandler1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 	if (errorHandler1 == 0)
 	{
@@ -154,7 +154,7 @@
 
 void AppenderSkeleton::setThreshold(const LevelPtr& threshold1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	this->threshold = threshold1;
 }
 
diff --git a/src/main/cpp/aprinitializer.cpp b/src/main/cpp/aprinitializer.cpp
index 5c4fdd7..13dfd17 100644
--- a/src/main/cpp/aprinitializer.cpp
+++ b/src/main/cpp/aprinitializer.cpp
@@ -58,7 +58,7 @@
 {
 	{
 #if APR_HAS_THREADS
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 		apr_threadkey_private_delete(tlsKey);
 #endif
 
@@ -103,7 +103,7 @@
 {
 	APRInitializer& instance(getInstance());
 #if APR_HAS_THREADS
-    std::unique_lock lock(instance.mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(instance.mutex);
 #endif
 	instance.watchdogs.push_back(watchdog);
 }
@@ -112,7 +112,7 @@
 {
 	APRInitializer& instance(getInstance());
 #if APR_HAS_THREADS
-    std::unique_lock lock(instance.mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(instance.mutex);
 #endif
 
 	for (std::list<FileWatchdog*>::iterator iter = instance.watchdogs.begin();
diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 184c71e..6a83860 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -50,7 +50,7 @@
 	  locationInfo(false),
 	  blocking(true)
 {
-    dispatcher = std::thread( &AsyncAppender::dispatch, this );
+	dispatcher = log4cxx::thread( &AsyncAppender::dispatch, this );
 }
 
 AsyncAppender::~AsyncAppender()
@@ -61,7 +61,7 @@
 
 void AsyncAppender::addAppender(const AppenderPtr newAppender)
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	appenders->addAppender(newAppender);
 }
 
@@ -92,7 +92,7 @@
 
 void AsyncAppender::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
 {
-    std::shared_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 	doAppendImpl(event, pool1);
 }
@@ -105,7 +105,7 @@
 	//
     if (!dispatcher.joinable() || bufferSize <= 0)
 	{
-        std::unique_lock lock(appenders->getMutex());
+		log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 		appenders->appendLoopOnAppenders(event, p);
 		return;
     }
@@ -120,7 +120,7 @@
 
 
     {
-        std::unique_lock lock(bufferMutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(bufferMutex);
 
 		while (true)
 		{
@@ -195,7 +195,7 @@
 void AsyncAppender::close()
 {
 	{
-        std::unique_lock lock(bufferMutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(bufferMutex);
 		closed = true;
         bufferNotEmpty.notify_all();
         bufferNotFull.notify_all();
@@ -206,7 +206,7 @@
     }
 
 	{
-        std::unique_lock lock(appenders->getMutex());
+		log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 		AppenderList appenderList = appenders->getAllAppenders();
 
 		for (AppenderList::iterator iter = appenderList.begin();
@@ -220,19 +220,19 @@
 
 AppenderList AsyncAppender::getAllAppenders() const
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	return appenders->getAllAppenders();
 }
 
 AppenderPtr AsyncAppender::getAppender(const LogString& n) const
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	return appenders->getAppender(n);
 }
 
 bool AsyncAppender::isAttached(const AppenderPtr appender) const
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	return appenders->isAttached(appender);
 }
 
@@ -243,19 +243,19 @@
 
 void AsyncAppender::removeAllAppenders()
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	appenders->removeAllAppenders();
 }
 
 void AsyncAppender::removeAppender(const AppenderPtr appender)
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	appenders->removeAppender(appender);
 }
 
 void AsyncAppender::removeAppender(const LogString& n)
 {
-    std::unique_lock lock(appenders->getMutex());
+	log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
 	appenders->removeAppender(n);
 }
 
@@ -277,7 +277,7 @@
 		throw IllegalArgumentException(LOG4CXX_STR("size argument must be non-negative"));
 	}
 
-    std::unique_lock lock(bufferMutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(bufferMutex);
 	bufferSize = (size < 1) ? 1 : size;
     bufferNotFull.notify_all();
 }
@@ -289,7 +289,7 @@
 
 void AsyncAppender::setBlocking(bool value)
 {
-    std::unique_lock lock(bufferMutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(bufferMutex);
 	blocking = value;
     bufferNotFull.notify_all();
 }
@@ -368,7 +368,7 @@
 			Pool p;
 			LoggingEventList events;
             {
-                std::unique_lock lock(bufferMutex);
+				log4cxx::unique_lock<log4cxx::mutex> lock(bufferMutex);
                 size_t bufferSize = buffer.size();
                 isActive = !closed;
 
@@ -402,7 +402,7 @@
 				iter != events.end();
 				iter++)
 			{
-                std::unique_lock lock(appenders->getMutex());
+				log4cxx::unique_lock<log4cxx::mutex> lock(appenders->getMutex());
                 appenders->appendLoopOnAppenders(*iter, p);
 			}
 		}
diff --git a/src/main/cpp/charsetdecoder.cpp b/src/main/cpp/charsetdecoder.cpp
index 376a164..ffd3759 100644
--- a/src/main/cpp/charsetdecoder.cpp
+++ b/src/main/cpp/charsetdecoder.cpp
@@ -28,7 +28,6 @@
 #include <apr_portable.h>
 #include <log4cxx/helpers/stringhelper.h>
 #include <log4cxx/helpers/transcoder.h>
-#include <mutex>
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -96,7 +95,7 @@
 			{
 				size_t outbytes_left = initial_outbytes_left;
 				{
-                    std::unique_lock lock(mutex);
+					log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 					stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
 							NULL, NULL, (char*) buf, &outbytes_left);
 				}
@@ -111,7 +110,7 @@
 					size_t pos = in.position();
 					apr_size_t outbytes_left = initial_outbytes_left;
 					{
-                        std::unique_lock lock(mutex);
+						log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 						stat = apr_xlate_conv_buffer((apr_xlate_t*) convset,
 								in.data() + pos,
 								&inbytes_left,
@@ -130,7 +129,7 @@
 		APRCharsetDecoder(const APRCharsetDecoder&);
 		APRCharsetDecoder& operator=(const APRCharsetDecoder&);
 		log4cxx::helpers::Pool pool;
-        std::mutex mutex;
+		log4cxx::mutex mutex;
 		apr_xlate_t* convset;
 };
 
@@ -450,7 +449,7 @@
 				Pool subpool;
 				const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
                 {
-                    std::unique_lock lock(mutex);
+					log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 					if (enc == 0)
 					{
@@ -483,7 +482,7 @@
 		}
 	private:
 		Pool pool;
-        std::mutex mutex;
+		log4cxx::mutex mutex;
 		CharsetDecoderPtr decoder;
 		std::string encoding;
 };
diff --git a/src/main/cpp/charsetencoder.cpp b/src/main/cpp/charsetencoder.cpp
index 02a53c8..12768ce 100644
--- a/src/main/cpp/charsetencoder.cpp
+++ b/src/main/cpp/charsetencoder.cpp
@@ -28,7 +28,6 @@
 
 #include <log4cxx/private/log4cxx_private.h>
 #include <apr_portable.h>
-#include <mutex>
 
 #ifdef LOG4CXX_HAS_WCSTOMBS
 	#include <stdlib.h>
@@ -90,7 +89,7 @@
 
 			if (iter == in.end())
 			{
-                std::unique_lock lock(mutex);
+				log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 				stat = apr_xlate_conv_buffer(convset, NULL, NULL,
 						out.data() + position, &outbytes_left);
 			}
@@ -101,7 +100,7 @@
 					(in.size() - inOffset) * sizeof(LogString::value_type);
 				apr_size_t initial_inbytes_left = inbytes_left;
 				{
-                    std::unique_lock lock(mutex);
+					log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 					stat = apr_xlate_conv_buffer(convset,
 							(const char*) (in.data() + inOffset),
 							&inbytes_left,
@@ -119,7 +118,7 @@
 		APRCharsetEncoder(const APRCharsetEncoder&);
 		APRCharsetEncoder& operator=(const APRCharsetEncoder&);
 		Pool pool;
-        std::mutex mutex;
+		log4cxx::mutex mutex;
 		apr_xlate_t* convset;
 };
 #endif
@@ -480,7 +479,7 @@
 				Pool subpool;
 				const char* enc = apr_os_locale_encoding(subpool.getAPRPool());
 				{
-                    std::unique_lock lock(mutex);
+					log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 					if (enc == 0)
 					{
@@ -516,7 +515,7 @@
 		LocaleCharsetEncoder(const LocaleCharsetEncoder&);
 		LocaleCharsetEncoder& operator=(const LocaleCharsetEncoder&);
 		Pool pool;
-        std::mutex mutex;
+		log4cxx::mutex mutex;
 		CharsetEncoderPtr encoder;
 		std::string encoding;
 };
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index 173fad1..a9fb11d 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -35,7 +35,7 @@
 
 FileAppender::FileAppender()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
     fileAppend = true;
     bufferedIO = false;
     bufferSize = 8 * 1024;
@@ -46,7 +46,7 @@
     : WriterAppender(layout1)
 {
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         fileAppend = append1;
         fileName = fileName1;
         bufferedIO = bufferedIO1;
@@ -61,7 +61,7 @@
     : WriterAppender(layout1)
 {
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         fileAppend = append1;
         fileName = fileName1;
         bufferedIO = false;
@@ -75,7 +75,7 @@
     : WriterAppender(layout1)
 {
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         fileAppend = true;
         fileName = fileName1;
         bufferedIO = false;
@@ -92,13 +92,13 @@
 
 void FileAppender::setAppend(bool fileAppend1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
     this->fileAppend = fileAppend1;
 }
 
 void FileAppender::setFile(const LogString& file)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	setFileInternal(file);
 }
 
@@ -109,7 +109,7 @@
 
 void FileAppender::setBufferedIO(bool bufferedIO1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
     this->bufferedIO = bufferedIO1;
 
     if (bufferedIO1)
@@ -124,27 +124,27 @@
     if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"), LOG4CXX_STR("file"))
             || StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         fileName = stripDuplicateBackslashes(value);
     }
     else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("APPEND"), LOG4CXX_STR("append")))
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         fileAppend = OptionConverter::toBoolean(value, true);
     }
     else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         bufferedIO = OptionConverter::toBoolean(value, true);
     }
     else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         bufferedIO = !OptionConverter::toBoolean(value, false);
     }
     else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
         bufferSize = OptionConverter::toFileSize(value, 8 * 1024);
     }
     else
@@ -155,7 +155,7 @@
 
 void FileAppender::activateOptions(Pool& p)
 {
-	std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	activateOptionsInternal(p);
 }
 
diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp
index 65c5321..9d5afea 100644
--- a/src/main/cpp/filewatchdog.cpp
+++ b/src/main/cpp/filewatchdog.cpp
@@ -41,7 +41,7 @@
     interrupted = 0xFFFF;
 
     {
-        std::unique_lock lock(interrupt_mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(interrupt_mutex);
         interrupt.notify_all();
     }
     thread.join();
@@ -79,7 +79,7 @@
 
     while (interrupted != 0xFFFF)
     {
-        std::unique_lock lock( interrupt_mutex );
+		log4cxx::unique_lock<log4cxx::mutex> lock( interrupt_mutex );
         interrupt.wait_for( lock, std::chrono::milliseconds( delay ),
                             std::bind(&FileWatchdog::is_interrupted, this) );
 
@@ -92,7 +92,7 @@
 {
 	checkAndConfigure();
 
-    thread = std::thread( &FileWatchdog::run, this );
+	thread = log4cxx::thread( &FileWatchdog::run, this );
 }
 
 bool FileWatchdog::is_interrupted(){
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
index 9e4184e..b0a7ded 100644
--- a/src/main/cpp/hierarchy.cpp
+++ b/src/main/cpp/hierarchy.cpp
@@ -38,7 +38,6 @@
 #include <log4cxx/defaultconfigurator.h>
 #include <log4cxx/spi/rootlogger.h>
 #include "assert.h"
-#include <mutex>
 
 
 using namespace log4cxx;
@@ -52,7 +51,7 @@
 	loggers(new LoggerMap()),
 	provisionNodes(new ProvisionNodeMap())
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
     root = LoggerPtr(new RootLogger(pool, Level::getDebug()));
 	root->setHierarchy(this);
     defaultFactory = LoggerFactoryPtr(new DefaultLoggerFactory());
@@ -75,7 +74,7 @@
 
 void Hierarchy::addHierarchyEventListener(const spi::HierarchyEventListenerPtr& listener)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	if (std::find(listeners.begin(), listeners.end(), listener) != listeners.end())
 	{
@@ -89,7 +88,7 @@
 
 void Hierarchy::clear()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 	loggers->clear();
 }
 
@@ -97,7 +96,7 @@
 {
 	bool emitWarning = false;
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 		emitWarning = !emittedNoAppenderWarning;
 		emittedNoAppenderWarning = true;
 	}
@@ -114,7 +113,7 @@
 
 LoggerPtr Hierarchy::exists(const LogString& name)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	LoggerPtr logger;
 	LoggerMap::iterator it = loggers->find(name);
@@ -132,7 +131,7 @@
 {
 	if (l != 0)
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
         setThresholdInternal(l);
 	}
 }
@@ -167,7 +166,7 @@
 	setConfigured(true);
 	HierarchyEventListenerList clonedList;
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 		clonedList = listeners;
 	}
 
@@ -186,7 +185,7 @@
 {
 	HierarchyEventListenerList clonedList;
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 		clonedList = listeners;
 	}
 	HierarchyEventListenerList::iterator it, itEnd = clonedList.end();
@@ -212,7 +211,7 @@
 LoggerPtr Hierarchy::getLogger(const LogString& name,
 	const spi::LoggerFactoryPtr& factory)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	LoggerMap::iterator it = loggers->find(name);
 
@@ -242,7 +241,7 @@
 
 LoggerList Hierarchy::getCurrentLoggers() const
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	LoggerList v;
 	LoggerMap::const_iterator it, itEnd = loggers->end();
@@ -265,7 +264,7 @@
 {
     bool currentlyConfigured;
     {
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
         currentlyConfigured = configured;
     }
     if (!currentlyConfigured)
@@ -281,7 +280,7 @@
 
 void Hierarchy::resetConfiguration()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	getRootLogger()->setLevel(Level::getDebug());
 	root->setResourceBundle(0);
@@ -303,7 +302,7 @@
 
 void Hierarchy::shutdown()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
     shutdownInternal();
 }
@@ -401,7 +400,7 @@
 
 void Hierarchy::setConfigured(bool newValue)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 	configured = newValue;
 }
 
diff --git a/src/main/cpp/level.cpp b/src/main/cpp/level.cpp
index e85cb8b..c8f2921 100644
--- a/src/main/cpp/level.cpp
+++ b/src/main/cpp/level.cpp
@@ -23,7 +23,6 @@
 	#define LOG4CXX 1
 #endif
 #include <log4cxx/helpers/aprinitializer.h>
-#include <mutex>
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -31,7 +30,7 @@
 IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(Level, LevelClass)
 
 volatile bool Level::initialized = false;
-std::mutex Level::initMutex;
+log4cxx::mutex Level::initMutex;
 LevelPtr Level::allLevel;
 LevelPtr Level::fatalLevel;
 LevelPtr Level::errorLevel;
@@ -46,7 +45,7 @@
         return;
     }
 
-    std::unique_lock lock(initMutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(initMutex);
     if( initialized ){
         return;
     }
diff --git a/src/main/cpp/logger.cpp b/src/main/cpp/logger.cpp
index 2908eda..24e02ff 100644
--- a/src/main/cpp/logger.cpp
+++ b/src/main/cpp/logger.cpp
@@ -56,7 +56,7 @@
 {
     log4cxx::spi::LoggerRepository* rep = 0;
     {
-        std::shared_lock lock(mutex);
+		log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
         if (aai == 0)
         {
@@ -74,7 +74,7 @@
 }
 
 void Logger::reconfigure( const std::vector<AppenderPtr>& appenders, bool additive1 ) {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     additive = additive1;
 
@@ -107,7 +107,7 @@
             logger = logger->parent.get())
     {
         // Protected against simultaneous call to addAppender, removeAppender,...
-        std::unique_lock lock(logger->mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(logger->mutex);
 
         if (logger->aai != 0)
         {
@@ -172,7 +172,7 @@
 
 AppenderList Logger::getAllAppenders() const
 {
-    std::shared_lock lock(mutex);
+	log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (aai == 0)
     {
@@ -186,7 +186,7 @@
 
 AppenderPtr Logger::getAppender(const LogString& name1) const
 {
-    std::shared_lock lock(mutex);
+	log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (aai == 0 || name1.empty())
     {
@@ -272,7 +272,7 @@
 
 bool Logger::isAttached(const AppenderPtr appender) const
 {
-    std::shared_lock lock(mutex);
+	log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (appender == 0 || aai == 0)
     {
@@ -460,7 +460,7 @@
 
 void Logger::removeAllAppenders()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (aai != 0)
     {
@@ -471,7 +471,7 @@
 
 void Logger::removeAppender(const AppenderPtr appender)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (appender == 0 || aai == 0)
     {
@@ -483,7 +483,7 @@
 
 void Logger::removeAppender(const LogString& name1)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (name1.empty() || aai == 0)
     {
diff --git a/src/main/cpp/loglog.cpp b/src/main/cpp/loglog.cpp
index fa2ab71..b0bf27d 100644
--- a/src/main/cpp/loglog.cpp
+++ b/src/main/cpp/loglog.cpp
@@ -44,7 +44,7 @@
 
 void LogLog::setInternalDebugging(bool debugEnabled1)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
 	getInstance().debugEnabled = debugEnabled1;
 }
@@ -56,7 +56,7 @@
 		return;
 	}
 
-	std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
 	emit(msg);
 }
@@ -68,7 +68,7 @@
 		return;
 	}
 
-	std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
     emit(msg);
 	emit(e);
@@ -77,14 +77,14 @@
 
 void LogLog::error(const LogString& msg)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
 	emit(msg);
 }
 
 void LogLog::error(const LogString& msg, const std::exception& e)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
     emit(msg);
 	emit(e);
@@ -92,21 +92,21 @@
 
 void LogLog::setQuietMode(bool quietMode1)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
 	getInstance().quietMode = quietMode1;
 }
 
 void LogLog::warn(const LogString& msg)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
 	emit(msg);
 }
 
 void LogLog::warn(const LogString& msg, const std::exception& e)
 {
-    std::unique_lock lock(getInstance().mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(getInstance().mutex);
 
     emit(msg);
 	emit(e);
diff --git a/src/main/cpp/rollingfileappender.cpp b/src/main/cpp/rollingfileappender.cpp
index 5a55ba5..0046ee8 100644
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@ -92,7 +92,7 @@
 	}
 
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 		triggeringPolicy->activateOptions(p);
 		rollingPolicy->activateOptions(p);
 
@@ -181,7 +181,7 @@
  */
 bool RollingFileAppenderSkeleton::rollover(Pool& p)
 {
-	std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	return rolloverInternal(p);
 }
 
diff --git a/src/main/cpp/serversocket.cpp b/src/main/cpp/serversocket.cpp
index 90c2a9c..6766c2a 100644
--- a/src/main/cpp/serversocket.cpp
+++ b/src/main/cpp/serversocket.cpp
@@ -77,7 +77,7 @@
 
 void ServerSocket::close()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	if (socket != 0)
 	{
@@ -97,7 +97,7 @@
 */
 SocketPtr ServerSocket::accept()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::mutex> lock(mutex);
 
 	if (socket == 0)
 	{
diff --git a/src/main/cpp/socketappender.cpp b/src/main/cpp/socketappender.cpp
index 161c9b7..e30d203 100644
--- a/src/main/cpp/socketappender.cpp
+++ b/src/main/cpp/socketappender.cpp
@@ -78,7 +78,7 @@
 
 void SocketAppender::setSocket(log4cxx::helpers::SocketPtr& socket, Pool& p)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     SocketOutputStreamPtr sock = SocketOutputStreamPtr(new SocketOutputStream(socket));
     oos = ObjectOutputStreamPtr(new ObjectOutputStream(sock, p));
diff --git a/src/main/cpp/socketappenderskeleton.cpp b/src/main/cpp/socketappenderskeleton.cpp
index 258a368..4f67dbf 100644
--- a/src/main/cpp/socketappenderskeleton.cpp
+++ b/src/main/cpp/socketappenderskeleton.cpp
@@ -77,7 +77,7 @@
 
 void SocketAppenderSkeleton::close()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 	if (closed)
 	{
@@ -88,7 +88,7 @@
 	cleanUp(pool);
 
     {
-        std::unique_lock lock2(interrupt_mutex);
+		log4cxx::unique_lock<log4cxx::mutex> lock2(interrupt_mutex);
         interrupt.notify_all();
     }
 
@@ -155,13 +155,13 @@
 
 void SocketAppenderSkeleton::fireConnector()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     if ( !thread.joinable() )
 	{
 		LogLog::debug(LOG4CXX_STR("Connector thread not alive: starting monitor."));
 
-        thread = std::thread( &SocketAppenderSkeleton::monitor, this );
+		thread = log4cxx::thread( &SocketAppenderSkeleton::monitor, this );
 	}
 }
 
@@ -176,7 +176,7 @@
         {
             std::this_thread::sleep_for( std::chrono::milliseconds( reconnectionDelay ) );
 
-            std::unique_lock lock( interrupt_mutex );
+			log4cxx::unique_lock<log4cxx::mutex> lock( interrupt_mutex );
             interrupt.wait_for( lock, std::chrono::milliseconds( reconnectionDelay ),
                                 std::bind(&SocketAppenderSkeleton::is_closed, this) );
 
diff --git a/src/main/cpp/sockethubappender.cpp b/src/main/cpp/sockethubappender.cpp
index 0c74c5b..f966b8f 100644
--- a/src/main/cpp/sockethubappender.cpp
+++ b/src/main/cpp/sockethubappender.cpp
@@ -82,7 +82,7 @@
 void SocketHubAppender::close()
 {
 	{
-        std::unique_lock lock(mutex);
+		log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 		if (closed)
 		{
@@ -100,7 +100,7 @@
 		thread.join();
 	}
 
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	// close all of the connections
 	LogLog::debug(LOG4CXX_STR("closing client connections"));
 
@@ -174,7 +174,7 @@
 
 void SocketHubAppender::startServer()
 {
-    thread = std::thread( &SocketHubAppender::monitor, this );
+	thread = log4cxx::thread( &SocketHubAppender::monitor, this );
 }
 
 void SocketHubAppender::monitor()
@@ -230,7 +230,7 @@
 					+ LOG4CXX_STR(")"));
 
 				// add it to the oosList.
-                std::unique_lock lock(mutex);
+				log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 				OutputStreamPtr os(new SocketOutputStream(socket));
 				Pool p;
 				ObjectOutputStreamPtr oos(new ObjectOutputStream(os, p));
diff --git a/src/main/cpp/telnetappender.cpp b/src/main/cpp/telnetappender.cpp
index e7e9132..d7e2a10 100644
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@ -60,7 +60,7 @@
 		serverSocket->setSoTimeout(1000);
 	}
 
-    sh = std::thread( &TelnetAppender::acceptConnections, this );
+	sh = log4cxx::thread( &TelnetAppender::acceptConnections, this );
 }
 
 void TelnetAppender::setOption(const LogString& option,
@@ -82,13 +82,13 @@
 
 LogString TelnetAppender::getEncoding() const
 {
-    std::shared_lock lock(mutex);
+	log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 	return encoding;
 }
 
 void TelnetAppender::setEncoding(const LogString& value)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 	encoder = CharsetEncoder::getEncoder(value);
 	encoding = value;
 }
@@ -96,7 +96,7 @@
 
 void TelnetAppender::close()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
 	if (closed)
 	{
@@ -192,7 +192,7 @@
 		LogString::const_iterator msgIter(msg.begin());
 		ByteBuffer buf(bytes, bytesSize);
 
-        std::shared_lock lock(mutex);
+		log4cxx::shared_lock<log4cxx::shared_mutex> lock(mutex);
 
 		while (msgIter != msg.end())
 		{
@@ -248,7 +248,7 @@
 				//
 				//   find unoccupied connection
 				//
-                std::unique_lock lock(mutex);
+				log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
                 for (ConnectionList::iterator iter = connections.begin();
                     iter != connections.end();
diff --git a/src/main/cpp/writerappender.cpp b/src/main/cpp/writerappender.cpp
index 4e85a44..80d85fd 100644
--- a/src/main/cpp/writerappender.cpp
+++ b/src/main/cpp/writerappender.cpp
@@ -150,7 +150,7 @@
    */
 void WriterAppender::close()
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
 
     if (closed)
     {
@@ -276,7 +276,7 @@
 
 void WriterAppender::setWriter(const WriterPtr& newWriter)
 {
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
     setWriterInternal(newWriter);
 }
 
diff --git a/src/main/cpp/xmlsocketappender.cpp b/src/main/cpp/xmlsocketappender.cpp
index 6fba02b..523ab52 100644
--- a/src/main/cpp/xmlsocketappender.cpp
+++ b/src/main/cpp/xmlsocketappender.cpp
@@ -84,7 +84,7 @@
 {
 	OutputStreamPtr os(new SocketOutputStream(socket));
 	CharsetEncoderPtr charset(CharsetEncoder::getUTF8Encoder());
-    std::unique_lock lock(mutex);
+	log4cxx::unique_lock<log4cxx::shared_mutex> lock(mutex);
     writer = OutputStreamWriterPtr(new OutputStreamWriter(os, charset));
 }
 
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index b8729b2..ca007bb 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -1,24 +1,29 @@
 # Configure
 
 if(WIN32)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/version_info.h.in
-               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/version_info.h
-               @ONLY
-)
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/version_info.h.in
+	           ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/version_info.h
+		   @ONLY
+    )
+    set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8, wchar_t(default), unichar")
+    set_property(CACHE LOG4CXX_CHAR PROPERTY STRINGS "utf-8" "wchar_t" "unichar")
+    set(LOGCHAR_IS_UNICHAR 0)
+    set(LOGCHAR_IS_WCHAR 1)
+    set(LOGCHAR_IS_UTF8 0)
+else()
+    set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8 (default), wchar_t, unichar")
+    set_property(CACHE LOG4CXX_CHAR PROPERTY STRINGS "utf-8" "wchar_t" "unichar")
+    set(LOGCHAR_IS_UNICHAR 0)
+    set(LOGCHAR_IS_WCHAR 0)
+    set(LOGCHAR_IS_UTF8 1)
 endif()
 
 # Configure log4cxx.h
-set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8 (default), wchar_t, unichar")
-set_property(CACHE LOG4CXX_CHAR PROPERTY STRINGS "utf-8" "wchar_t" "unichar")
-set(LOGCHAR_IS_UNICHAR 0)
-set(LOGCHAR_IS_WCHAR 0)
-set(LOGCHAR_IS_UTF8 0)
+
 if(${LOG4CXX_CHAR} STREQUAL "unichar")
   set(LOGCHAR_IS_UNICHAR 1)
 elseif(${LOG4CXX_CHAR} STREQUAL "wchar_t")
   set(LOGCHAR_IS_WCHAR 1)
-else()
-  set(LOGCHAR_IS_UTF8 1)
 endif()
 option(LOG4CXX_WCHAR_T "Enable wchar_t API methods" ON)
 option(LOG4CXX_UNICHAR "Enable UniChar API methods" OFF)
@@ -35,10 +40,7 @@
     set("${varName}_API" 0)
   endif()
 endforeach()
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.h.in
-               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
-               @ONLY
-)
+
 
 # Configure log4cxx_private.h
 set(LOG4CXX_CHARSET "locale" CACHE STRING "LogString characters, choice of locale (default), utf-8, ISO-8859-1, US-ASCII, EBCDIC")
@@ -88,11 +90,22 @@
   endif()
 endforeach()
 
+# Check for standard headers that we need, fall back to boost if they're not found
+include(${CMAKE_SOURCE_DIR}/src/cmake/boost-fallback/boost-fallback.cmake)
+set(NAMESPACE_ALIAS log4cxx)
 
+# Configure both our private header and our public header
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
                @ONLY
 )
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.h.in
+               ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
+	       @ONLY
+)
+configure_file(${CMAKE_SOURCE_DIR}/src/cmake/boost-fallback/boost-std-configuration.h.cmake
+                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/boost-std-configuration.h
+)
 
 # Provide the dependencies
 add_custom_target(configure_log4cxx
diff --git a/src/main/include/log4cxx/appenderskeleton.h b/src/main/include/log4cxx/appenderskeleton.h
index 64608e5..1d71fb0 100644
--- a/src/main/include/log4cxx/appenderskeleton.h
+++ b/src/main/include/log4cxx/appenderskeleton.h
@@ -31,7 +31,6 @@
 #include <log4cxx/helpers/object.h>
 #include <log4cxx/helpers/pool.h>
 #include <log4cxx/level.h>
-#include <shared_mutex>
 
 namespace log4cxx
 {
@@ -75,7 +74,7 @@
 		bool closed;
 
 		log4cxx::helpers::Pool pool;
-		mutable std::shared_mutex mutex;
+		mutable log4cxx::shared_mutex mutex;
 
 		/**
 		Subclasses of <code>AppenderSkeleton</code> should implement this
diff --git a/src/main/include/log4cxx/asyncappender.h b/src/main/include/log4cxx/asyncappender.h
index 95bdb96..545c1ae 100644
--- a/src/main/include/log4cxx/asyncappender.h
+++ b/src/main/include/log4cxx/asyncappender.h
@@ -29,10 +29,6 @@
 #include <deque>
 #include <log4cxx/spi/loggingevent.h>
 
-#include <mutex>
-#include <condition_variable>
-#include <thread>
-
 #if defined(NON_BLOCKING)
 	#include <boost/lockfree/queue.hpp>
 #endif
@@ -209,14 +205,14 @@
 		/**
 		 *  Mutex used to guard access to buffer and discardMap.
 		 */
-		std::mutex bufferMutex;
+		log4cxx::mutex bufferMutex;
 
 #if defined(NON_BLOCKING)
 		::log4cxx::helpers::Semaphore bufferNotFull;
 		::log4cxx::helpers::Semaphore bufferNotEmpty;
 #else
-		std::condition_variable bufferNotFull;
-		std::condition_variable bufferNotEmpty;
+		log4cxx::condition_variable bufferNotFull;
+		log4cxx::condition_variable bufferNotEmpty;
 #endif
 		class DiscardSummary
 		{
@@ -281,7 +277,7 @@
 		/**
 		 *  Dispatcher.
 		 */
-		std::thread dispatcher;
+		log4cxx::thread dispatcher;
 
 		/**
 		 * Should location info be included in dispatched messages.
diff --git a/src/main/include/log4cxx/helpers/appenderattachableimpl.h b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
index f980bf1..b71f7f7 100644
--- a/src/main/include/log4cxx/helpers/appenderattachableimpl.h
+++ b/src/main/include/log4cxx/helpers/appenderattachableimpl.h
@@ -27,14 +27,14 @@
 #include <log4cxx/spi/appenderattachable.h>
 #include <log4cxx/helpers/object.h>
 #include <log4cxx/helpers/pool.h>
-#include <mutex>
+#include <log4cxx/log4cxx.h>
 
 namespace log4cxx
 {
 namespace spi
 {
 class LoggingEvent;
-typedef std::shared_ptr<LoggingEvent> LoggingEventPtr;
+typedef log4cxx::shared_ptr<LoggingEvent> LoggingEventPtr;
 }
 
 namespace helpers
@@ -105,13 +105,13 @@
 		 */
 		virtual void removeAppender(const LogString& name);
 
-		inline std::mutex& getMutex() const
+		inline mutex& getMutex() const
 		{
-			return mutex;
+			return m_mutex;
 		}
 
 	private:
-		mutable std::mutex mutex;
+		mutable mutex m_mutex;
 		AppenderAttachableImpl(const AppenderAttachableImpl&);
 		AppenderAttachableImpl& operator=(const AppenderAttachableImpl&);
 };
diff --git a/src/main/include/log4cxx/helpers/aprinitializer.h b/src/main/include/log4cxx/helpers/aprinitializer.h
index 9881001..24202b9 100644
--- a/src/main/include/log4cxx/helpers/aprinitializer.h
+++ b/src/main/include/log4cxx/helpers/aprinitializer.h
@@ -23,7 +23,6 @@
 #endif
 
 #include <list>
-#include <mutex>
 
 extern "C" {
 	typedef struct apr_thread_mutex_t apr_thread_mutex_t;
@@ -59,7 +58,7 @@
 		APRInitializer(const APRInitializer&);
 		APRInitializer& operator=(const APRInitializer&);
 		apr_pool_t* p;
-		std::mutex mutex;
+		log4cxx::mutex mutex;
 		std::list<FileWatchdog*> watchdogs;
 		apr_time_t startTime;
 		apr_threadkey_t* tlsKey;
diff --git a/src/main/include/log4cxx/helpers/filewatchdog.h b/src/main/include/log4cxx/helpers/filewatchdog.h
index b491463..d88c3ad 100644
--- a/src/main/include/log4cxx/helpers/filewatchdog.h
+++ b/src/main/include/log4cxx/helpers/filewatchdog.h
@@ -22,8 +22,6 @@
 #include <time.h>
 #include <log4cxx/helpers/pool.h>
 #include <log4cxx/file.h>
-#include <thread>
-#include <condition_variable>
 #include <atomic>
 
 namespace log4cxx
@@ -56,7 +54,7 @@
 		long delay;
 		log4cxx_time_t lastModif;
 		bool warnedAlready;
-		std::atomic<int> interrupted;
+		volatile int interrupted;
 
 	protected:
 		FileWatchdog(const File& filename);
@@ -78,9 +76,9 @@
 		void run();
 		bool is_interrupted();
 		Pool pool;
-		std::thread thread;
-		std::condition_variable interrupt;
-		std::mutex interrupt_mutex;
+		log4cxx::thread thread;
+		log4cxx::condition_variable interrupt;
+		log4cxx::mutex interrupt_mutex;
 
 		FileWatchdog(const FileWatchdog&);
 		FileWatchdog& operator=(const FileWatchdog&);
diff --git a/src/main/include/log4cxx/helpers/loglog.h b/src/main/include/log4cxx/helpers/loglog.h
index a4c9241..dd8db31 100644
--- a/src/main/include/log4cxx/helpers/loglog.h
+++ b/src/main/include/log4cxx/helpers/loglog.h
@@ -20,7 +20,6 @@
 
 #include <log4cxx/logstring.h>
 #include <exception>
-#include <mutex>
 
 namespace log4cxx
 {
@@ -48,7 +47,7 @@
 		       In quietMode not even errors generate any output.
 		 */
 		bool quietMode;
-		std::mutex mutex;
+		log4cxx::mutex mutex;
 		LogLog();
 		LogLog(const LogLog&);
 		LogLog& operator=(const LogLog&);
diff --git a/src/main/include/log4cxx/helpers/serversocket.h b/src/main/include/log4cxx/helpers/serversocket.h
index 7da75b9..e16b5c7 100644
--- a/src/main/include/log4cxx/helpers/serversocket.h
+++ b/src/main/include/log4cxx/helpers/serversocket.h
@@ -19,7 +19,6 @@
 #define _LOG4CXX_HELPERS_SERVER_SOCKET_H
 
 #include <log4cxx/helpers/socket.h>
-#include <mutex>
 
 namespace log4cxx
 {
@@ -53,7 +52,7 @@
 
 	private:
 		Pool pool;
-		std::mutex mutex;
+		log4cxx::mutex mutex;
 		apr_socket_t* socket;
 		int timeout;
 
diff --git a/src/main/include/log4cxx/hierarchy.h b/src/main/include/log4cxx/hierarchy.h
index a367b77..361db5e 100644
--- a/src/main/include/log4cxx/hierarchy.h
+++ b/src/main/include/log4cxx/hierarchy.h
@@ -31,7 +31,6 @@
 #include <log4cxx/helpers/object.h>
 #include <log4cxx/spi/hierarchyeventlistener.h>
 #include <log4cxx/helpers/pool.h>
-#include <mutex>
 
 namespace log4cxx
 {
@@ -60,7 +59,7 @@
 {
 	private:
 		log4cxx::helpers::Pool pool;
-		mutable std::mutex mutex;
+		mutable log4cxx::mutex mutex;
 		bool configured;
 
 		spi::LoggerFactoryPtr defaultFactory;
diff --git a/src/main/include/log4cxx/level.h b/src/main/include/log4cxx/level.h
index 31ee4cd..d5258ae 100644
--- a/src/main/include/log4cxx/level.h
+++ b/src/main/include/log4cxx/level.h
@@ -22,7 +22,6 @@
 #include <log4cxx/logstring.h>
 #include <limits.h>
 #include <log4cxx/helpers/object.h>
-#include <mutex>
 
 #if defined(_MSC_VER)
 	#pragma warning ( push )
@@ -40,7 +39,7 @@
  * https://issues.apache.org/jira/browse/LOGCXX-394
  */
 class Level;
-typedef std::shared_ptr<Level> LevelPtr;
+typedef log4cxx::shared_ptr<Level> LevelPtr;
 
 /**
 Defines the minimum set of levels recognized by the system, that is
@@ -281,7 +280,7 @@
 
     private:
         static volatile bool initialized;
-        static std::mutex initMutex;
+		static mutex initMutex;
         static LevelPtr allLevel;
         static LevelPtr fatalLevel;
         static LevelPtr errorLevel;
diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index da8e998..b258e8a 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -24,8 +24,6 @@
  *
  */
 
-#include <memory>
-
 
 #define LOG4CXX_LOGCHAR_IS_UNICHAR @LOGCHAR_IS_UNICHAR@
 #define LOG4CXX_LOGCHAR_IS_UTF8 @LOGCHAR_IS_UTF8@
@@ -44,8 +42,9 @@
 typedef int log4cxx_status_t;
 typedef unsigned int log4cxx_uint32_t;
 
+#include "boost-std-configuration.h"
 
-#define LOG4CXX_PTR_DEF(T) typedef std::shared_ptr<T> T##Ptr
+#define LOG4CXX_PTR_DEF(T) typedef log4cxx::shared_ptr<T> T##Ptr
 #define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
 
 #if _WIN32
diff --git a/src/main/include/log4cxx/logger.h b/src/main/include/log4cxx/logger.h
index b53b546..44b6d5e 100644
--- a/src/main/include/log4cxx/logger.h
+++ b/src/main/include/log4cxx/logger.h
@@ -33,8 +33,6 @@
 #include <log4cxx/spi/location/locationinfo.h>
 #include <log4cxx/helpers/resourcebundle.h>
 #include <log4cxx/helpers/messagebuffer.h>
-#include <shared_mutex>
-#include <atomic>
 
 namespace log4cxx
 {
@@ -115,7 +113,7 @@
             of this logger will inherit its appenders, unless the children
             have their additivity flag set to <code>false</code> too. See
             the user manual for more details. */
-	std::atomic<bool> additive;
+	bool additive;
 
 protected:
     friend class DefaultLoggerFactory;
@@ -1728,7 +1726,7 @@
     //  prevent copy and assignment
     Logger(const Logger&);
     Logger& operator=(const Logger&);
-    mutable std::shared_mutex mutex;
+	mutable shared_mutex mutex;
     friend class log4cxx::helpers::synchronized;
 };
 LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);
diff --git a/src/main/include/log4cxx/net/socketappenderskeleton.h b/src/main/include/log4cxx/net/socketappenderskeleton.h
index c278c33..c777f35 100644
--- a/src/main/include/log4cxx/net/socketappenderskeleton.h
+++ b/src/main/include/log4cxx/net/socketappenderskeleton.h
@@ -20,8 +20,6 @@
 
 #include <log4cxx/appenderskeleton.h>
 #include <log4cxx/helpers/socket.h>
-#include <thread>
-#include <atomic>
 #include <log4cxx/helpers/objectoutputstream.h>
 
 #if defined(_MSC_VER)
@@ -190,9 +188,9 @@
 		     connection is droppped.
 		     */
 
-		std::thread thread;
-		std::condition_variable interrupt;
-		std::mutex interrupt_mutex;
+		log4cxx::thread thread;
+		log4cxx::condition_variable interrupt;
+		log4cxx::mutex interrupt_mutex;
 		void monitor();
 		bool is_closed();
 		SocketAppenderSkeleton(const SocketAppenderSkeleton&);
diff --git a/src/main/include/log4cxx/net/sockethubappender.h b/src/main/include/log4cxx/net/sockethubappender.h
index 88c5891..a98eaa6 100644
--- a/src/main/include/log4cxx/net/sockethubappender.h
+++ b/src/main/include/log4cxx/net/sockethubappender.h
@@ -193,7 +193,7 @@
 	private:
 		void startServer();
 
-		std::thread thread;
+		log4cxx::thread thread;
 		void monitor();
 
 }; // class SocketHubAppender
diff --git a/src/main/include/log4cxx/net/telnetappender.h b/src/main/include/log4cxx/net/telnetappender.h
index 9d0d66a..e9b888a 100644
--- a/src/main/include/log4cxx/net/telnetappender.h
+++ b/src/main/include/log4cxx/net/telnetappender.h
@@ -147,7 +147,7 @@
 		LogString encoding;
 		log4cxx::helpers::CharsetEncoderPtr encoder;
 		helpers::ServerSocket* serverSocket;
-		std::thread sh;
+		log4cxx::thread sh;
 		size_t activeConnections;
 		void acceptConnections();
 }; // class TelnetAppender
diff --git a/src/main/include/log4cxx/private/log4cxx_private.h.in b/src/main/include/log4cxx/private/log4cxx_private.h.in
index 53e59ef..4726816 100644
--- a/src/main/include/log4cxx/private/log4cxx_private.h.in
+++ b/src/main/include/log4cxx/private/log4cxx_private.h.in
@@ -53,5 +53,4 @@
 #define LOG4CXX_WIN32_THREAD_FMTSPEC "0x%.8x"
 #define LOG4CXX_APR_THREAD_FMTSPEC "0x%pt"
 
-
 #endif
diff --git a/src/main/include/log4cxx/rolling/action.h b/src/main/include/log4cxx/rolling/action.h
index fc44978..8a29ee9 100644
--- a/src/main/include/log4cxx/rolling/action.h
+++ b/src/main/include/log4cxx/rolling/action.h
@@ -21,7 +21,6 @@
 #include <log4cxx/portability.h>
 #include <log4cxx/helpers/object.h>
 #include <log4cxx/helpers/pool.h>
-#include <mutex>
 
 namespace log4cxx
 {
@@ -49,7 +48,7 @@
 		bool interrupted;
 
 		log4cxx::helpers::Pool pool;
-		std::mutex mutex;
+		log4cxx::mutex mutex;
 
 
 	protected:
diff --git a/src/main/resources/log4cxx.rc b/src/main/resources/log4cxx.rc
index 3faf8b0..212a877 100644
--- a/src/main/resources/log4cxx.rc
+++ b/src/main/resources/log4cxx.rc
@@ -1,126 +1,126 @@
-//

-// Licensed to the Apache Software Foundation (ASF) under one

-// or more contributor license agreements.  See the NOTICE file

-// distributed with this work for additional information

-// regarding copyright ownership.  The ASF licenses this file

-// to you under the Apache License, Version 2.0 (the

-// "License"); you may not use this file except in compliance

-// with the License.  You may obtain a copy of the License at

-//

-// http://www.apache.org/licenses/LICENSE-2.0

-//

-// Unless required by applicable law or agreed to in writing,

-// software distributed under the License is distributed on an

-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

-// KIND, either express or implied.  See the License for the

-// specific language governing permissions and limitations

-// under the License.

-//

-//

-//   Message file include

-//

-LANGUAGE 0x9,0x1

-1 11 MSG00001.bin

-// Microsoft Visual C++ generated resource script.

-//

-#include "windows.h"

-

-#define APSTUDIO_READONLY_SYMBOLS

-/////////////////////////////////////////////////////////////////////////////

-//

-// Generated from the TEXTINCLUDE 2 resource.

-//

-//#include "afxres.h"

-

-/////////////////////////////////////////////////////////////////////////////

-#undef APSTUDIO_READONLY_SYMBOLS

-

-/////////////////////////////////////////////////////////////////////////////

-// English (U.S.) resources

-

-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

-#ifdef _WIN32

-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

-#pragma code_page(1252)

-#endif //_WIN32

-

-#ifdef APSTUDIO_INVOKED

-/////////////////////////////////////////////////////////////////////////////

-//

-// TEXTINCLUDE

-//

-

-1 TEXTINCLUDE

-BEGIN

-    "resource.h\0"

-END

-

-2 TEXTINCLUDE

-BEGIN

-    "#include ""afxres.h""\r\n"

-    "\0"

-END

-

-3 TEXTINCLUDE

-BEGIN

-    "\r\n"

-    "\0"

-END

-

-#endif    // APSTUDIO_INVOKED

-

-

-/////////////////////////////////////////////////////////////////////////////

-//

-// Version

-//

-#include <log4cxx/version_info.h>

-

-VS_VERSION_INFO VERSIONINFO

- FILEVERSION INFO_FILE_VERSION_LIST

- PRODUCTVERSION INFO_PRODUCT_VERSION_LIST

- FILEFLAGSMASK 0x17L

-#ifdef _DEBUG

- FILEFLAGS 0x1L

-#else

- FILEFLAGS 0x0L

-#endif

- FILEOS 0x4L

- FILETYPE 0x2L

- FILESUBTYPE 0x0L

-BEGIN

-    BLOCK "StringFileInfo"

-    BEGIN

-        BLOCK "040904b0"

-        BEGIN

-            VALUE "CompanyName", "Apache Software Foundation"

-            VALUE "FileDescription", "Apache log4cxx"

-            VALUE "FileVersion", INFO_FILE_VERSION_STRING

-            VALUE "InternalName", "log4cxx"

-            VALUE "LegalCopyright",  "Licensed to the Apache Software Foundation (ASF) under one or more\ncontributor license agreements.  See the NOTICE file distributed with\nthis work for additional information regarding copyright ownership.\nThe ASF licenses this file to You under the Apache License, Version 2.0\n(the ""License""); you may not use this file except in compliance with\nthe License.  You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an ""AS IS"" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License."

-            VALUE "OriginalFilename", "log4cxx.dll"

-            VALUE "ProductName", "Apache log4cxx"

-            VALUE "ProductVersion", INFO_PRODUCT_VERSION_STRING

-        END

-    END

-    BLOCK "VarFileInfo"

-    BEGIN

-        VALUE "Translation", 0x409, 1200

-    END

-END

-

-#endif    // English (U.S.) resources

-/////////////////////////////////////////////////////////////////////////////

-

-

-

-#ifndef APSTUDIO_INVOKED

-/////////////////////////////////////////////////////////////////////////////

-//

-// Generated from the TEXTINCLUDE 3 resource.

-//

-

-

-/////////////////////////////////////////////////////////////////////////////

-#endif    // not APSTUDIO_INVOKED

-

+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+//
+//   Message file include
+//
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
+// Microsoft Visual C++ generated resource script.
+//
+#include "windows.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+#include <log4cxx/version_info.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION INFO_FILE_VERSION_LIST
+ PRODUCTVERSION INFO_PRODUCT_VERSION_LIST
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName", "Apache Software Foundation"
+            VALUE "FileDescription", "Apache log4cxx"
+            VALUE "FileVersion", INFO_FILE_VERSION_STRING
+            VALUE "InternalName", "log4cxx"
+            VALUE "LegalCopyright",  "Licensed to the Apache Software Foundation (ASF) under one or more\ncontributor license agreements.  See the NOTICE file distributed with\nthis work for additional information regarding copyright ownership.\nThe ASF licenses this file to You under the Apache License, Version 2.0\n(the ""License""); you may not use this file except in compliance with\nthe License.  You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an ""AS IS"" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License."
+            VALUE "OriginalFilename", "log4cxx.dll"
+            VALUE "ProductName", "Apache log4cxx"
+            VALUE "ProductVersion", INFO_PRODUCT_VERSION_STRING
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/src/test/cpp/CMakeLists.txt b/src/test/cpp/CMakeLists.txt
index bc38e91..ccffcbc 100644
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@ -1,6 +1,5 @@
 # Components required by all tests
 add_library(testingFramework STATIC abts.cpp appenderskeletontestcase.cpp logunit.cpp vectorappender.cpp writerappendertestcase.cpp )
-target_compile_features(testingFramework PUBLIC cxx_std_17)
 target_compile_definitions(testingFramework PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
 target_include_directories(testingFramework PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
 add_subdirectory(util)
@@ -90,8 +89,6 @@
     target_compile_definitions(${testName} PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
     target_include_directories(${testName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
     target_link_libraries(${testName} PRIVATE testingFramework testingUtilities log4cxx ${APR_LIBRARIES} ${APR_SYSTEM_LIBS} Threads::Threads)
-    target_compile_features(${testName} PUBLIC
-        cxx_std_17)
     add_test(NAME ${testName}
         COMMAND ${testName} -v
         WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../resources
diff --git a/src/test/cpp/asyncappendertestcase.cpp b/src/test/cpp/asyncappendertestcase.cpp
index f98fe82..7130e56 100644
--- a/src/test/cpp/asyncappendertestcase.cpp
+++ b/src/test/cpp/asyncappendertestcase.cpp
@@ -30,7 +30,6 @@
 #include <log4cxx/spi/location/locationinfo.h>
 #include <log4cxx/xml/domconfigurator.h>
 #include <log4cxx/file.h>
-#include <mutex>
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -68,7 +67,7 @@
 class BlockableVectorAppender : public VectorAppender
 {
 	private:
-        std::mutex blocker;
+		log4cxx::mutex blocker;
 	public:
 		/**
 		 * Create new instance.
@@ -82,7 +81,7 @@
 		 */
 		void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p)
 		{
-            std::unique_lock lock( blocker );
+			log4cxx::unique_lock<log4cxx::mutex> lock( blocker );
 			VectorAppender::append(event, p);
 
 			//
@@ -98,14 +97,14 @@
 			}
 		}
 
-        std::mutex& getBlocker()
+		log4cxx::mutex& getBlocker()
 		{
 			return blocker;
 		}
 
 };
 
-typedef std::shared_ptr<BlockableVectorAppender> BlockableVectorAppenderPtr;
+LOG4CXX_PTR_DEF(BlockableVectorAppender);
 
 #if APR_HAS_THREADS
 /**
@@ -255,7 +254,7 @@
 			LoggerPtr rootLogger = Logger::getRootLogger();
 			rootLogger->addAppender(async);
 			{
-                std::unique_lock sync(blockableAppender->getBlocker());
+				log4cxx::unique_lock<log4cxx::mutex> sync(blockableAppender->getBlocker());
 
 				for (int i = 0; i < 140; i++)
 				{
diff --git a/src/test/cpp/helpers/CMakeLists.txt b/src/test/cpp/helpers/CMakeLists.txt
index 72ed74a..c40681c 100644
--- a/src/test/cpp/helpers/CMakeLists.txt
+++ b/src/test/cpp/helpers/CMakeLists.txt
@@ -23,8 +23,6 @@
     add_executable(${fileName} "${fileName}.cpp")
     target_compile_definitions(${fileName} PRIVATE ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
     target_include_directories(${fileName} PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES> ${APR_INCLUDE_DIR})
-    target_compile_features(${fileName} PUBLIC
-        cxx_std_17)
 endforeach()
 target_sources(cacheddateformattestcase PRIVATE localechanger.cpp)
 target_sources(datetimedateformattestcase PRIVATE  localechanger.cpp)
diff --git a/src/test/cpp/helpers/charsetencodertestcase.cpp b/src/test/cpp/helpers/charsetencodertestcase.cpp
index e12ecbf..214d210 100644
--- a/src/test/cpp/helpers/charsetencodertestcase.cpp
+++ b/src/test/cpp/helpers/charsetencodertestcase.cpp
@@ -21,9 +21,7 @@
 #include <log4cxx/helpers/bytebuffer.h>
 #include <apr.h>
 #include <apr_atomic.h>
-#include <mutex>
 #include <condition_variable>
-#include <thread>
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -190,13 +188,13 @@
 
 			void await()
 			{
-                std::unique_lock sync(lock);
+				log4cxx::unique_lock<log4cxx::mutex> sync(lock);
                 condition.wait(sync);
 			}
 
 			void signalAll()
 			{
-                std::unique_lock sync(lock);
+				log4cxx::unique_lock<log4cxx::mutex> sync(lock);
                 condition.notify_all();
 			}
 
@@ -299,8 +297,8 @@
 			ThreadPackage(const ThreadPackage&);
 			ThreadPackage& operator=(ThreadPackage&);
 			Pool p;
-            std::mutex lock;
-            std::condition_variable condition;
+			mutex lock;
+			condition_variable condition;
 			volatile apr_uint32_t passCount;
 			volatile apr_uint32_t failCount;
 			CharsetEncoderPtr enc;
@@ -310,13 +308,13 @@
 	void thread1()
 	{
 		enum { THREAD_COUNT = 10, THREAD_REPS = 10000 };
-        std::thread threads[THREAD_COUNT];
+		log4cxx::thread threads[THREAD_COUNT];
 		CharsetEncoderPtr enc(CharsetEncoder::getEncoder(LOG4CXX_STR("ISO-8859-1")));
 		ThreadPackage* package = new ThreadPackage(enc, THREAD_REPS);
 		{
 			for (int i = 0; i < THREAD_COUNT; i++)
 			{
-                threads[i] = std::thread(&ThreadPackage::run, package);
+				threads[i] = log4cxx::thread(&ThreadPackage::run, package);
 			}
 		}
 		//
diff --git a/src/test/cpp/util/CMakeLists.txt b/src/test/cpp/util/CMakeLists.txt
index e6da43e..c818ab8 100644
--- a/src/test/cpp/util/CMakeLists.txt
+++ b/src/test/cpp/util/CMakeLists.txt
@@ -20,5 +20,3 @@
 )
 target_compile_definitions(testingUtilities PRIVATE ${LOG4CXX_COMPILE_DEFINITIONS} ${APR_COMPILE_DEFINITIONS} ${APR_UTIL_COMPILE_DEFINITIONS} )
 target_include_directories(testingUtilities PRIVATE ${CMAKE_CURRENT_LIST_DIR} $<TARGET_PROPERTY:log4cxx,INCLUDE_DIRECTORIES>)
-target_compile_features(testingUtilities PUBLIC
-    cxx_std_17)
diff --git a/src/test/cpp/vectorappender.cpp b/src/test/cpp/vectorappender.cpp
index 4698e3d..e562513 100644
--- a/src/test/cpp/vectorappender.cpp
+++ b/src/test/cpp/vectorappender.cpp
@@ -16,7 +16,6 @@
  */
 
 #include "vectorappender.h"
-#include <thread>
 
 using namespace log4cxx;
 using namespace log4cxx::helpers;
@@ -25,7 +24,7 @@
 
 void VectorAppender::append(const spi::LoggingEventPtr& event, Pool& /*p*/)
 {
-    std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
+	std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
 
 	vector.push_back(event);
 }