Git Product home page Git Product logo

log4cplus / log4cplus Goto Github PK

View Code? Open in Web Editor NEW
1.6K 91.0 559.0 26.1 MB

log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API.

Home Page: https://log4cplus.github.io/log4cplus/

License: Other

Emacs Lisp 0.02% CMake 2.77% Scheme 0.25% Shell 28.40% C++ 41.66% C 0.19% Perl 0.46% Batchfile 0.08% Makefile 19.12% M4 6.99% Roff 0.07%
log4cplus cxx logging logging-library

log4cplus's Introduction

% log4cplus README

Short Description

log4cplus is a simple to use C++20 logging API providing thread--safe, flexible, and arbitrarily granular control over log management and configuration. It is modeled after the Java log4j API.

Latest Project Information

The latest up-to-date information for this project can be found on GitHub project page or log4cplus wiki there. Please submit bugs, patches, feature requests, etc., on GitHub.

Mission statement

The aim of this project is to develop log4j--like logging framework for use in (primarily) C++. One of the major design goals is to avoid huge dependencies (like Boost) in the core functionality and to use standard C++ facilities instead. Where possible, the project takes inspiration from other logging libraries, beside from log4j (e.g., from log4net, log4cxx, log4cpp).

Platform support

log4cplus version 3.0 and beyond require C++20. log4cplus has been ported to and tested on the following platforms:

  • Linux/AMD64 with GCC version 8.3.0 (Ubuntu 8.3.0-6ubuntu1)
  • Linux/AMD64 with Clang version 8.0.0-3 (tags/RELEASE_800/final)
  • Windows/AMD64 with GCC version 4.8.2 (x86_64-posix-seh-rev3, Built by MinGW-W64 project) using CMake build system
  • Windows/AMD64 with GCC version 4.9.2 (tdm64-1) using CMake build system
  • Windows 7 with MS Visual Studio 2015
  • OpenBSD 5.6/AMD64 with GCC version 4.9.0
  • FreeBSD 10.1/i386 with Clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032)
  • NetBSD 6.1.5/AMD64 with GCC version 4.9.1
  • DragonflyBSD 4.0.1/AMD64 with GCC version 4.9.3 20141126 (prerelease) (FreeBSD Ports Collection)
  • OpenIndiana Hipster 2016.10 with GCC version 4.9.4

The testing on the above listed platforms has been done at some point in time with some version of source. Continuous testing is done only on Linux platform offered by [Travis CI][11] service.

The oldest Windows version that is supported by 2.x releases is Windows Vista.

The following platforms were supported by the 1.x series of log4cplus. They either do not have a reasonable C++20 capable compiler or have not been checked with log4cplus 3.x, yet:

  • Minix 3.3.0/i386 with Clang version 3.4 (branches/release_34) with --disable-threads
  • Linux/AMD64 with Intel Parallel Studio XE 2015, ICPC version 15.0.1
  • OpenSolaris with -library=stlport4
  • Solaris with -library=stlport4 and with -library=Cstd.
  • Solaris 5.10/Sparc
  • MacOS X 10.8
  • MacOS X 11.4.2
  • HP-UX (hppa2.0w-hp-hpux11.11)
  • Haiku R1 Alpha 4.1
  • AIX 5.3 with IBM XL C/C++ for AIX

Installation instruction

Generic Autotools installation instructions are in INSTALL file. The following are log4cplus specific instructions.

log4cplus uses Git sub-modules. Always use --recurse-submodules option when doing git clone.

Configure script options

--enable-debugging

This option is disabled by default. This option mainly affects GCC builds but it also has some limited effect on non-GCC builds. It turns on debugging information generation, undefines NDEBUG symbol and adds -fstack-check (GCC).

--enable-warnings

This option is enabled by default. It adds platform / compiler dependent warning options to compiler command line.

--enable-so-version

This option is enabled by default. It enables SO version decoration on resulting library file, e.g., the .2.0.0 in liblog4cplus-1.2.so.2.0.0.

--enable-release-version

This option is enabled by default. It enables release version decoration on the resulting library file, e.g., the -1.2 in liblog4cplus-1.2.so.2.0.0.

--enable-symbols-visibility-options

This option is enabled by default. It enables use of compiler and platform specific option for symbols visibility. See also the Visibility page on GCC Wiki.

--enable-profiling

This option is disabled by default. This option adds profiling information generation compiler option -pg to GCC and Sun CC / Solaris Studio builds.

--enable-threads

This option is enabled by default. It turns on detection of necessary compiler and linker flags that enable POSIX threading support.

While this detection usually works well, some platforms still need help with configuration by supplying additional flags to the configure script. One of the know deficiencies is Solaris Studio on Linux. See one of the later note for details.

--enable-tests

This option is enabled by default. It enables compilation of test executables.

--enable-unit-tests

This option is disabled by default. It enables compilation of unit tests along their units. These unit tests then can be executed through unit_tests test executable that is built during compilation.

--enable-implicit-initialization

This option is enabled by default. It enables implicit initialization of log4cplus. When it is turned off, log4cplus has to be explicitly initialized by calling either log4cplus::initialize() or by instantiating log4cplus::Initializer.

--enable-lto

This option is disabled by default. It enables LTO (Link-Time Optimization) builds.

--with-wchar_t-support

This option is enabled by default. When enabled, additional binaries will be built, marked with U suffix in file name and compiled with -DUNICODE=1 flag. In effect, these binaries assume that log4cplus::tchar is wchar_t.

--with-working-locale

This is one of three locale and wchar_tchar conversion related options. It is disabled by default.

It is know to work well with GCC on Linux. Other platforms generally have lesser locale support in their implementations of the C++ standard library. It is known not to work well on any BSDs.

See also docs/unicode.txt.

--with-working-c-locale

This is second of wchar_tchar conversion related options. It is disabled by default.

It is known to work well on most Unix--like platforms, including recent Cygwin.

--with-iconv

This is third of wchar_tchar conversion related options. It is disabled by default.

The conversion using iconv() function always uses "UTF-8" and "WCHAR_T" as source/target encoding. It is known to work well on platforms with GNU iconv. Different implementations of iconv() might not support "WCHAR_T" encoding selector.

Either system provided iconv() or library provided libiconv() are detected and accepted. Also both SUSv3 and GNU iconv() function signatures are accepted.

--with-qt

This option is disabled by default. It enables compilation of a separate shared library (liblog4cplusqt4debugappender) that implements Qt4DebugAppender. It requires Qt4 and pkg-config to be installed.

--with-qt5

This option is disabled by default. It enables compilation of a separate shared library (liblog4cplusqt5debugappender) that implements Qt5DebugAppender. It requires Qt5 and pkg-config to be available.

Notes

Compilation

On Unix--like platforms, log4cplus can be compiled using either autotools based build system or using CMake build system. The autotools based build system is considered to be primary for Unix--like platforms.

On Windows, the primary build system is Visual Studio 2015 solution and projects (msvc14/log4cplus.sln).

MinGW is supported by autotools based build system. CMake build system is supported as well and it should be used to compile log4cplus with older versions of Visual Studio or with less common compiler suites (e.g., Embarcadero, Code::Blocks, etc.).

Cygwin

Cygwin 2.5.x has a problem1 linking binaries that use language level thread-local storage and share thread-local variables across translation units. To avoid the issue language level thread-local storage is not used on Cygwin and traditional POSIX thread-local storage is used instead.

MinGW and MSVCRT version

log4cplus can use functions like _vsnprintf_s() (Microsoft's secure version of vsnprintf()). MinGW tool--chains (by default) link to the system MSVCRT.DLL. Unfortunately, older systems, like Windows XP, ship with MSVCRT.DLL that lacks these functions. It is possible to compile log4cplus with MinGW tool--chains but without using Microsoft's secure functions by defining __MSVCRT_VERSION__ to value less than 0x900 and vice versa.

$ ../configure CPPFLAGS="-D__MSVCRT_VERSION__=0x700"

Windows and Visual Studio

log4cplus uses C++11 thread and synchronization facilities. The synchronization facilities are implemented in Visual Studio C++ standard library in a way that utilizes global variables. Therefore it is impossible (due to "static initialization order fiasco") to use them outside main(). This issue manifests as a deadlock on exit during destruction of log4cplus' thread pool.

To overcome this limitation,

  • always use log4cplus::Initializer initializer; as the first thing in main();

  • never try to log from static/global objects constructors;

  • never try to log from static/global object destructors.

Defining the log4cplus::Initializer instance as the first thing in main() ensures that log4cplus is initialized. More importantly, it ensures that log4cplus shuts down before the execution leaves the main() function. log4cplus will try to automatically initialize at process startup and/or on DLL load, and will not tear down until all log4cplus:Initializer instances are destroyed.

Windows and rolling file Appenders

On Windows, the standard C++ file streams open files in way that underlying Win32 file HANDLE is not open with FILE_SHARE_DELETE flag. This flag, beside shared delete, allows renaming files that have handles open to them. This issue manifests as error code 13 when the file needs to be rolled over and it is still open by another process.

This is also bug #167 on SourceForge.

Windows and TLS

log4cplus uses thread--local storage (TLS) for NDC, MDC and to optimize use of some temporary objects. On Windows there are two ways to get TLS:

  1. using TlsAlloc(), etc., functions
  2. using __declspec(thread)

While method (2) generates faster code, it has some limitations prior to Windows Vista. If log4cplus.dll is loaded at run time using LoadLibrary() (or as a dependency of such loaded library), then accessing __declspec(thread) variables can cause general protection fault (GPF) errors. This is because Windows prior to Windows Vista do not extend the TLS for libraries loaded at run time using LoadLibrary(). To allow using the best available method, log4cplus enables the method (2) by checking _WIN32_WINNT >= 0x0600 condition, when compiling log4cplus targeted to Windows Vista or later.

Linking on Windows

If you are linking your application with DLL variant of log4cplus, define LOG4CPLUS_BUILD_DLL preprocessor symbol. This changes definition of LOG4CPLUS_EXPORT symbol to __declspec(dllimport).

Android, TLS and CMake

log4cplus uses thread--local storage (TLS, see "Windows and TLS" for details). On the Android platform, when log4cplus is being compiled using the android/android.toolchain.cmake, you might get errors featuring the __emutls symbol:

global-init.cxx:268:46: error: log4cplus::internal::__emutls_t._ZN9log4cplus8internal3ptdE causes a section type conflict with log4cplus::internal::ptd

To work around this issue, invoke CMake with -DANDROID_FUNCTION_LEVEL_LINKING:BOOL=OFF option.

Threads and signals

log4cplus is not safe to be used from asynchronous signals' handlers. This is a property of most threaded programmes in general. If you are going to use log4cplus in threaded application and if you want to use log4cplus from signal handlers then your only option is to block signals in all threads but one that will handle all signals. On POSIX platforms, this is possible using the sigwait() call. log4cplus enables this approach by blocking all signals in any threads created through its threads helpers.

IBM's XL C/C++ compiler

IBM's XL C/C++ compiler executable has many variants. To compile log4cplus with threading support specify one of the compiler variants that support threading using the CXX variable on configure script command line. E.g.:

$ ../configure --enable-threads CXX=xlC_r

AIX reentrancy problem

There appears to be a reentracy problem with AIX 5.3 and xlC 8 which can result into a deadlock condition in some circumstances. It is unknown whether the problem manifests with other versions of either the OS or the compiler, too. The problem was initially reported in a bug report #103.

The core of the problem is that IBM's/xlC's standard C++ IOStreams implementation uses global non recursive lock to protect some of its state. The application in the bug report was trying to do logging using log4cplus from inside overflow() member function of a class derived from std::streambuf class. log4cplus itself uses std::ostringstream. This resulted into an attempt to recursively lock the global non recursive lock and a deadlock.

Solaris / SunOS

Some older version of this operating system might have problems linking log4cplus due to missing __tls_get_addr in their unpatched state.

Solaris Studio

Solaris Studio compilers' default standard C++ library is very non-standard. It seems that it is not conforming enough in, e.g., Sun C++ 5.12 Linux_i386 2011/11/16 (missing std::time_t, etc.), but it works well enough on Solaris with Sun C++ 5.8 2005/10/13. Thus log4cplus adds -library=stlport4 to the CXXFLAGS environment variable, unless a switch matching -library=(stlport4|stdcxx4|Cstd) is already present there. If you want to override the default supplied by log4cplus, just set it into CXXFLAGS on configure script command line.

Solaris Studio supports the __func__ symbol which can be used by log4cplus to record function name in logged events. To enable this feature, add -features=extensions switch to CXXFLAGS for configure script. Subsequently, you will have to add this switch to your application's build flags as well.

Solaris Studio on GNU/Linux

The autotools and our configure.ac combo does not handle Solaris Studio compiler on Linux well enough and needs a little help with configuration of POSIX threads:

$ COMMON_FLAGS="-L/lib/x86_64-linux-gnu/ \
-L/usr/lib/x86_64-linux-gnu/ -mt=yes -O"

$ ../configure --enable-threads=yes \
CC=/opt/solarisstudio12.3/bin/cc \
CXX=/opt/solarisstudio12.3/bin/CC \
CFLAGS="$COMMON_FLAGS" \
CXXFLAGS="$COMMON_FLAGS" \
LDFLAGS="-lpthread"

HP-UX with aCC

It is necessary to turn on C++98 mode of aCC by providing the -AA flag:

$ ../configure --enable-threads=yes CXXFLAGS="-AA"

HP-UX with aCC on IA64

There is a problem on IA64 HP-UX with aCC (HP C/aC++ B3910B A.06.20). The problem manifests as unsatisfied symbols during linking of loggingserver:

ld: Unsatisfied symbol "virtual table of loggingserver::ClientThread" in file loggingserver.o

The problem appears to be a deficiency in aCC and its support of __declspec(dllexport). To work around this issue, add --disable-symbols-visibility-options to configure script command line:

$ ../configure --disable-symbols-visibility-options \
--enable-threads=yes CXXFLAGS="-AA"

Haiku

Haiku is supported with GCC 4+. The default GCC version in Haiku is set to version 2 (based on GCC 2.95.x). To change the default GCC version to version 4, please run setgcc gcc4 command. This is to avoid linking errors like this:

main.cpp:(.text.startup+0x54a): undefined reference to `_Unwind_Resume'

Running the command switches the current GCC version to version 4. This change is permanent and global. See also Haiku ticket #8368.

Qt4 / Win32 / MSVC

In order to use log4cplus in Qt4 programs it is necessary to set following option: Treat WChar_t As Built in Type: No (/Zc:wchar_t-)

Set this option for log4cplus project and Qt4DebugAppender project in MS Visual Studio. Remember to use Unicode versions of log4cplus libraries with Qt. It is also necessary to make clear distinction between debug and release builds of Qt project and log4cplus. Do not use log4cplus release library with debug version of Qt program and vice versa.

For registering Qt4DebugAppender library at runtime, call this function: log4cplus::Qt4DebugAppender::registerAppender()

Add these lines to qmake project file for using log4cplus and Qt4DebugAppender:

INCLUDEPATH += C:\log4cplus\include
win32 {
    CONFIG(debug, debug|release) {
        LIBS += -LC:\log4cplus\msvc14\Win32\bin.Debug_Unicode -llog4cplusUD
        LIBS += -LC:\log4cplus\msvc14\Win32\bin.Debug_Unicode -llog4cplus-Qt4DebugAppender
    } else {
        LIBS += -LC:\log4cplus\msvc14\Win32\bin.Release_Unicode -llog4cplusU
        LIBS += -LC:\log4cplus\msvc14\Win32\bin.Release_Unicode -llog4cplus-Qt4DebugAppender
    }
}

Qt / GCC

You might encounter the following error during compilation with --with-qt option:

qglobal.h:943: error: ISO C++ does not support 'long long'

This is caused by -pedantic option that log4cplus adds to CXXFLAGS when compiling with GCC. To work around this issue, add -Wno-long-long GCC option to CXXFLAGS.

OpenBSD

OpenBSD 5.2 and earlier have a bug in wcsftime() function in handling of %% and %N where N is not a supported formatter. This is fixed in OpenBSD 5.3 and later. This shows as failing timeformat_test when log4cplus is compiled with -DUNICODE in CXXFLAGS.

iOS support

iOS support is based on CMake build. Use the scripts in iOS directory. The iOS.cmake toolchain file was originally taken from ios-cmake project.

To build the library for iOS, being in current folder, perform the steps below. For ARMv7 architecture:

$ ./scripts/cmake_ios_armv7.sh
$ cmake --build ./build_armv7 --config "Release"
$ cmake --build ./build_armv7 --config "Debug"

For i386 architecture:

$ ./scripts/cmake_ios_i386.sh
$ cmake --build ./build_i386 --config "Release"
$ cmake --build ./build_i386 --config "Debug"

Some versions of the iOS and/or its SDK have problems with thread-local storage (TLS) and getting through CMake's environment detection phase. To work around these issues, make these changes:

Edit the iOS.cmake file and add these two lines.

set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)

Add these lines. Customize them accordingly:

set(MACOSX_BUNDLE_GUI_IDENTIFIER com.example)
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
set(IPHONEOS_ARCHS arm64)

If you have issues with TLS, also comment out these lines:

set(LOG4CPLUS_HAVE_TLS_SUPPORT 1)
set(LOG4CPLUS_THREAD_LOCAL_VAR "__thread")

LOG4CPLUS_*_FMT() and UNICODE

Beware, the %s specifier does not work the same way on Unix--like platforms as it does on Windows with Visual Studio. With Visual Studio the %s specifier changes its meaning conveniently by printing wchar_t string when used with wprintf() and char strings when used with printf(). On the other hand, Unix--like platforms keeps the meaning of printing char strings when used with both wprintf() and printf(). It is necessary to use %ls (C99) specifier or %S (SUSv2) specifier to print wchar_t strings on Unix--like platforms.

The common ground for both platforms appears to be use of %ls and wchar_t string to print strings with unmodified formatting string argument on both Unix--like platforms and Windows. The conversion of wchar_t back to char then depends on C locale.

Unsupported compilers and platforms

log4cplus does not support too old or broken C++ compilers. Since log4cplus version 3.0.0, it means it does not support any platform or compiler without decent C++20 support.

  • Visual Studio prior to 2015
  • GCC prior to 4.8

Bug reporting instructions

For successful resolution of reported bugs, it is necessary to provide enough information:

  • log4cplus

    • What is the exact release version or Git branch and revision?
    • What is the build system that you are building log4cplus with (Autotools, Visual Studio solution and its version, CMake).
    • Autotools -- Provide configure script parameters and environment variables, attach generated config.log and defines.hxx files.
    • CMake -- Provide build configuration (Release, Debug, RelWithDebInfo) and non--default CMAKE_* variables values.
    • Visual Studio -- Provide project configuration (Release, Release_Unicode, Debug, Debug_Unicode) and Visual Studio version.
    • Provide target OS and CPU. In case of MinGW, provide its exact compiler distribution -- TDM? Nuwen? Other?
  • log4cplus client application

    • Are you using shared library log4cplus or as static library log4cplus?
    • Is log4cplus linked into an executable or into a shared library (DLL or SO)?
    • If log4cplus is linked into a shared library, is this library loaded dynamically or not?
    • What library file you are linking your application with -- log4cplus.lib, log4cplusUSD.lib, liblog4cplus.dll.a, etc., on Windows?
    • Is your application is using Unicode/wchar_t or not?
    • Provide any error messages.
    • Provide stack trace.
    • Provide log4cplus properties/configuration files.
    • Provide a self--contained test case, if possible.

License

This library is licensed under the Apache Public License 2.0 and two clause BSD license. Please read the included LICENSE file for details.

Contributions

log4cplus (bug tracker, files, wiki) is hosted on GitHub. See also Contributions topic on wiki.

Patches

Anybody can contribute to log4cplus development. If you are contributing a source code change, use a reasonable form: a merge request of a Git branch.

Formatting

Please use common sense. Follow the style of surrounding code. You can use the following Emacs style that is based on Microsoft's style as a guide line:

;; Custom MS like indentation style.
(c-add-style "microsoft"
             '("stroustrup"
               (c-offsets-alist
                (innamespace . -)
                (inline-open . 0)
                (inher-cont . c-lineup-multi-inher)
                (arglist-cont-nonempty . +)
                (template-args-cont . +))))

Tools

Build system

log4cplus supports multiple build systems (GNU Autoconf/Automake/Libtool aka Autotools, CMake and Visual Studio solution and project files).

Autotools is considered the primary build system on Unix--like platforms. However, CMake should still be usable on Unix--like platforms as well.

On Windows, it depends on compiler and tool-chain that you want to use. When using Visual Studio, use Visual Studio solution and project files. However, CMake build system should still work and produce useful results. When using some form of MinGW64 tool-chain, the CMake build system is considered primary and the Autotools based build system is unsupported. Use the MinGW Makefiles option and build with mingw-make (or similar). The MSYS Makefiles option is untested and unsupported.

Autotools

The Makefile.am files for this build systems are hand written. Some of them, however, are generated from Makefile.am.tpl and Makefile.am.def by GNU Autogen. This is to make adding new files to the source easier.

To regenerate Makefile.am files, configure script, testsuite script or any other part of the Autotools build system, use the scripts/doautoreconf.sh script from source root directory. It will invoke all the necessary tools in the correct order.

log4cplus closely follows Autoconf's, Automake's and Libtool's development and its master branch files are always generated using the latest available version of the tools.

Footnotes

  1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697

log4cplus's People

Contributors

ahmetfindi avatar amorozov avatar cfyzium avatar comargo avatar dmigous avatar dweekly avatar ejoerns avatar ffontaine avatar foxhlchen avatar frafjord avatar jiangrzh avatar khoyee avatar kkondrashov avatar leleliu008 avatar maichaell avatar malirod avatar michal42 avatar neheb avatar owlcoding avatar pavel-pimenov avatar pseiderer avatar rehsack avatar ruslo avatar sfzhang avatar snikulov avatar solicomo avatar vishtakalexey avatar wilx avatar wingunder avatar zcteo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

log4cplus's Issues

WARNING: 'aclocal-1.15' is missing on your system.

I am unable to resolve this problem, which happens when I issue any make command:

root@debian-vb-32bit:~/cpp/log4cplus# make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /root/cpp/log4cplus/missing aclocal-1.15 -I m4
/root/cpp/log4cplus/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
Makefile:1468: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 127

Even make clean throws this error. I tried to reset git repository and tried again:

git clean -df
git checkout -- .

But running configure causes the issue to reappear. I tried to set AM_MAINTAINER_MODE([disable]) in configure.ac as recommended on Stack Overflow but the issue persists. Is there a solution to this problem?
Thanks for any help.

remove logger

Hi, I'm working on an application, in which dynamically creating logger instance is needed !
Can log4cplus remove logger instance so the memory won't increase continuously ?

Can anybody help me?
Thanks

Uninitialized variables in TTCCLayout

Hello,
There is a difference in TTCCLayout definitions between 1.2.x and master branches:
https://github.com/log4cplus/log4cplus/blob/1.2.x/include/log4cplus/layout.h#L187-L190

       bool use_gmtime;
       bool thread_printing;
       bool category_prefixing;
       bool context_printing;

https://github.com/log4cplus/log4cplus/blob/master/include/log4cplus/layout.h#L188-L191

       bool use_gmtime = false;
       bool thread_printing = true;
       bool category_prefixing = true;
       bool context_printing = true;

As the result in 1.2.x when TTCCLayout is initialized by that ctor:

TTCCLayout::TTCCLayout(const log4cplus::helpers::Properties& properties)
    : Layout(properties)
    , dateFormat(properties.getProperty (LOG4CPLUS_TEXT("DateFormat"),
            internal::empty_str))
{
    properties.getBool (use_gmtime, LOG4CPLUS_TEXT("Use_gmtime"));
    properties.getBool (thread_printing, LOG4CPLUS_TEXT("ThreadPrinting"));
    properties.getBool (category_prefixing, LOG4CPLUS_TEXT("CategoryPrefixing"));
    properties.getBool (context_printing, LOG4CPLUS_TEXT("ContextPrinting"));
}

these 4 bools may remain uninitialized in release mode

Upd: VS 2015(update 1), x86, Release.

a bug in TimeBasedRollingFileAppender?

I am using log4cplus 1.2.0 rc3 now.

When I use TimeBasedRollingFileAppender, I find the last file will be empty after the program exits.

And I review the code, line 1213 in src/fileappender.cxx looks like a bug. why do you call rollover() function in the close() function ? after I comment the code, the last file works.

below is my config, is this a bug or my fault?

log4cplus.rootLogger=TRACE, trace

log4cplus.appender.trace=log4cplus::TimeBasedRollingFileAppender
log4cplus.appender.trace.MaxHistory=2
log4cplus.appender.trace.Filename=demo.trace
log4cplus.appender.trace.FilenamePattern=demo.trace.%d{yyyy-MM-dd-HH-mm}
log4cplus.appender.trace.CleanHistoryOnStart=false
log4cplus.appender.trace.filters.1=log4cplus::spi::LogLevelRangeFilter
log4cplus.appender.trace.filters.1.LogLevelMin=TRACE
log4cplus.appender.trace.filters.1.LogLevelMax=DEBUG
log4cplus.appender.trace.filters.1.AcceptOnMatch=true
log4cplus.appender.trace.filters.2=log4cplus::spi::DenyAllFilter
log4cplus.appender.trace.layout=log4cplus::PatternLayout
log4cplus.appender.trace.layout.ConversionPattern=%5p: %D: demo %T [%l] %m%n

missing -fPIC on 1.2.x branch for Autotools

as result when building shared lib libfoo.so, that includes liblog4cplus.a results in error:

log4cplus/lib/liblog4cplus.a(liblog4cplus_la-consoleappender.o): relocation R_X86_64_32 against `_ZTTN9log4cplus15ConsoleAppenderE' can not be used when making a shared object; recompile with -fPIC
/vagrant/target/native/debug/log4cplus/lib/liblog4cplus.a: error adding symbols: Bad value

Fail to build using mingw 4.9.1

Apparently mingw 4.9.1 doesn't have InterlockedExchangeAdd. Here's a patch to fix the socket code to compile on mingw 4.9.1.

--- src/socket-win32.cxx.orig   2016-01-15 16:18:55 -0600
+++ src/socket-win32.cxx        2016-01-15 17:32:08 -0600
@@ -89,7 +89,8 @@
         // Wait for state change.
         while (true)
         {
-            LONG state = InterlockedAdd (&winsock_state, 0);
+            //LONG state = InterlockedAdd (&winsock_state, 0);
+            LONG state = InterlockedExchangeAdd (&winsock_state, 0);
             switch (state)
             {
             case WS_INITIALIZED:

socketappender reconnect

How do i configure the socketappender reconnection. I find that if the socketappender lost connection from the loggingserver, some of log message will lost.

Crash on exit

Hey, I am trying to get started with log4cplus. I'm using a simple CMake configuration where I'm creating an executable and adding log4cplus.I simply cloned the log4cplus and pulled the submodules. I build log4cplus as a shared library and with /MTd on Win7 x64 with Visual Studio 2013.

Here is my code

#include <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/configurator.h>
#include <iomanip>

int main()
{
    log4cplus::initialize();
    log4cplus::BasicConfigurator config;
    config.configure();


    log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
    LOG4CPLUS_INFO(logger, "This is a INFO message");


    return 0;
}

the executable crashes in Hierarchy::shutdown() in the line at waitUntilEmptyThreadPoolQueue()

Here is the call stack

>   log4cplusD.dll!mtx_do_lock(_Mtx_internal_imp_t * * mtx, const xtime * target) Line 49   C++
    log4cplusD.dll!_Mtx_lock(_Mtx_internal_imp_t * * mtx) Line 154  C++
    log4cplusD.dll!std::_Mtx_lockX(_Mtx_internal_imp_t * * _Mtx) Line 68    C++
    log4cplusD.dll!std::_Mutex_base::lock() Line 42 C++
    log4cplusD.dll!std::unique_lock<std::mutex>::unique_lock<std::mutex>(std::mutex & _Mtx) Line 220    C++
    log4cplusD.dll!progschj::ThreadPool::wait_until_empty() Line 192    C++
    log4cplusD.dll!log4cplus::waitUntilEmptyThreadPoolQueue() Line 298  C++
    log4cplusD.dll!log4cplus::Hierarchy::shutdown() Line 244    C++
    log4cplusD.dll!log4cplus::Hierarchy::~Hierarchy() Line 81   C++
    [External Code] 
    log4cplusD.dll!log4cplus::`anonymous namespace'::destroy_default_context::~destroy_default_context() Line 166   C++
    [External Code] 

This issue might be really similar to #102

C++11 support

It would be nice to be able to build log4cplus with C++11. As it stands right now the usages of auto_ptr need to be removed as this is deprecated in C++11. There may be other issues as well.

iOS cmake issue

Not sure if this is a problem with the installed cmake 3.2.1 version, or some pathing problem. After cloning the repo I did this:
$ cd iOS
$ ./scripts/cmake_ios_armv7.sh
CMake Error: The source directory "/Users/grubm012/dev/log4cplus/iOS/build_armv7" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
./scripts/cmake_ios_armv7.sh: line 18: /Users/grubm012/dev/log4cplus/iOS/scripts/../..: is a directory

log4cplus-master In these places on the Win32 platform needs to be modified. msvc.diff

 include/log4cplus/config/win32.h         |  2 +-
 include/log4cplus/configurator.h         |  4 ++--
 msvc12/log4cplus.vcxproj                 | 35 ++++++++------------------------
 msvc12/log4cplus.vcxproj.filters         |  6 ------
 msvc12/log4cplusS.vcxproj                | 35 ++++++++------------------------
 msvc12/log4cplusS.vcxproj.filters        |  6 ------
 msvc12/tests/configandwatch_test.vcxproj | 16 +++++++--------
 msvc12/tests/filter_test.vcxproj         | 16 +++++++--------
 msvc12/tests/performance_test.vcxproj    | 16 +++++++--------
 msvc12/tests/propertyconfig_test.vcxproj | 16 +++++++--------
 src/socket.cxx                           |  7 ++++++-
 11 files changed, 57 insertions(+), 102 deletions(-)

diff --git a/include/log4cplus/config/win32.h b/include/log4cplus/config/win32.h
index fe70d30..cfcfd7d 100644
--- a/include/log4cplus/config/win32.h
+++ b/include/log4cplus/config/win32.h
@@ -170,7 +170,7 @@
 // completely forever.
 //
 //#    define LOG4CPLUS_INLINES_ARE_EXPORTED
-#  endif
+//#  endif
 #  define LOG4CPLUS_HAVE_FUNCTION_MACRO
 #  if defined (__MINGW32__)
 #    define LOG4CPLUS_WORKING_C_LOCALE
diff --git a/include/log4cplus/configurator.h b/include/log4cplus/configurator.h
index e5f3fa5..0443cdd 100644
--- a/include/log4cplus/configurator.h
+++ b/include/log4cplus/configurator.h
@@ -208,7 +208,7 @@ namespace log4cplus
          * log4cplus.appender.A1=log4cplus::SyslogAppender
          *
          * # The syslog daemon resides on www.abc.net
-         * log4cplus.appender.A1.SyslogHost=www.abc.net
+         * log4cplus.appender.A1.host=www.abc.net
          *
          * # A1's layout is a PatternLayout, using the conversion pattern
          * # <b>%r %-5p %c{2} %M.%L %x - %m\n</b>. Thus, the log output will
@@ -230,7 +230,7 @@ namespace log4cplus
          * log4cplus.appender.A2.MaxFileSize=10MB
          * log4cplus.appender.A2.MaxBackupIndex=1
          * log4cplus.appender.A2.layout=log4cplus::TTCCLayout
-         * log4cplus.appender.A2.layout.ContextPrinting=enabled
+         * 
          * log4cplus.appender.A2.layout.DateFormat=ISO8601
          *
          * # Root logger set to DEBUG using the A2 appender defined above.
diff --git a/msvc12/log4cplus.vcxproj b/msvc12/log4cplus.vcxproj
index 587c5dd..e88fda9 100644
--- a/msvc12/log4cplus.vcxproj
+++ b/msvc12/log4cplus.vcxproj
@@ -44,52 +44,52 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -824,24 +824,6 @@
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\src\logloguser.cxx">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
     <ClCompile Include="..\src\pointer.cxx">
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -1052,7 +1034,6 @@
     <ClInclude Include="..\include\log4cplus\thread\impl\tls.h" />
     <ClInclude Include="..\include\log4cplus\helpers\appenderattachableimpl.h" />
     <ClInclude Include="..\include\log4cplus\helpers\loglog.h" />
-    <ClInclude Include="..\include\log4cplus\helpers\logloguser.h" />
     <ClInclude Include="..\include\log4cplus\helpers\pointer.h" />
     <ClInclude Include="..\include\log4cplus\helpers\property.h" />
     <ClInclude Include="..\include\log4cplus\helpers\queue.h" />
diff --git a/msvc12/log4cplus.vcxproj.filters b/msvc12/log4cplus.vcxproj.filters
index 15efbb9..6353ca7 100644
--- a/msvc12/log4cplus.vcxproj.filters
+++ b/msvc12/log4cplus.vcxproj.filters
@@ -130,9 +130,6 @@
     <ClCompile Include="..\src\loglog.cxx">
       <Filter>helpers</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\logloguser.cxx">
-      <Filter>helpers</Filter>
-    </ClCompile>
     <ClCompile Include="..\src\pointer.cxx">
       <Filter>helpers</Filter>
     </ClCompile>
@@ -339,9 +336,6 @@
     <ClInclude Include="..\include\log4cplus\helpers\loglog.h">
       <Filter>helpers</Filter>
     </ClInclude>
-    <ClInclude Include="..\include\log4cplus\helpers\logloguser.h">
-      <Filter>helpers</Filter>
-    </ClInclude>
     <ClInclude Include="..\include\log4cplus\helpers\pointer.h">
       <Filter>helpers</Filter>
     </ClInclude>
diff --git a/msvc12/log4cplusS.vcxproj b/msvc12/log4cplusS.vcxproj
index 7d9d4f1..16eb7ac 100644
--- a/msvc12/log4cplusS.vcxproj
+++ b/msvc12/log4cplusS.vcxproj
@@ -43,49 +43,49 @@
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -650,24 +650,6 @@
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\src\logloguser.cxx">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
     <ClCompile Include="..\src\pointer.cxx">
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -971,7 +953,6 @@
     <ClInclude Include="..\include\log4cplus\config\windowsh-inc.h" />
     <ClInclude Include="..\include\log4cplus\helpers\appenderattachableimpl.h" />
     <ClInclude Include="..\include\log4cplus\helpers\loglog.h" />
-    <ClInclude Include="..\include\log4cplus\helpers\logloguser.h" />
     <ClInclude Include="..\include\log4cplus\helpers\pointer.h" />
     <ClInclude Include="..\include\log4cplus\helpers\queue.h" />
     <ClInclude Include="..\include\log4cplus\helpers\snprintf.h" />
diff --git a/msvc12/log4cplusS.vcxproj.filters b/msvc12/log4cplusS.vcxproj.filters
index 6148ed1..d3d268a 100644
--- a/msvc12/log4cplusS.vcxproj.filters
+++ b/msvc12/log4cplusS.vcxproj.filters
@@ -106,9 +106,6 @@
     <ClCompile Include="..\src\loglog.cxx">
       <Filter>helpers</Filter>
     </ClCompile>
-    <ClCompile Include="..\src\logloguser.cxx">
-      <Filter>helpers</Filter>
-    </ClCompile>
     <ClCompile Include="..\src\pointer.cxx">
       <Filter>helpers</Filter>
     </ClCompile>
@@ -291,9 +288,6 @@
     <ClInclude Include="..\include\log4cplus\helpers\loglog.h">
       <Filter>helpers</Filter>
     </ClInclude>
-    <ClInclude Include="..\include\log4cplus\helpers\logloguser.h">
-      <Filter>helpers</Filter>
-    </ClInclude>
     <ClInclude Include="..\include\log4cplus\helpers\pointer.h">
       <Filter>helpers</Filter>
     </ClInclude>
diff --git a/msvc12/tests/configandwatch_test.vcxproj b/msvc12/tests/configandwatch_test.vcxproj
index b8ae386..79c79ac 100644
--- a/msvc12/tests/configandwatch_test.vcxproj
+++ b/msvc12/tests/configandwatch_test.vcxproj
@@ -43,50 +43,50 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/msvc12/tests/filter_test.vcxproj b/msvc12/tests/filter_test.vcxproj
index 71d1423..6d53d2d 100644
--- a/msvc12/tests/filter_test.vcxproj
+++ b/msvc12/tests/filter_test.vcxproj
@@ -44,50 +44,50 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/msvc12/tests/performance_test.vcxproj b/msvc12/tests/performance_test.vcxproj
index 1fea8ce..8dbf7e1 100644
--- a/msvc12/tests/performance_test.vcxproj
+++ b/msvc12/tests/performance_test.vcxproj
@@ -43,50 +43,50 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/msvc12/tests/propertyconfig_test.vcxproj b/msvc12/tests/propertyconfig_test.vcxproj
index 57b4b45..f49ac7d 100755
--- a/msvc12/tests/propertyconfig_test.vcxproj
+++ b/msvc12/tests/propertyconfig_test.vcxproj
@@ -43,50 +43,50 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
     <WholeProgramOptimization>true</WholeProgramOptimization>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Unicode|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>CTP_Nov2013</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
diff --git a/src/socket.cxx b/src/socket.cxx
index a47e385..bbebfcb 100644
--- a/src/socket.cxx
+++ b/src/socket.cxx
@@ -216,7 +216,12 @@ Socket::write(const std::string & buffer)

 ServerSocket::ServerSocket (ServerSocket && other)
     : AbstractSocket (std::move (other))
-    , interruptHandles { -1, -1 }
+    ,
+#ifdef _MSC_VER
+    interruptHandles{ { -1, -1 } }
+#else
+    interruptHandles{ -1, -1 }
+#endif
 {
     interruptHandles.swap (other.interruptHandles);
 }

Appender.CreateDir doesn't work when Appender.UseLockFile=true

While using Lock files I get this error when the directory "logs" doesn't exist "log4cplus:ERROR could not open or create file /logs/some_name.log.lock"

Both CreateDirs and UseLockFile work correctly independently, but together the directory is not created prior to attempting to write to the lock file.

Example properties file:

log4cplus.appender.Name=log4cplus::RollingFileAppender
log4cplus.appender.Name.CreateDirs=true
log4cplus.appender.Name.File=./logs/some_name.log
log4cplus.appender.Name.UseLockFile=true
log4cplus.appender.Name.MaxFileSize=100MB
log4cplus.appender.Name.MaxBackupIndex=10

build failed vs2015

used "log4cplus-master" "msvc14" log4cplus.sln building failed ,error info:

“ThreadPool.h”: No such file or directory log4cplus log4cplus-master\src\global-init.cxx
“catch.hpp”: No such file or directory log4cplus log4cplus-master\src\mdc.cxx

Missing virtual destructors

These are minor issues, but got flagged by the static analyzer in Eclipse.

  • Class FactoryTempl has virtual method createObject, but non-virtual destructor in spi/factory.h
  • Class LocalFactoryBase has virtual method createObject, but non-virtual destructor in spi/factory.h
  • no break at end of case in property.cxx line 147
  • no break at end of case in property.cxx line 150

iOS only single-threaded?

Hello

log4cplus version 1.2

I have an issue. I've built log4cplus with multi-threaded version for iOS for armv7, arvm7s, arm64. When I tried to publish application that uses log4cplus in apple store they sent me back an error:

Dear developer,
We have discovered one or more issues with your recent delivery for "ProjectX". To process your delivery, the following issues must be corrected:
Non-public API usage:
• The app references non-public symbols in PROJECTX: __tlv_bootstrap
If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.

Then I investigated what is __tlv_bootstrap and found that only in arm64 version of liblog4cplus.a there is a usage of this symbol( a dependency to this symbol). As I understand it is due to Thread Local Storage usage? Also I found in log4cplus/iOS/scripts/cmake_ios_armv7.sh the flag -DLOG4CPLUS_SINGLE_THREADED="TRUE" does it mean that for iOS we can use only single threaded log4cplus?

Segmention fault at shutdown with CreateDirs property

Hi!

I am trying to use the CreateDirs property but I receive a segmention fault at shutdown and I couldn't find out what causes the problem.
Version: 1.2.0-RC3, 1.2.0
Stacktrace
Configuration file

I have initialized log4cplus with the following calls:
log4cplus::initialize();
log4cplus::PropertyConfigurator config("conf_log.conf");
config.configure();

Thanks for your help.

new clone fails to install after building

Hi,
I just did a fresh clone and build. Then during the install got this:
CMake Error at src/cmake_install.cmake:147 (FILE):
file INSTALL cannot find
"/home/roger/NetBeansProjects/log4cplus-dev/src/../include/log4cplus/thread/impl/syncprims-pthreads.h".
Call Stack (most recent call first):
cmake_install.cmake:37 (INCLUDE)
.....

The build script looks like

export LDFLAGS="-fPIC -pie "
export CFLAGS="-fPIC -fPIE -std=c++11"
export CXXFLAGS="-fPIC -fPIE -std=c++11"
export CPPFLAGS=-fPIC

make clean

mkdir build
cd build
ccmake -DCMAKE_INSTALL_PREFIX=pwd/../dist ..
make
make check
make html
make install

Release 1.2.0 // unable to compile with MSVS 2015 / CMake

MSVS 2015 compilation error

C:\WORK\GitHub\log4cplus\include\log4cplus/internal/socket.h(88): error C3861: FreeAddrInfoW: identifier not found

The problem is related to https://github.com/log4cplus/log4cplus/blob/REL_1_2_0/CMakeLists.txt#L73

set(_WIN32_WINNT 0x0500 CACHE STRING "Define Windows API version to use.")

Must be at least 0x0502, because this function available in Windows XP SP 2.

Or greater (Vista - 0x0600) as on master branch

Crash in ~per_thread_data

Log4cplus version: log4cplus-REL_1_2_0-RC5
Compiler: Visual Studio 2015
Configuration: Release - static lib
C-Runtime: Multi-threaded-DLL /MD

I build log4cplus with the solution provided in "msvc2010" ( "log4cplusS" project) with the release configuration.

Running this code gives an nullptr exception:

#include <log4cplus\configurator.h>
#include <log4cplus\loggingmacros.h>

int main() {

    log4cplus::initialize();
    log4cplus::BasicConfigurator::doConfigure();

    LOG4CPLUS_INFO(log4cplus::Logger::getInstance("main"), "Crash me");

    return 0;
}

Callstack:

ntdll.dll!_RtlFreeHeap@12() Unknown
ucrtbase.dll!_free() Unknown
logCrash.exe!std::allocator::deallocate(char * _Ptr, unsigned int _Count) Line 911 C++
logCrash.exe!log4cplus::internal::per_thread_data::~per_thread_data() Line 260 C++
logCrash.exe!log4cplus::thread_callback(void * __formal, unsigned long fdwReason, void * __formal) Line 455 C++
[External Code]

Looking into the '_free' function shows that the first argument for '_RtlFreeHeap' (the heap) is null. So it seams that the TLS Callback 'thread_callback' is called after unloading the crt which is responsible for the heap management.

log4cplus-master and log4cplus-1.2.x When calling a static library, will crash.

log4cplusS.lib
log4cplusSD.lib
log4cplusSU.lib
log4cplusSUD.lib

project use any one of those static library, it will crash.

crash address:
file: log4cplus-1.2.x\src\loglevel.cxx line48

line45-63

#define DEF_LL_STRING(_logLevel)                                        \
static tstring const & _logLevel ## _STRING ()                          \
{                                                                       \
    static tstring const str (LOG4CPLUS_TEXT (#_logLevel));             \
    return str;                                                         \
}

DEF_LL_STRING (OFF)
DEF_LL_STRING (FATAL)
DEF_LL_STRING (ERROR)
DEF_LL_STRING (WARN)
DEF_LL_STRING (INFO)
DEF_LL_STRING (DEBUG)
DEF_LL_STRING (TRACE)
DEF_LL_STRING (ALL)
DEF_LL_STRING (NOTSET)
DEF_LL_STRING (UNKNOWN)

#undef DEF_LL_STRING

line117-129

void
initializeLogLevelStrings ()
{
    OFF_STRING();
    FATAL_STRING();
    ERROR_STRING();
    WARN_STRING();
    INFO_STRING();
    DEBUG_STRING();
    TRACE_STRING();
    ALL_STRING();
    NOTSET_STRING();
}

Incorrect behavior in DailyRollingFileAppender::close()

Currently DailyRollingFileAppender::close() uncoditionally rolls over its files. This leads to a double rollover when used in a typical server application which uses fork() to put itself to background: first time the class rolls over when a parent process exits (usually quite soon after forking the child service process) and then when child (== actual server process) exits.

What's worth the actual logging is performed to a "backup log file", while the "regular log file" remains empty (the parent process moves the regular log file to backup on its exit, and the child process doesn't detect this).

A possible workaround/solution would be not to roll logfiles upon close() or maybe selectively skip rollover stage when such a use pattern is active.

`Time DailyRollingFileAppender::calculateNextRolloverTime(const Time& t)` not consider timezone

if timezone is not UTC, then rollover won't happen at midnight!
the bug happens when call round_time... function, as time_t=0 is not midnight.

    case DAILY:
        return round_time_and_add (t, Time (24 * 60 * 60));

fix: use localtime() to get struct tm, manipulate it according to DailyRollingFileSchedule. re-assign it back to Time.

static
Time
get_next_rollover_time (DailyRollingFileSchedule sch, const Time& t, bool use_gmtime = false)
{
    Time result(t.sec(), 0);

    struct tm time;
    if (use_gmtime)
        result.gmtime(&time);
    else
        result.localtime(&time);

    time.tm_isdst = 0;
    switch (sch)
    {
    case MONTHLY:
        time.tm_mon += 1; //next month
        time.tm_mday = 1; //first day
        time.tm_hour = 0;
        time.tm_min = 0;
        time.tm_sec = 0;
        break;

    case WEEKLY:
        time.tm_mday += (7 - time.tm_wday); //next Sunday
        time.tm_hour = 0;
        time.tm_min = 0;
        time.tm_sec = 0;
        break;

    case DAILY:
        time.tm_mday += 1; //next day
        time.tm_hour = 0;
        time.tm_min = 0;
        time.tm_sec = 0;
        break;

    case TWICE_DAILY:
        if(time.tm_hour >= 12) {
            time.tm_mday += 1; //next day
            time.tm_hour = 0;
        }
        else {
            time.tm_hour = 12;
        }
        time.tm_min = 0;
        time.tm_sec = 0;
        break;

    case HOURLY:
        time.tm_min = 0;
        time.tm_sec = 0;
        break;

    case MINUTELY:
        time.tm_sec = 0;
        break;
    };
    result.setTime(&time);

    return result;
}

hourly log delayed

After my service running for a month, I found the hourly output log was delayed;
My setting:

log4cplus.appender.UI=log4cplus::DailyRollingFileAppender
log4cplus.appender.UI.Schedule=HOURLY

and the hourly logs are generated at 26 minites of every hour
eg. with commend [ls -l] I get this:

-rw-r--r-- 1 resys resys  698763 6月  25 09:26 client_running.log.2015-06-25-08

client_running.log.2015-06-25-08 was generated at 09:26

fatal error: ThreadPool.h: No such file or directory

I get the above error when building log4cplus on Debian 8x32bit. The full context of the error is:

make[2]: Entering directory '/root/cpp/log4cplus-master'
/bin/bash ./libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H   -I./include -I./threadpool -I./include -I./catch/single_include -DCATCH_CONFIG_PREFIX_ALL=1 -DNDEBUG -DINSIDE_LOG4CPLUS -D_GNU_SOURCE=1 -D_REENTRANT  -std=c++0x -Wall -fdiagnostics-show-caret -ftrack-macro-expansion -fdiagnostics-color=auto -Wextra -pedantic -Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual -Wold-style-cast -Wundef -Wshadow -Wformat -Wnoexcept -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-variadic-macros -O2 -fvisibility=hidden -pthread -MT src/liblog4cplus_la-global-init.lo -MD -MP -MF src/.deps/liblog4cplus_la-global-init.Tpo -c -o src/liblog4cplus_la-global-init.lo `test -f 'src/global-init.cxx' || echo './'`src/global-init.cxx
libtool: compile:  g++ -DHAVE_CONFIG_H -I./include -I./threadpool -I./include -I./catch/single_include -DCATCH_CONFIG_PREFIX_ALL=1 -DNDEBUG -DINSIDE_LOG4CPLUS -D_GNU_SOURCE=1 -D_REENTRANT -std=c++0x -Wall -fdiagnostics-show-caret -ftrack-macro-expansion -fdiagnostics-color=auto -Wextra -pedantic -Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual -Wold-style-cast -Wundef -Wshadow -Wformat -Wnoexcept -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-variadic-macros -O2 -fvisibility=hidden -pthread -MT src/liblog4cplus_la-global-init.lo -MD -MP -MF src/.deps/liblog4cplus_la-global-init.Tpo -c src/global-init.cxx  -fPIC -DPIC -o src/.libs/liblog4cplus_la-global-init.o
src/global-init.cxx:35:24: fatal error: ThreadPool.h: No such file or directory
 #include "ThreadPool.h"
                        ^
compilation terminated.
Makefile:2552: recipe for target 'src/liblog4cplus_la-global-init.lo' failed
make[2]: *** [src/liblog4cplus_la-global-init.lo] Error 1
make[2]: Leaving directory '/root/cpp/log4cplus-master'
Makefile:3619: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/cpp/log4cplus-master'
Makefile:1432: recipe for target 'all' failed
make: *** [all] Error 2

Remove change of CMake target names

Running cmake on different platforms yields different targets, log4cplusS on Unix, and log4cplusSU on Windows f.i. This makes it hard for dependent targets, since TARGET_LINK_LIBRARIES must take this into account. I see no reason why the target cannot be simply called 'log4cplus', since there is only one target produced.

reversely iterate toStringMethods and fromStringMethods

In LogLevelManager::toString() and LogLevelManager::fromString() iterating the vector reversely can get the appropriate conversion function quickly when using the derived loglevels.
And also we have the change to modify the default loglevels' string, for example, just printing 'E' but not 'ERROR' when error occurred. Using the maximum field width(%.1p) cannot work, as the truncation is done from the beginning.(I cannot find out the reason.)

Cannot compile for i386 under debian 64bit

I have the nasty issue that I need to build both x64 and x32 versions of the latest release I downloaded from SourceForge. 64bit version works perfectly, but the 32bit build just isn't 32bit. What I did to compile was:

export CXXFLAGS="-std=c++0x -m32"

Although size of the output files was slightly different, they were still 64bit. Is it possible to achieve my goal?

log4cplus-master\include\log4cplus\config\win32.h line 173 should comment

#if defined (__GNUC__)
#  undef LOG4CPLUS_INLINES_ARE_EXPORTED
#  if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#    define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO
#    define LOG4CPLUS_HAVE_FUNC_SYMBOL
#  endif
// This has worked for some versions of MinGW with GCC 4.7+ but it
// appears to be broken again in 4.8.x. Thus, we disable this for GCC
// completely forever.
//
//#    define LOG4CPLUS_INLINES_ARE_EXPORTED
#  endif
#  define LOG4CPLUS_HAVE_FUNCTION_MACRO
#  if defined (__MINGW32__)
#    define LOG4CPLUS_WORKING_C_LOCALE
#  endif
#endif

log4cplus-1.2.x\src\fileappender.cxx line 1138 should be amended to filenamePattern(LOG4CPLUS_TEXT("%d.log"))

TimeBasedRollingFileAppender::TimeBasedRollingFileAppender(
    const log4cplus::helpers::Properties& properties)
    : FileAppenderBase(properties, std::ios_base::app)
    , filenamePattern("%d.log")
    , schedule(DAILY)
    , maxHistory(10)
    , cleanHistoryOnStart(false)
{
    filenamePattern = properties.getProperty(LOG4CPLUS_TEXT("FilenamePattern"));
    properties.getInt(maxHistory, LOG4CPLUS_TEXT("MaxHistory"));
    properties.getBool(cleanHistoryOnStart, LOG4CPLUS_TEXT("CleanHistoryOnStart"));
    filenamePattern = preprocessFilenamePattern(filenamePattern, schedule);

    init();
}

Uninitialized condition in TTCCLayout

This may be in other layouts as well. However if you initialize a TTCCLayout using the constructor that takes a properties object and the properties object does not have keys for all values, then accessing one of the instance variables gives an uninitialized condition error from valgrind.

I believe the solution for this is to provide a default value to properties.getBool (and other accessors as well) to ensure that the property gets a value even when the key doesn't exist. That or to initialize the variables to defaults in the initializer list of the constructor before the properties accessors are called.

iOS build complier erros

I try to follow ReadMe to build iOS armv7 but get the following errors:

$ cmake --build ./build_armv7/ --config "Debug"
=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT log4cplus WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/log4cplus.build/Debug-iphoneos/ZERO_CHECK.build
write-file /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/log4cplus.build/Debug-iphoneos/ZERO_CHECK.build/Script-8AF528BC9FC14DBCA8E3FC3B.sh
chmod 0755 /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/log4cplus.build/Debug-iphoneos/ZERO_CHECK.build/Script-8AF528BC9FC14DBCA8E3FC3B.sh

PhaseScriptExecution CMake\ Rules iOS/build_armv7/log4cplus.build/Debug-iphoneos/ZERO_CHECK.build/Script-8AF528BC9FC14DBCA8E3FC3B.sh
    cd /Workspace/MSME/ThirdParty/log4cplus
    /bin/sh -c /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/log4cplus.build/Debug-iphoneos/ZERO_CHECK.build/Script-8AF528BC9FC14DBCA8E3FC3B.sh
echo ""

make -f /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/CMakeScripts/ReRunCMake.make
make[1]: `/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/CMakeFiles/cmake.check_cache' is up to date.

=== BUILD TARGET log4cplusS OF PROJECT log4cplus WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7
write-file /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/log4cplusS.LinkFileList

CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appender.o src/appender.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Workspace/MSME/ThirdParty/log4cplus
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Workspace/VoiceEngine/MaaiiSipEngine3.0.0/Doubango/doubango/specialMedia/webrtc/depot_tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -miphoneos-version-min=7.1 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug/include -I/Workspace/MSME/ThirdParty/log4cplus/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources/armv7 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -DINSIDE_LOG4CPLUS -MMD -MT dependencies -MF /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appender.d --serialize-diagnostics /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appender.dia -c /Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx -o /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appender.o
clang: warning: argument unused during compilation: '-headerpad_max_install_names'
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:114:9: error: too many arguments provided to function-like macro invocation
        "microseconds");
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/loglevel.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:264:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:489:9: note: macro 'static_assert' defined here
#define static_assert(__b, __m) \
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:113:5: error: use of undeclared identifier 'static_assert'
    static_assert (std::ratio_equal<Duration::period, std::micro>::value,
    ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx:25:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:130:20: error: unknown type name 'constexpr'
            static constexpr
                   ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:131:13: error: expected member name or ';' after declaration specifiers
            bool
            ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:149:20: error: unknown type name 'constexpr'
            static constexpr
                   ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:150:13: error: expected member name or ';' after declaration specifiers
            bool
            ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:184:51: error: no member named 'is_negative' in 'log4cplus::helpers::ConvertIntegerToStringHelper<unsigned int, char, false>'
                bool const negative = HelperType::is_negative (value);
                                      ~~~~~~~~~~~~^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:213:13: note: in instantiation of function template specialization 'log4cplus::helpers::convertIntegerToString<std::__1::basic_string<char>, unsigned int>' requested here
            convertIntegerToString (result, value);
            ^
/Workspace/MSME/ThirdParty/log4cplus/src/appender.cxx:156:31: note: in instantiation of function template specialization 'log4cplus::helpers::convertIntegerToString<unsigned int>' requested here
        filterName = helpers::convertIntegerToString (++filterCount)))
                              ^
7 errors generated.

CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appenderattachableimpl.o src/appenderattachableimpl.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Workspace/MSME/ThirdParty/log4cplus
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Workspace/VoiceEngine/MaaiiSipEngine3.0.0/Doubango/doubango/specialMedia/webrtc/depot_tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -miphoneos-version-min=7.1 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug/include -I/Workspace/MSME/ThirdParty/log4cplus/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources/armv7 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -DINSIDE_LOG4CPLUS -MMD -MT dependencies -MF /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appenderattachableimpl.d --serialize-diagnostics /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appenderattachableimpl.dia -c /Workspace/MSME/ThirdParty/log4cplus/src/appenderattachableimpl.cxx -o /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appenderattachableimpl.o
clang: warning: argument unused during compilation: '-headerpad_max_install_names'
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appenderattachableimpl.cxx:22:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:114:9: error: too many arguments provided to function-like macro invocation
        "microseconds");
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appenderattachableimpl.cxx:22:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/loglevel.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:264:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:489:9: note: macro 'static_assert' defined here
#define static_assert(__b, __m) \
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/appenderattachableimpl.cxx:22:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:113:5: error: use of undeclared identifier 'static_assert'
    static_assert (std::ratio_equal<Duration::period, std::micro>::value,
    ^
2 errors generated.

CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/asyncappender.o src/asyncappender.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Workspace/MSME/ThirdParty/log4cplus
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Workspace/VoiceEngine/MaaiiSipEngine3.0.0/Doubango/doubango/specialMedia/webrtc/depot_tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -miphoneos-version-min=7.1 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug/include -I/Workspace/MSME/ThirdParty/log4cplus/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources/armv7 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -DINSIDE_LOG4CPLUS -MMD -MT dependencies -MF /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/asyncappender.d --serialize-diagnostics /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/asyncappender.dia -c /Workspace/MSME/ThirdParty/log4cplus/src/asyncappender.cxx -o /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/asyncappender.o
clang: warning: argument unused during compilation: '-headerpad_max_install_names'

CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/clogger.o src/clogger.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Workspace/MSME/ThirdParty/log4cplus
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Workspace/VoiceEngine/MaaiiSipEngine3.0.0/Doubango/doubango/specialMedia/webrtc/depot_tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -miphoneos-version-min=7.1 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug/include -I/Workspace/MSME/ThirdParty/l** BUILD FAILED **


The following build commands failed:
    CompileC iOS/build_armv7/src/logog4cplus/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources/armv7 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -DINSIDE_LOG4CPLUS -MMD -MT dependencies -MF /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/clogger.d --serialize-diagnostics /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/clogger.dia -c /Workspace/MSME/ThirdParty/log4cplus/src/clogger.cxx -o /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log44cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/appender.o src/appender.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC iOS/build_armv7/src/log4cplus.build/cplusS.build/Objects-normal/armv7/clogger.o
clang: warning: argument unused during compilation: '-headerpad_max_install_names'
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/clogger.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/logger.h:36:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/spi/appenderattachable.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:114:9: error: too many arguments provided to function-like macro invocation
        "microseconds");
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/clogger.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/logger.h:34:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/logleveDebug-iphoneos/log4cplusS.build/Objects-normal/armv7/appenderattachableimpl.o src/al.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:264:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:489:9: note: macro 'static_assert' defined here
#define static_assert(__b, __m) \
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/clogger.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/logger.h:36:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/spi/appenderattachable.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:113:5: error: use of undeclared identifier 'static_assert'
    static_assert (std::ratio_equal<Duration::period, std::micro>::value,
    ^
2 errors generated.

CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/configurator.o src/configurator.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Workspace/MSME/ThirdParty/log4cplus
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Workspace/VoiceEngine/MaaiiSipEngine3.0.0/Doubango/doubango/specialMedia/webrtc/depot_tools"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtualppenderattachableimpl.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/clogger.o src/clogger.-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -miphoneos-version-min=7.1 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug/include -I/Workspace/MSME/ThirdParty/log4cplus/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/include -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources/armcxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/configurator.o src/configurator.cxx normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
v7 -I/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/Binaries/Debug -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -DINSIDE_LOG4CPLUS -MMD -MT dependencies -MF /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/configurator.d --serialize-diagnostics /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/configurator.dia -c /Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx -o /Workspace/MSME/ThirdParty/log4cplus/iOS/build_armv7/src/log4cplus.build/Debug-iphoneos/log4cplusS.build/Objects-normal/armv7/configurator.o
clang: warning: argument unused during compilation: '-headerpad_max_install_names'
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/configurator.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:114:9: error: too many arguments provided to function-like macro invocation
        "microseconds");
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/configurator.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/loglevel.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:264:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:489:9: note: macro 'static_assert' defined here
#define static_assert(__b, __m) \
        ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx:21:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/configurator.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/appender.h:33:
In file included from /Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/layout.h:36:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/timehelper.h:113:5: error: use of undeclared identifier 'static_assert'
    static_assert (std::ratio_equal<Duration::period, std::micro>::value,
    ^
In file included from /Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx:25:
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:130:20: error: unknown type name 'constexpr'
            static constexpr
                   ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:131:13: error: expected member name or ';' after declaration specifiers
            bool
            ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:149:20: error: unknown type name 'constexpr'
            static constexpr
                   ^
/Workspace/MSME/ThirdParty/log4cplus/include/log4cplus/helpers/stringhelper.h:150:13: error: expected member name or ';' after declaration specifiers
            bool
            ^
/Workspace/MSME/ThirdParty/log4cplus/src/configurator.cxx:401:9: error: expected expression
        [](tchar const ch) -> bool { return ch == LOG4CPLUS_TEXT(' '); });
        ^
7 errors generated.

log4cplus-master and log4cplus-1.2.x property "SECURITY","SECURITY.access","class.of.the.day" not implemented

in ..\include\log4cplus\configurator.h (both log4cplus-master and log4cplus-1.2.x)

# Logger definitions:  
# The SECURITY logger inherits is LogLevel from root. However, it's output  
# will go to A1 appender defined above. It's additivity is non-cumulative.  
log4cplus.logger.SECURITY=INHERIT, A1  
log4cplus.additivity.SECURITY=false  

# Only warnings or above will be logged for the logger "SECURITY.access".  
# Output will go to A1.  
log4cplus.logger.SECURITY.access=WARN  


# The logger "class.of.the.day" inherits its LogLevel from the  
# logger hierarchy.  Output will go to the appender's of the root  
# logger, A2 in this case.  
log4cplus.logger.class.of.the.day=INHERIT  

Question regarding configuration of FileAppender and Appender in general

Hi,

While using log4cplus, I came across the following two questions that might rather be of conceptual nature:

  • Is it intended that a file is only written to by exactly one FileAppender? Technically, it is possible that I specify the same filename in two different FileAppenders. In the append method of a FileAppender the output stream is only flushed if UseLockFile or ImmediateFlush is true and also formatAndAppend does not perform a flush by default. So, I guess that using the same file from two different FileAppenders is undefined behavior (if immediateFlush is not set). Could you may be comment on that?
  • I've noticed that for logging events that are propagated to ancestors, the logging level is ignored. E.g. if I set the root logger to level INFO and attach a console appender to it and issue a DEBUG event to a logger some.logger whose level is set to DEBUG, the root logger will still print this event to the console. I've read several posts on Stackoverflow that confirm this, but only for log4j, for which this is actually the expected behavior. I currently work around this by setting the threshold level of the respective appender to some value (e.g. in the above example I would set the threshold level of the console appender attached to root to INFO). However, this is easily forgotten. I just wanted to know if you could comment on that as well and may be have a recommondation how this should/could be treated other than with the threshold level?

Thanks a lot in advance!

how build a server for appender

how build a server for appender, like SocketAppender has a test cxx, (tests/socket_test/main.cxx )

Log4jUdpAppender can?
AsyncAppender can ?
SysLogAppender can?

log4cplus provides ?

Building a multi-threaded server using QThreads - blocking read does not return

Hello,

I want to build a multi-threaded application which uses log4cplus::helpers::Sockets and a log4cplus::helpers::ServerSocket respectively. Because I need to display the log statements in an existing GUI, which was built with Qt, I'm using QThreads to manage the acceptor thread on the server and to dispatch threads that read from the client. I am encountering an issue that the blocking call to log4cplus::helpers::Socket::read does not return immediately when I call the close function on the respective socket - it only returns and breaks when the next log statement has arrived. It is very well possible that this problem is introduced by the way I handle my QThreads, so I'm going to post in more detail in the following what I'm doing exactly. If you have any suggestions / recommondations for a better implementation of this use case, they are very welcome! I am using version 1.1.3 rc 4.

Generally I have the following setup: A dispatcher thread (which is a QThread as mentioned before) continuously listens for incoming connections. It's run method looks like this:

mStopRequested = false;

// create the server socket
// mServerSocket is wrapped in a smart pointer
mServerSocket.reset(new log4cplus::helpers::ServerSocket(PORT));

if (!mServerSocket->isOpen()
  {
   std::cout << "ERROR: Could not open server socket" << std::endl;
   return;
}

while (!mStopRequested)
{
  // wait for incoming connection
  log4cplus::helpers::Socket _socket = mServerSocket->accept();

  if (!mStopRequested)
  {
    dispatch(_socket);
  }
}

The dispatch function creates a new worker thread (which is again a QThread). I only expect very few client connections, so I chose not to use a thread pool. The client socket returned from accept is passed to this worker in the constructor. The run method of a worker looks like the following (mSocket is the client socket passed via the constructor):

 std::cout << "start worker" << std::endl;
  mStopRequested = false;

  while (!mStopRequested)
  {
    if (!mSocket.isOpen())
    {
      std::cout << "ERROR: socket not open - abort") << std::endl;
      mStopRequested = true;
      continue;
    }

    // read size of the message
    log4cplus::helpers::SocketBuffer _msgSizeBuffer(sizeof(unsigned int));

    if (!mSocket.read(_msgSizeBuffer)) // here is the problem
    {
      if (errno == 10054)
      {
        std::cout << "Connection reset on client side - abort" << std::endl;
      }
      else
      {
        std::cout<< "ERROR: error reading size of message from buffer - abort" << std::endl;
      }
      mStopRequested = true;
      continue;
    }

    unsigned int _msgSize = _msgSizeBuffer.readInt();

    // read the message
    log4cplus::helpers::SocketBuffer _buffer(_msgSize);
    if (!mSocket.read(_buffer))
    {
      std::cout << "ERROR: error reading message from buffer - abort" << std::endl;
      mStopRequested = true;
      break;
    }

    log4cplus::spi::InternalLoggingEvent _event = log4cplus::helpers::readFromBuffer(_buffer);

    // do something with the message
    // ...
  }

The problem is that mSocket.read(_msgSizeBuffer) does not break immediately when I call mSocket.close() from the outside. It only breaks when another message arrives. Is this expected behaviour? Or am I messing things up because I access the socket from multiple threads? Would you recommend to use log4cplus::thread::AbstractThread rather than QThreads? I realize that this question might be very localized. So feel free to just point me towards some examples that I might not have found yet or highlight some design issues that I'm not aware of. In any case, thanks a lot for your help!

Stable release versioning question

Hello.

I would like to ask what are the plans WRT the versions of log4cplus that are being released? The latest really stable version released seems to be 1.1.2, which is quite old. Since then, there have been only RC versions (of 1.1.3 and 1.2.0).

In Fedora, we use the the https://release-monitoring.org service to get notified when new version of the project is released. The service however detects only stable version of the project, because this is usually what we want to include in the distribution. So this means the latest stable version detected is 1.1.2 (https://release-monitoring.org/project/1835/) which is from 2013.

So my question is, if the project considers the RC releases as final and stable? Are you at all planning to release final version (not RC) of the newer versions (1.1.3, 1.2.0) of log4cplus?

PS: I'm not sure which place is considered as official, where the project lives. Is if GitHub or sourceforge?
(The discussion on the release-monitoring project page if you are interested: fedora-infra/anitya#251)

Thank you

failed link to log4cplus library built using vs2013 and original CMakeLists int tar ball

Hello,
I am building an application which links to log4cplus library.
The library project is generated using CMake with CMakeList file in the root directory of tar ball and built with VS2013 msbuild.

Build result reports unresolved external symbol link errors, which cannot find symbols log4cplus::Logger::getInstance and log4cplus::FileAppender::FileAppender.

Should I do some modification to the CMakeList file to realize my way building application?
log4cplus version is 1.2.0.

Can anybody help me ? Thanks a lot.

Option to disable CPack

It is useful to have an option to disable CPack (like LOG4CPLUS_BUILD_TESTING). Complex cmake builds with log4cplus as an external project cannot be well packaged with dependencies that deal with CPack.

Variadic macros fail when no variadic arguments are supplied

When using gcc, the LOG4CPLUS_[TYPE]_FMT() macros fail if no variadic arguments are supplied. I think if you add a ## prefix to __VA_ARGS__, then gcc will omit the prior comma if no arguments are supplied and no longer fail in those situations.

Here one example where the issue exists:

#define LOG4CPLUS_INFO_FMT(logger, logFmt, ...)                             \
    LOG4CPLUS_MACRO_FMT_BODY (logger, INFO_LOG_LEVEL, logFmt, __VA_ARGS__)

This could change to:

#define LOG4CPLUS_INFO_FMT(logger, logFmt, ...)                             \
    LOG4CPLUS_MACRO_FMT_BODY (logger, INFO_LOG_LEVEL, logFmt, ##__VA_ARGS__)

configuring log4cplus failed

Version: 1.2.0-RC4
Environment: Visual Studio 2015, debug and release, x64

static intmax_t initialize()
{
    ::log4cplus::tistringstream const log4cplusProperties
    (
        ::log4cplus::tstring
        (
            LOG4CPLUS_TEXT
            (
                "log4cplus.rootLogger=TRACE, stdout\n"
                "log4cplus.appender.stdout=log4cplus::ConsoleAppender\n"
                "log4cplus.appender.stdout.Threshold=TRACE\n"
                "log4cplus.appender.stdout.Target=System.out\n"
                "log4cplus.appender.stdout.layout=log4cplus::PatternLayout\n"
                "log4cplus.appender.stdout.layout.ConversionPattern=%D{%Y-%m-%d %H:%M:%S,%q} %p %t %c %L: %m%n\n"
            )
        )
    );

    ::log4cplus::initialize();

    ::log4cplus::PropertyConfigurator
    propertyConfigurator
    (
        * const_cast<::log4cplus::tistringstream *>(& log4cplusProperties)
    );

    // Failed here. Process will be terminated.
    propertyConfigurator.configure();

    return 0;
}

static intmax_t dummy = initialize();

int main(void)
{
    log4cplus::Logger LOGGER = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("int main(void)"));

    LOG4CPLUS_INFO(LOGGER, "who's your daddy?");

    return 0;
}

Application using log4cplus hangs on exit

With relatively latest log4cplus version (commit from 04122015) I have encountered unexpected hang in my application upon exit. After two days of digging, I have found that ThreadPool destructor is called twice:

Breakpoint 6, ~ThreadPool (this=0x6816d0, __in_chrg=<optimized out>)
    at threadpool/ThreadPool.h:178
178            std::unique_lock<std::mutex> lock(queue_mutex);
(gdb) bt
#0  ~ThreadPool (this=0x6816d0, __in_chrg=<optimized out>)
    at threadpool/ThreadPool.h:178
#1  operator() (this=<optimized out>, __ptr=0x6816d0)
    at /usr/include/c++/5/bits/unique_ptr.h:76
#2  ~unique_ptr (this=0x6815a8, __in_chrg=<optimized out>)
    at /usr/include/c++/5/bits/unique_ptr.h:236
#3  ~DefaultContext (this=0x6812b0, __in_chrg=<optimized out>)
    at src/global-init.cxx:127
#4  log4cplus::(anonymous namespace)::destroy_default_context::~destroy_default_context (
    this=0x7ffff71562d6 <log4cplus::(anonymous namespace)::destroy_default_context_>, __in_chrg=<optimized out>) at src/global-init.cxx:162
#5  0x00007ffff512a21f in __cxa_finalize (d=0x7ffff7151710)
    at cxa_finalize.c:55
#6  0x00007ffff6f05873 in __do_global_dtors_aux ()
   from /usr/lib64/liblog4cplus-2.0.so.3
#7  0x00007fffffffe010 in ?? ()
#8  0x00007ffff7dea31f in _dl_fini () at dl-fini.c:253
(gdb) c
Continuing.
[Thread 0x7fffeeb44700 (LWP 6151) exited]
[Thread 0x7fffef345700 (LWP 6150) exited]

As you can see, all worker threads have gone. And the second one:

Program received signal SIGINT, Interrupt.
__lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
135    2:    movl    %edx, %eax
(gdb) bt
#0  __lll_lock_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ffff5a40640 in pthread_cond_broadcast@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S:136
#2  0x00007ffff576abb9 in __gthread_cond_broadcast (__cond=<optimized out>)
    at /usr/src/debug/gcc-5.1.1-20150612/obj-x86_64-alt-linux/x86_64-alt-linux/libstdc++-v3/include/x86_64-alt-linux/bits/gthr-default.h:852
#3  std::condition_variable::notify_all (this=<optimized out>)
    at ../../../../../libstdc++-v3/src/c++11/condition_variable.cc:73
#4  0x00007ffff6f1c8f3 in ~ThreadPool (this=0x6826d0, 
    __in_chrg=<optimized out>) at threadpool/ThreadPool.h:180
#5  operator() (this=<optimized out>, __ptr=0x6826d0)
    at /usr/include/c++/5/bits/unique_ptr.h:76
#6  reset (__p=0x6826d0, this=<optimized out>)
    at /usr/include/c++/5/bits/unique_ptr.h:344
#7  log4cplus::shutdownThreadPool () at src/global-init.cxx:282
#8  0x00007ffff6f2116b in log4cplus::Hierarchy::shutdown (
    this=this@entry=0x682358) at src/hierarchy.cxx:244
#9  0x00007ffff6f21357 in log4cplus::Hierarchy::~Hierarchy (this=0x682358, 
    __in_chrg=<optimized out>) at src/hierarchy.cxx:81
#10 0x00007ffff6f1cfa5 in ~DefaultContext (this=0x6822b0, 
    __in_chrg=<optimized out>) at src/global-init.cxx:127
#11 log4cplus::(anonymous namespace)::destroy_default_context::~destroy_default_---Type <return> to continue, or q <return> to quit--- 
context (this=<optimized out>, __in_chrg=<optimized out>)
    at src/global-init.cxx:162
#12 0x00007ffff512a21f in __cxa_finalize (d=0x7ffff7151710)
    at cxa_finalize.c:55
#13 0x00007ffff6f05873 in __do_global_dtors_aux ()
   from /usr/lib64/liblog4cplus-2.0.so.3
#14 0x00007fffffffdff0 in ?? ()
#15 0x00007ffff7dea31f in _dl_fini () at dl-fini.c:253

As you can see log4cplus::Hierarchy::shutdown tries to destruct already destructed ThreadPool instance. It happens because of fields order in struct DefaultContext (from global-init.cxx):

struct DefaultContext
{
    log4cplus::thread::Mutex console_mutex;
    helpers::LogLog loglog;
    LogLevelManager log_level_manager;
    helpers::Time TTCCLayout_time_base;
    NDC ndc;
    MDC mdc;
    Hierarchy hierarchy;
    spi::AppenderFactoryRegistry appender_factory_registry;
    spi::LayoutFactoryRegistry layout_factory_registry;
    spi::FilterFactoryRegistry filter_factory_registry;
    spi::LocaleFactoryRegistry locale_factory_registry;
#if ! defined (LOG4CPLUS_SINGLE_THREADED)
    std::unique_ptr<progschj::ThreadPool> thread_pool {new progschj::ThreadPool};
#endif
};

thread_pool member is destructed before hierarchy member. As result, we are in trouble. Several solutions possible:

  1. change member order
  2. remove explicit ThreadPool shutdown from Hierarchy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.