├── .dir-locals.el ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md ├── dependabot.yml └── workflows │ ├── android.yml │ ├── c-cpp.yml │ └── codeql.yml ├── .gitignore ├── .gitmodules ├── .mailmap ├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── ConfigureChecks.cmake ├── INSTALL ├── LICENSE ├── Log4CPlusCPack.cmake ├── Log4CPlusUtils.cmake ├── Makefile.am ├── Makefile.am.def ├── Makefile.am.tpl ├── Makefile.in ├── NEWS ├── README.md ├── SECURITY.md ├── TODO ├── acinclude.m4 ├── aclocal.m4 ├── appveyor.yml ├── ar-lib ├── compile ├── config.guess ├── config.sub ├── configure ├── configure.ac ├── cygport ├── configure.ac.patch └── log4cplus.cygport ├── depcomp ├── docs ├── doxygen.config ├── doxygen.css ├── examples.md ├── latex-body.tex ├── latex-header.tex ├── log4cplus.pdf ├── log4cplus.ps ├── log4cplus.svg ├── release.txt ├── unicode.txt └── webpage_doxygen.config ├── iOS ├── ConfigureChecks.cmake ├── README.md ├── iOS.cmake └── scripts │ ├── cmake_ios_armv7.sh │ └── cmake_ios_i386.sh ├── include ├── Makefile.am ├── Makefile.am.def ├── Makefile.am.tpl ├── Makefile.in └── log4cplus │ ├── appender.h │ ├── asyncappender.h │ ├── boost │ └── deviceappender.hxx │ ├── callbackappender.h │ ├── clfsappender.h │ ├── clogger.h │ ├── config.h.cmake.in │ ├── config.h.in │ ├── config.hxx │ ├── config │ ├── defines.hxx.in │ ├── macosx.h │ ├── win32.h │ ├── windowsh-inc-full.h │ └── windowsh-inc.h │ ├── configurator.h │ ├── consoleappender.h │ ├── exception.h │ ├── fileappender.h │ ├── fstreams.h │ ├── helpers │ ├── appenderattachableimpl.h │ ├── connectorthread.h │ ├── eventcounter.h │ ├── fileinfo.h │ ├── lockfile.h │ ├── loglog.h │ ├── pointer.h │ ├── property.h │ ├── queue.h │ ├── snprintf.h │ ├── socket.h │ ├── socketbuffer.h │ ├── source_location.h │ ├── stringhelper.h │ ├── thread-config.h │ └── timehelper.h │ ├── hierarchy.h │ ├── hierarchylocker.h │ ├── initializer.h │ ├── internal │ ├── customloglevelmanager.h │ ├── cygwin-win32.h │ ├── env.h │ ├── internal.h │ ├── socket.h │ └── threadsafetyanalysis.h │ ├── layout.h │ ├── log4cplus.h │ ├── log4judpappender.h │ ├── logger.h │ ├── loggingmacros.h │ ├── loglevel.h │ ├── mdc.h │ ├── msttsappender.h │ ├── ndc.h │ ├── nteventlogappender.h │ ├── nullappender.h │ ├── qt4debugappender.h │ ├── qt5debugappender.h │ ├── socketappender.h │ ├── spi │ ├── appenderattachable.h │ ├── factory.h │ ├── filter.h │ ├── loggerfactory.h │ ├── loggerimpl.h │ ├── loggingevent.h │ ├── objectregistry.h │ └── rootlogger.h │ ├── streams.h │ ├── syslogappender.h │ ├── tchar.h │ ├── thread │ ├── impl │ │ ├── syncprims-cxx11.h │ │ ├── syncprims-impl.h │ │ ├── syncprims-pmsm.h │ │ ├── threads-impl.h │ │ └── tls.h │ ├── syncprims-pub-impl.h │ ├── syncprims.h │ └── threads.h │ ├── tracelogger.h │ ├── tstring.h │ ├── version.h │ ├── win32consoleappender.h │ └── win32debugappender.h ├── install-sh ├── jenkins └── build.xml ├── log4cplus.pc.in ├── log4cplus.spec ├── ltmain.sh ├── m4 ├── ax_append_flag.m4 ├── ax_c_ifdef.m4 ├── ax_cflags_aix_option.m4 ├── ax_cflags_gcc_option.m4 ├── ax_cflags_sun_option.m4 ├── ax_cflags_warn_all.m4 ├── ax_compiler_vendor.m4 ├── ax_cxx_compile_stdcxx.m4 ├── ax_declspec.m4 ├── ax_gcc_func_attribute.m4 ├── ax_gcc_var_attribute.m4 ├── ax_getaddrinfo.m4 ├── ax_gethostbyname_r.m4 ├── ax_log4cplus_wrappers.m4 ├── ax_macro_function.m4 ├── ax_pkg_swig.m4 ├── ax_prepend_flag.m4 ├── ax_pthread.m4 ├── ax_python_devel.m4 ├── ax_require_defined.m4 ├── ax_swig_multi_module_support.m4 ├── ax_tls_support.m4 ├── ax_type_socklen_t.m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 ├── lt~obsolete.m4 └── pkg.m4 ├── mingw-log4cplus.spec ├── missing ├── mkinstalldirs ├── msvc14 ├── CLFSAppender.props ├── CLFSAppender.vcxproj ├── MSTTSAppender.props ├── MSTTSAppender.vcxproj ├── Qt4DebugAppender.props ├── Qt4DebugAppender.vcxproj ├── Qt5DebugAppender.props ├── Qt5DebugAppender.vcxproj ├── log4cplus.props ├── log4cplus.sln ├── log4cplus.vcxproj ├── log4cplus.vcxproj.filters ├── log4cplusS.vcxproj ├── log4cplusS.vcxproj.filters ├── log4cplus_debug.props ├── log4cplus_release.props ├── log4cplus_static.props ├── loggingserver.props ├── loggingserver.vcxproj ├── loggingserver.vcxproj.filters └── tests │ ├── appender_test.vcxproj │ ├── appender_test.vcxproj.filters │ ├── appender_testS.vcxproj │ ├── appender_testS.vcxproj.filters │ ├── configandwatch_test.vcxproj │ ├── configandwatch_test.vcxproj.filters │ ├── configandwatch_testS.vcxproj │ ├── configandwatch_testS.vcxproj.filters │ ├── customloglevel_test.vcxproj │ ├── customloglevel_test.vcxproj.filters │ ├── customloglevel_testS.vcxproj │ ├── customloglevel_testS.vcxproj.filters │ ├── fileappender_test.vcxproj │ ├── fileappender_test.vcxproj.filters │ ├── fileappender_testS.vcxproj │ ├── fileappender_testS.vcxproj.filters │ ├── filter_test.vcxproj │ ├── filter_test.vcxproj.filters │ ├── filter_testS.vcxproj │ ├── filter_testS.vcxproj.filters │ ├── hierarchy_test.vcxproj │ ├── hierarchy_test.vcxproj.filters │ ├── hierarchy_testS.vcxproj │ ├── hierarchy_testS.vcxproj.filters │ ├── log4cplus_tests.props │ ├── log4cplus_tests_dll.props │ ├── log4cplus_tests_static.props │ ├── loglog_test.vcxproj │ ├── loglog_test.vcxproj.filters │ ├── loglog_testS.vcxproj │ ├── loglog_testS.vcxproj.filters │ ├── ndc_test.vcxproj │ ├── ndc_test.vcxproj.filters │ ├── ndc_testS.vcxproj │ ├── ndc_testS.vcxproj.filters │ ├── ostream_test.vcxproj │ ├── ostream_test.vcxproj.filters │ ├── ostream_testS.vcxproj │ ├── ostream_testS.vcxproj.filters │ ├── patternlayout_test.vcxproj │ ├── patternlayout_test.vcxproj.filters │ ├── patternlayout_testS.vcxproj │ ├── patternlayout_testS.vcxproj.filters │ ├── performance_test.vcxproj │ ├── performance_test.vcxproj.filters │ ├── performance_testS.vcxproj │ ├── performance_testS.vcxproj.filters │ ├── priority_test.vcxproj │ ├── priority_test.vcxproj.filters │ ├── priority_testS.vcxproj │ ├── priority_testS.vcxproj.filters │ ├── propertyconfig_test.vcxproj │ ├── propertyconfig_test.vcxproj.filters │ ├── propertyconfig_testS.vcxproj │ ├── propertyconfig_testS.vcxproj.filters │ ├── socket_test.vcxproj │ ├── socket_test.vcxproj.filters │ ├── socket_testS.vcxproj │ ├── socket_testS.vcxproj.filters │ ├── thread_test.vcxproj │ ├── thread_test.vcxproj.filters │ ├── thread_testS.vcxproj │ ├── thread_testS.vcxproj.filters │ ├── timeformat_test.vcxproj │ ├── timeformat_test.vcxproj.filters │ ├── timeformat_testS.vcxproj │ ├── timeformat_testS.vcxproj.filters │ ├── unit_tests.vcxproj │ └── unit_testsS.vcxproj ├── py-compile ├── qt4debugappender ├── CMakeLists.txt ├── Makefile.am └── qt4debugappender.cxx ├── qt5debugappender ├── CMakeLists.txt ├── Makefile.am └── qt5debugappender.cxx ├── scripts ├── autogen.sh ├── build-pdf.pl ├── clean_cmake_files.bat ├── clean_cmake_files.sh ├── doautoreconf.sh ├── fix-timestamps.sh ├── msvc10_to_msvc11.cmd ├── msvc10_to_msvc12.cmd ├── prepare_dist_from_git.sh ├── propagate-version.pl ├── update_copyrights.sh └── upload_to_wiki.pl ├── simpleserver ├── CMakeLists.txt ├── Makefile.am ├── Makefile.in └── loggingserver.cxx ├── src ├── CMakeLists.txt ├── Makefile.am ├── appender.cxx ├── appenderattachableimpl.cxx ├── asyncappender.cxx ├── boost_tests.cxx ├── callbackappender.cxx ├── clfsappender.cxx ├── clogger.cxx ├── cmake │ └── Config.cmake.in ├── configurator.cxx ├── connectorthread.cxx ├── consoleappender.cxx ├── cygwin-win32.cxx ├── env.cxx ├── eventcounter.cxx ├── exception.cxx ├── factory.cxx ├── fileappender.cxx ├── fileinfo.cxx ├── filter.cxx ├── global-init.cxx ├── hierarchy.cxx ├── hierarchylocker.cxx ├── layout.cxx ├── lockfile.cxx ├── log4cplus.rc.in ├── log4judpappender.cxx ├── logger.cxx ├── loggerimpl.cxx ├── loggingevent.cxx ├── loggingmacros.cxx ├── loglevel.cxx ├── loglog.cxx ├── mdc.cxx ├── msttsappender.cxx ├── ndc.cxx ├── nteventlogappender.cxx ├── nullappender.cxx ├── objectregistry.cxx ├── patternlayout.cxx ├── pointer.cxx ├── property.cxx ├── queue.cxx ├── rootlogger.cxx ├── snprintf.cxx ├── socket-unix.cxx ├── socket-win32.cxx ├── socket.cxx ├── socketappender.cxx ├── socketbuffer.cxx ├── stringhelper-clocale.cxx ├── stringhelper-cxxlocale.cxx ├── stringhelper-iconv.cxx ├── stringhelper.cxx ├── syncprims.cxx ├── syslogappender.cxx ├── threads.cxx ├── timehelper.cxx ├── tls.cxx ├── version.cxx ├── win32consoleappender.cxx └── win32debugappender.cxx ├── swig ├── Makefile.common.am ├── configurator.swg ├── hierarchy.swg ├── log4cplus.swg ├── logger.swg ├── loggingevent.swg └── python │ └── Makefile.am └── tests ├── CMakeLists.txt ├── Makefile.am ├── Makefile.am.def ├── Makefile.am.tpl ├── appender_test.at ├── appender_test ├── CMakeLists.txt ├── Makefile.am ├── expout └── main.cxx ├── atlocal.in ├── configandwatch_test.at ├── configandwatch_test ├── CMakeLists.txt ├── Makefile.am ├── log4cplus.properties.1 ├── log4cplus.properties.2 ├── log4cplus.properties.in └── main.cxx ├── configure.m4 ├── customloglevel_test.at ├── customloglevel_test ├── CMakeLists.txt ├── Makefile.am ├── customloglevel.h ├── expout ├── func.cxx └── main.cxx ├── fileappender_test.at ├── fileappender_test ├── CMakeLists.txt ├── Makefile.am ├── experr └── main.cxx ├── filter_test.at ├── filter_test ├── CMakeLists.txt ├── Makefile.am ├── expout ├── log4cplus.properties.in └── main.cxx ├── headers.at ├── hierarchy_test.at ├── hierarchy_test ├── CMakeLists.txt ├── Makefile.am ├── expout └── main.cxx ├── local.at ├── loglog_test.at ├── loglog_test ├── CMakeLists.txt ├── Makefile.am ├── experr ├── expout └── main.cxx ├── ndc_test.at ├── ndc_test ├── CMakeLists.txt ├── Makefile.am ├── expout └── main.cxx ├── ostream_test.at ├── ostream_test ├── CMakeLists.txt ├── Makefile.am ├── expout └── main.cxx ├── patternlayout_test.at ├── patternlayout_test ├── CMakeLists.txt ├── Makefile.am └── main.cxx ├── performance_test.at ├── performance_test ├── CMakeLists.txt ├── Makefile.am ├── README ├── log4cplus.properties.in └── main.cxx ├── priority_test.at ├── priority_test ├── CMakeLists.txt ├── Makefile.am ├── expout ├── func.cxx └── main.cxx ├── propertyconfig_test.at ├── propertyconfig_test ├── CMakeLists.txt ├── Makefile.am ├── log4cplus.properties.in ├── log4cplus.tail.properties.in └── main.cxx ├── socket_test ├── CMakeLists.txt ├── Makefile.am ├── main.cxx └── run_test ├── testsuite ├── testsuite.at ├── thread_test.at ├── thread_test ├── CMakeLists.txt ├── Makefile.am └── main.cxx ├── timeformat_test.at ├── timeformat_test ├── CMakeLists.txt ├── Makefile.am ├── expout └── main.cxx ├── unit_tests.at └── unit_tests ├── CMakeLists.txt ├── Makefile.am └── unit_tests.cxx /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;;; Directory Local Variables 2 | ;;; See Info node `(emacs) Directory Variables' for more information. 3 | 4 | ((nil . 5 | ((fill-column . 79) 6 | (indent-tabs-mode) 7 | (show-trailing-whitespace . t) 8 | (whitespace-style face trailing lines-tail space-before-tab indentation) 9 | (whitespace-newline . t))) 10 | (c++-mode . 11 | ((tab-width . 4) 12 | (whitespace-action warn-read-only auto-cleanup))) 13 | (cmake-mode . 14 | ((whitespace-action warn-read-only auto-cleanup)))) 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe your problem here. 11 | 12 | Also, provide the following information: 13 | 14 | - version: *version of log4cplus that manifest your problem* 15 | - operating system, CPU, bitness: *what are your environement's OS, CPU's, and platform's characteristics* 16 | - `configure` script, or CMake, etc., flags and settings: *what setting have you used to compile log4cplus outside of defaults* 17 | - flags and settings used by your application: *what are the settings and comipler flags used by your application, are they compatible with those used for log4cplus compilation* 18 | - compiler and its version: *what compiler and what versions are you using to compile log4cplus and your application* 19 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | # Check for updates to GitHub Actions every week 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: cross compile with android-ndk 2 | 3 | on: 4 | push: 5 | branches: [ 2.0.x, 2.1.x, master ] 6 | pull_request: 7 | branches: [ 2.0.x, 2.1.x, master ] 8 | 9 | jobs: 10 | cross-compile: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | target-abi: [armeabi-v7a, arm64-v8a, x86, x86_64] 15 | 16 | runs-on: ubuntu-24.04 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | with: 21 | submodules: recursive 22 | 23 | - name: build for ${{ matrix.target-abi }} 24 | run: | 25 | COLOR_GREEN='\033[0;32m' # Green 26 | COLOR_PURPLE='\033[0;35m' # Purple 27 | COLOR_OFF='\033[0m' # Reset 28 | 29 | run() { 30 | printf '%b\n' "$COLOR_PURPLE==>$COLOR_OFF $COLOR_GREEN$*$COLOR_OFF" 31 | eval "$*" 32 | } 33 | 34 | run "env | sed -n '/^ANDROID_/p'" 35 | 36 | BUILD_MACHINE_OS_TYPE=$(uname | tr A-Z a-z) 37 | BUILD_MACHINE_OS_ARCH=$(uname -m) 38 | 39 | ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME 40 | ANDROID_NDK=$ANDROID_NDK_HOME 41 | ANDROID_NDK_ROOT=$ANDROID_NDK_HOME 42 | 43 | ANDROID_NDK_VERS=$(grep "Pkg.Revision" "$ANDROID_NDK_HOME/source.properties" | cut -d " " -f3) 44 | ANDROID_NDK_BASE=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$BUILD_MACHINE_OS_TYPE-$BUILD_MACHINE_OS_ARCH 45 | ANDROID_NDK_BIND=$ANDROID_NDK_BASE/bin 46 | SYSROOT=$ANDROID_NDK_BASE/sysroot 47 | 48 | printf '%s = %s\n' ANDROID_NDK_BASE "$ANDROID_NDK_BASE" 49 | printf '%s = %s\n' ANDROID_NDK_VERS "$ANDROID_NDK_VERS" 50 | 51 | run cmake --version 52 | 53 | run cmake \ 54 | -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ 55 | -DCMAKE_INSTALL_PREFIX=$PWD/install.d \ 56 | -DCMAKE_BUILD_TYPE=Release \ 57 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 58 | -DANDROID_TOOLCHAIN=clang \ 59 | -DANDROID_ABI=${{ matrix.target-abi }} \ 60 | -DANDROID_PLATFORM=latest \ 61 | -DANDROID_STL=c++_static \ 62 | -DCMAKE_CXX_STANDARD=20 \ 63 | -S . \ 64 | -B build.d \ 65 | 66 | run cmake --build build.d 67 | 68 | run cmake --install build.d 69 | 70 | run tree install.d 71 | 72 | -------------------------------------------------------------------------------- /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | config: 15 | - os: 'ubuntu-24.04' 16 | cc: 'gcc-14' 17 | cxx: 'g++-14' 18 | prereq: | 19 | sudo apt install libboost-iostreams-dev 20 | 21 | # Enable macOS build by installing Boost via Homebrew 22 | - os: 'macos-15' 23 | cc: 'clang' 24 | cxx: 'clang++' 25 | cppflags: '-I$(brew --prefix boost)/include' 26 | prereq: | 27 | #brew update 28 | brew install boost 29 | sudo xcode-select -s '/Applications/Xcode_16.4.app/Contents/Developer' 30 | 31 | - os: 'macos-15' 32 | cc: '$(brew --prefix llvm@18)/bin/clang' 33 | cxx: '$(brew --prefix llvm@18)/bin/clang++' 34 | cppflags: '-I$(brew --prefix boost)/include' 35 | prereq: | 36 | brew install boost 37 | sudo xcode-select -s '/Applications/Xcode_16.4.app/Contents/Developer' 38 | 39 | runs-on: ${{ matrix.config.os }} 40 | 41 | steps: 42 | - uses: actions/checkout@v4 43 | with: 44 | submodules: recursive 45 | - name: install prerequisites 46 | run: | 47 | ${{ matrix.config.prereq }} 48 | - name: configure 49 | run: | 50 | ${{ matrix.config.cxx }} --version 51 | ./scripts/fix-timestamps.sh 52 | mkdir objdir 53 | cd objdir 54 | ../configure CPPFLAGS="${{ matrix.config.cppflags }}" CC="${{ matrix.config.cc }}" CXX="${{ matrix.config.cxx }}" --enable-shared --enable-unit-tests --with-working-locale 55 | ./config.status --config 56 | - name: make 57 | run: cd objdir ; make 58 | - name: make check 59 | run: cd objdir ; make check 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.ncb 3 | *.suo 4 | *.sdf 5 | *.opensdf 6 | .#* 7 | *~ 8 | *.bak 9 | ipch/ 10 | autom4te.cache/ 11 | objdir*/ 12 | Win32/ 13 | x64/ 14 | build/ 15 | .vscode/ 16 | .vs/ 17 | 18 | docs/log4cplus-*/ 19 | docs/webpage_docs-*/ 20 | 21 | .idea 22 | 23 | # LaTeX/PDF produciton byproducts 24 | *.aux 25 | *.log 26 | *.tex 27 | *.toc 28 | *.xwm 29 | *.pdf 30 | *.ref_rename_step 31 | 32 | # Compiler produced temporaries 33 | *.s 34 | *.ii 35 | 36 | # Patches 37 | *.patch 38 | *.diff 39 | 40 | # 41 | # From Github's C++.gitignore: 42 | # 43 | 44 | # Compiled Object files 45 | *.slo 46 | *.lo 47 | *.o 48 | *.obj 49 | 50 | # Compiled Dynamic libraries 51 | *.so 52 | *.dylib 53 | *.dll 54 | 55 | # Compiled Static libraries 56 | *.lai 57 | *.la 58 | *.a 59 | *.lib 60 | 61 | # Executables 62 | *.exe 63 | *.out 64 | *.app 65 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "threadpool"] 2 | path = threadpool 3 | url = https://github.com/log4cplus/ThreadPool.git 4 | [submodule "catch"] 5 | path = catch 6 | url = https://github.com/philsquared/Catch.git 7 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Václav Haisman 2 | Václav Haisman 3 | Václav Haisman 4 | Václav Haisman 5 | Václav Haisman 6 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Contributors 2 | ============ 3 | 4 | - Tad E. Smith 5 | - Michael Catanzariti 6 | - Steighton Haley 7 | - Eduardo Francos 8 | - Václav Zeman 9 | - Psychon 10 | - Marcel Loose 11 | - Hannah Schroeter 12 | - Ricardo Andrade 13 | - Alexander Neundorf 14 | - Mikael Tintinger 15 | - Aaron Thompson 16 | - Cosmin Cremarenco 17 | - Christian Gudrian 18 | - Nikita Manovich 19 | - Andreas Bießmann 20 | - Jens Rehsack 21 | - Siva Chandran P (ப.சிவச்சந்திரன்) 22 | - Chernyshev Vyacheslav (Вячеслав Чернышев) 23 | - Chris Steenwyk 24 | - Jukka Lantto 25 | - Konstantin Baumann 26 | - Yaqian Shen (沈亚谦) 27 | - Sergey Nikulov (Сергей Никулов) 28 | - Ray Logel 29 | - Zhang Shengfa 30 | - Oskari Timperi 31 | - Prabhat Ranjan Kanth 32 | 33 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | See the LICENSE file. 2 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | # log4cplus 3.0.0 2 | 3 | - **IMPORTANT**: Implementation language is now C++17. 4 | 5 | -------------------------------------------------------------------------------- /Log4CPlusCPack.cmake: -------------------------------------------------------------------------------- 1 | set(CPACK_PACKAGE_NAME log4cplus) 2 | set(CPACK_PACKAGE_VERSION "${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}") 3 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "log4cplus is a log4j-inspired logging library for C++") 4 | set(CPACK_PACKAGE_DESCRIPTION_FILE "${log4cplus_SOURCE_DIR}/README.md") 5 | 6 | # This is for WiX so that it does not complain about unsupported extension 7 | # of license file. 8 | configure_file("${log4cplus_SOURCE_DIR}/LICENSE" 9 | "${log4cplus_BINARY_DIR}/LICENSE.txt" COPYONLY) 10 | set(CPACK_RESOURCE_FILE_LICENSE "${log4cplus_BINARY_DIR}/LICENSE.txt") 11 | 12 | set(CPACK_WIX_UPGRADE_GUID "DB673B4F-556C-4CEA-BA9B-48E899E55150") 13 | 14 | include(CPack) 15 | -------------------------------------------------------------------------------- /Log4CPlusUtils.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Utility macros for Log4Cplus project 3 | # 4 | 5 | # Get Log4cplus version macro 6 | # first param - path to include folder, we will rip version from version.h 7 | macro(log4cplus_get_version _include_PATH vmajor vminor vpatch) 8 | file(STRINGS "${_include_PATH}/log4cplus/version.h" _log4cplus_VER_STRING_AUX REGEX ".*#define[ ]+LOG4CPLUS_VERSION[ ]+") 9 | string(REGEX MATCHALL "[0-9]+" _log4clpus_VER_LIST "${_log4cplus_VER_STRING_AUX}") 10 | list(LENGTH _log4clpus_VER_LIST _log4cplus_VER_LIST_LEN) 11 | # we also count '4' from the name... 12 | if(_log4cplus_VER_LIST_LEN EQUAL 5) 13 | list(GET _log4clpus_VER_LIST 2 ${vmajor}) 14 | list(GET _log4clpus_VER_LIST 3 ${vminor}) 15 | list(GET _log4clpus_VER_LIST 4 ${vpatch}) 16 | endif() 17 | endmacro() 18 | -------------------------------------------------------------------------------- /Makefile.am.def: -------------------------------------------------------------------------------- 1 | AutoGen definitions Makefile.am.tpl; 2 | 3 | src-dirs = { name = src; }; 4 | src-dirs = { name = simpleserver; }; 5 | src-dirs = { name = qt4debugappender; conditional = QT; }; 6 | src-dirs = { name = qt5debugappender; conditional = QT5; }; 7 | src-dirs = { name = swig; }; 8 | src-dirs = { name = tests; conditional = ENABLE_TESTS; }; 9 | -------------------------------------------------------------------------------- /Makefile.am.tpl: -------------------------------------------------------------------------------- 1 | [= AutoGen5 template -*- Mode: scheme -*- 2 | am 3 | =][= 4 | (use-modules (ice-9 ftw)) 5 | =]## Generated by Autogen from [= (tpl-file) =] 6 | 7 | AM_CPPFLAGS = -I$(top_srcdir)/include \ 8 | -I$(top_srcdir)/threadpool \ 9 | -I$(top_builddir)/include \ 10 | -I$(top_srcdir)/catch/extras \ 11 | -DCATCH_CONFIG_PREFIX_ALL=1 \ 12 | @LOG4CPLUS_NDEBUG@ 13 | AM_CXXFLAGS=@LOG4CPLUS_PROFILING_CXXFLAGS@ @LOG4CPLUS_LTO_CXXFLAGS@ 14 | AM_LDFLAGS=@LOG4CPLUS_PROFILING_LDFLAGS@ @LOG4CPLUS_LTO_LDFLAGS@ 15 | 16 | ACLOCAL_AMFLAGS = -I m4 17 | EXTRA_DIST = ChangeLog log4cplus.pc.in 18 | SUBDIRS = include 19 | pkgconfigdir = $(libdir)/pkgconfig 20 | pkgconfig_DATA = log4cplus.pc 21 | 22 | if ENABLE_VERSION_INFO_OPTION 23 | VERSION_INFO_OPTION=-version-info @LT_VERSION@ 24 | else 25 | VERSION_INFO_OPTION=-avoid-version 26 | endif 27 | 28 | if ENABLE_RELEASE_OPTION 29 | RELEASE_OPTION=-release @LT_RELEASE@ 30 | else 31 | RELEASE_OPTION= 32 | endif 33 | 34 | LOG4CPLUS_VERSION_LT_FLAGS=$(VERSION_INFO_OPTION) $(RELEASE_OPTION) 35 | 36 | INCLUDES_SRC_PATH = $(top_srcdir)/include/log4cplus 37 | liblog4cplus_la_file = $(top_builddir)/liblog4cplus.la 38 | if BUILD_WITH_WCHAR_T_SUPPORT 39 | liblog4cplusU_la_file = $(top_builddir)/liblog4cplusU.la 40 | endif 41 | 42 | # The tests add to this using += operator, so it needs to be initialized to 43 | # empty first. 44 | noinst_PROGRAMS= 45 | [= FOR src-dirs =][= 46 | (let ((files (list))) 47 | (define (emit-am-file-ftw-cb filename statinfo flag) 48 | (begin 49 | (if (and (string-suffix-ci? ".am" filename)) 50 | (set! files (append! files (list filename)))) 51 | #t)) 52 | (begin 53 | (ftw (get "name") emit-am-file-ftw-cb) 54 | (set! files (sort! files string, 2 | or . 3 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report security vulnerabilities via email to the maintainers. 6 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Possible enhancements and directions of development, in no particular 2 | order: 3 | 4 | - Rewrite FileAppender to use OS specific file handling to allow 5 | RollingFileAppender to roll log files shared between multiple 6 | processes even on Windows. 7 | 8 | - Improve error handling 9 | - allow not to throw exceptions 10 | - create hooks to allow users to override behaviour 11 | 12 | - EventLog library appender. 13 | 14 | - org.apache.log4j.net.ZeroConfSocketHubAppender. 15 | 16 | - Reading log4j-like XML configuration files. 17 | 18 | - More flexible events format for transport over network. ASN.1? XML? 19 | YAML? JSON?. 20 | 21 | - Modular PatternLayout; public PatternConverter classes; user defined 22 | format specifiers. 23 | 24 | - More flexible log file rotation, like keeping only last 31 days of 25 | logs produced by DailyRollingFileAppender, rotate at midnight, etc. 26 | 27 | - Installers for Debian, Ubuntu, Windows/Qt Creator. 28 | 29 | - Allow specifying codecvt facet for FileAppender through properties. 30 | 31 | - Custom codecvt facet for use FileAppender using log4cplus' internal 32 | wchar_t <-> chart conversion routines. 33 | 34 | - Research possible use of Valgrind at compile time. 35 | 36 | - Research possible use of -fmudflap. 37 | 38 | - Improve CMake configuration checks (TLS) to be on par with 39 | Autoconf's. 40 | 41 | - ConsoleAppender or specialized appender with colored output per log 42 | level for *NIX platforms. Win32ConsoleAppender already has some 43 | support for this. 44 | 45 | - Graylog2/GELF appender. See 46 | . 47 | 48 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | m4_include([m4/ax_c_ifdef.m4]) 2 | m4_include([m4/ax_require_defined.m4]) 3 | m4_include([m4/ax_append_flag.m4]) 4 | m4_include([m4/ax_prepend_flag.m4]) 5 | m4_include([m4/ax_cflags_warn_all.m4]) 6 | m4_include([m4/ax_type_socklen_t.m4]) 7 | m4_include([m4/ax_compiler_vendor.m4]) 8 | m4_include([m4/ax_cflags_gcc_option.m4]) 9 | m4_include([m4/ax_cflags_sun_option.m4]) 10 | m4_include([m4/ax_cflags_aix_option.m4]) 11 | m4_include([m4/ax_pthread.m4]) 12 | m4_include([m4/ax_declspec.m4]) 13 | m4_include([m4/ax_tls_support.m4]) 14 | m4_include([m4/ax_macro_function.m4]) 15 | m4_include([m4/ax_gethostbyname_r.m4]) 16 | m4_include([m4/ax_getaddrinfo.m4]) 17 | m4_include([m4/ax_log4cplus_wrappers.m4]) 18 | m4_include([m4/pkg.m4]) 19 | m4_include([m4/ax_pkg_swig.m4]) 20 | m4_include([m4/ax_python_devel.m4]) 21 | m4_include([m4/ax_swig_multi_module_support.m4]) 22 | m4_include([m4/ax_cxx_compile_stdcxx.m4]) 23 | m4_include([m4/ax_gcc_func_attribute.m4]) 24 | m4_include([m4/ax_gcc_var_attribute.m4]) 25 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 3.0.0.{build}-{branch} 2 | 3 | branches: 4 | except: 5 | - gh-pages 6 | 7 | install: 8 | - git submodule update --init --recursive 9 | 10 | environment: 11 | matrix: 12 | - PRJ_GEN: "Visual Studio 17 2022" 13 | APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2022" 14 | BDIR: msvc2022 15 | PRJ_CFG: Release 16 | #- PRJ_GEN: "Visual Studio 16 2019" 17 | # APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2019" 18 | # BDIR: msvc2019 19 | # PRJ_CFG: Release 20 | 21 | build_script: 22 | - mkdir build.%BDIR% 23 | - cd build.%BDIR% 24 | - cmake .. -G "%PRJ_GEN%" -A x64 "-DCMAKE_BUILD_TYPE=%PRJ_CFG%" %PARAMS% 25 | - cmake --build . --config "%PRJ_CFG%" --clean-first 26 | 27 | test_script: 28 | - ctest -V --output-on-failure -C %PRJ_CFG% 29 | -------------------------------------------------------------------------------- /cygport/configure.ac.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure.ac b/configure.ac 2 | index ff871e2..a820a35 100644 3 | --- a/configure.ac 4 | +++ b/configure.ac 5 | @@ -506,7 +506,7 @@ dnl Multi threaded library. 6 | [dnl Check for IBM's compiler's TLS option. 7 | AX_CXXFLAGS_AIX_OPTION([-qtls])]) 8 | 9 | - AX_TLS_SUPPORT 10 | + dnl AX_TLS_SUPPORT 11 | AH_TEMPLATE([LOG4CPLUS_HAVE_TLS_SUPPORT]) 12 | AH_TEMPLATE([LOG4CPLUS_THREAD_LOCAL_VAR]) 13 | AS_IF([test "x$ac_cv_thread_local" = "xyes"], 14 | @@ -680,7 +680,7 @@ dnl Libtool setup. 15 | dnl Must be latest to catch rpath compiled in by changes made during 16 | dnl checks before. 17 | 18 | -LT_PREREQ([2.4.2]) 19 | +LT_PREREQ([2.4]) 20 | LT_INIT([win32-dll disable-static pic-only]) 21 | 22 | AH_TOP([#ifndef LOG4CPLUS_CONFIG_H]) 23 | -------------------------------------------------------------------------------- /cygport/log4cplus.cygport: -------------------------------------------------------------------------------- 1 | NAME=log4cplus 2 | VERSION=3.0.0-rc1 3 | RELEASE=1 4 | CATEGORY="Libs" 5 | SUMMARY="C++ logging library" 6 | DESCRIPTION="log4cplus is a simple to use C++ logging API providing thread-safe, 7 | flexible, and arbitrarily granular control over log management and 8 | configuration. It is modelled after the Java log4j API." 9 | HOMEPAGE="http://log4cplus.sourceforge.net/" 10 | SRC_URI="mirror://sourceforge/log4cplus/log4cplus-stable/${PV%-rc*}/${P}.tar.xz" 11 | 12 | PATCH_URI="configure.ac.patch" 13 | 14 | PKG_NAMES="lib${PN}3.0_0 lib${PN}qt4debugappender3.0_0 15 | lib${PN}-devel lib${PN}qt4debugappender-devel" 16 | liblog4cplus3_0_0_SUMMARY="${SUMMARY} (runtime)" 17 | liblog4cplus3_0_0_CONTENTS="usr/bin/cyglog4cplus-3-0-0.dll" 18 | liblog4cplusqt4debugappender3_0_0_SUMMARY="${SUMMARY} (Qt4 runtime)" 19 | liblog4cplusqt4debugappender3_0_0_CONTENTS="usr/bin/cyglog4cplusqt4*-3-0-0.dll" 20 | liblog4cplus_devel_SUMMARY="${SUMMARY} (development)" 21 | liblog4cplus_devel_CONTENTS="--exclude=*qt4* usr/include/ usr/lib/ usr/share/doc/" 22 | liblog4cplusqt4debugappender_devel_SUMMARY="${SUMMARY} (Qt4 development)" 23 | liblog4cplusqt4debugappender_devel_REQUIRES="lib${PN}-devel libQtCore4-devel" 24 | liblog4cplusqt4debugappender_devel_CONTENTS="usr/include/log4cplus/qt4* usr/lib/liblog4cplusqt4*" 25 | 26 | ACLOCAL_FLAGS="-I m4" 27 | CYGCONF_ARGS="--enable-threads=yes --with-working-c-locale --with-qt" 28 | 29 | KEEP_LA_FILES="none" 30 | -------------------------------------------------------------------------------- /docs/latex-body.tex: -------------------------------------------------------------------------------- 1 | %% 2 | %% latex-body.tex begin 3 | %% 4 | 5 | \begin{figure}[h!] 6 | \centering 7 | \includegraphics[width=25em,keepaspectratio]{./docs/log4cplus} 8 | \end{figure} 9 | \newpage 10 | 11 | %% 12 | %% latex-body.tex end 13 | %% 14 | 15 | -------------------------------------------------------------------------------- /docs/latex-header.tex: -------------------------------------------------------------------------------- 1 | %% 2 | %% latex-header.tex begin 3 | %% 4 | 5 | \usepackage{graphicx} 6 | \usepackage{epstopdf} 7 | \usepackage{anyfontsize} 8 | \usepackage{amssymb} 9 | \usepackage{newunicodechar} 10 | \usepackage{fancyhdr} 11 | \usepackage{listings} 12 | \usepackage{accsupp} 13 | \usepackage{MnSymbol} 14 | \usepackage{textcomp} 15 | \usepackage{upquote} 16 | \usepackage{etoolbox} 17 | 18 | %\setmainfont[Ligatures={TeX, Common}]{TeX Gyre Pagella} 19 | %\setmonofont[Scale=MatchLowercase,Ligatures={NoCommon}]{DejaVu Sans Mono} 20 | %\setromanfont{Georgia} 21 | %\setsansfont{DejaVu Sans} 22 | 23 | \newfontfamily\cjkfont{WenQuanYi Zen Hei}[] 24 | \newfontfamily\devanagarifont{Noto Serif Devanagari}[] 25 | \newfontfamily\tamilfont{Noto Serif Tamil}[] 26 | \newfontfamily\cyrilicfont{PTSerif}[] 27 | 28 | %% These unfortunately break too many things. PDF will have to be without 29 | %% contributors' native names. 30 | % \ifxetex 31 | % \usepackage{xeCJK} 32 | % \setCJKmainfont{WenQuanYi Zen Hei} 33 | % \setCJKmonofont{WenQuanYi Zen Hei Mono} 34 | % \else 35 | % %% Adding senolig breaks compilation in the CJK support. 36 | % %\usepackage{selnolig} 37 | % \usepackage{luatexja-fontspec} 38 | % \setmainjfont{WenQuanYi Zen Hei} 39 | % \fi 40 | 41 | \pagestyle{fancy} 42 | \chead{\raisebox{\baselineskip}{\includegraphics[width=1.5cm,keepaspectratio]{./docs/log4cplus}}} 43 | \setlength{\headheight}{47.0pt} 44 | \addtolength{\topmargin}{-4\baselineskip} 45 | 46 | %\title{} 47 | %\author[The author]{Václav Zeman} 48 | %\institute{} 49 | %\date{\today} 50 | 51 | 52 | %\urlstyle{same} 53 | 54 | \AtBeginEnvironment{quote}{\slshape} 55 | 56 | \newunicodechar{⊆}{$\subseteq$} 57 | \newunicodechar{↔}{$\leftrightarrow$} 58 | 59 | \newcommand{\noncopy}[1]{% 60 | \BeginAccSupp{method=escape,ActualText={}}% 61 | #1% 62 | \EndAccSupp{}% 63 | } 64 | 65 | \lstset{breaklines=true, 66 | basicstyle=\ttfamily, 67 | %upquote=true, 68 | literate={`}{{\BeginAccSupp{method=plain,ActualText=`}‵\EndAccSupp{}}}1 69 | {"}{{\BeginAccSupp{method=plain,ActualText="}"\EndAccSupp{}}}1 70 | {'}{{\BeginAccSupp{method=plain,ActualText='}'\EndAccSupp{}}}1, 71 | showstringspaces=false, 72 | numbers=left, numberstyle=\scriptsize\noncopy, 73 | prebreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\noncopy{\rhookswarrow}}}}} 74 | 75 | %% 76 | %% latex-header.tex end 77 | %% 78 | -------------------------------------------------------------------------------- /docs/log4cplus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilx/log4cplus/a2990a23b38d11b26f58eb9b4819cce4ca3381b8/docs/log4cplus.pdf -------------------------------------------------------------------------------- /docs/release.txt: -------------------------------------------------------------------------------- 1 | # Release Procedure 2 | 3 | This describes log4cplus release procedure: 4 | 5 | #. Update `ChangeLog` file with worthy changes. 6 | 7 | #. Make sure that version information in `version.h` and `configure.ac` is up 8 | to date. Run `scripts/propagate-version.sh` followed by 9 | `scripts/doautoreconf.sh`. _Do not forget to commit the changes._ 10 | 11 | #. Run `scripts/prepare_dist_from_git.sh` to prepare tarballs. _Do not tag the 12 | revision, yet._ 13 | 14 | #. [Upload tarballs][4] to SourceForge. 15 | 16 | #. Send announcement to . 17 | 18 | #. Tag revision on branch. _Do not forget to push the tag._ 19 | 20 | #. Use Pandoc with parameters 21 | 22 | ``` 23 | --standalone -f markdown+smart -t markdown_strict+hard_line_breaks+fenced_code_blocks+fenced_code_attributes-intraword_underscores 24 | ``` 25 | 26 | to generate a version of README file with Markdown compatible with 27 | SourceForge's wiki. Upload resulting file to project's SourceForge wiki 28 | page using the `scripts/upload_to_wiki.pl` script. 29 | 30 | [2]: https://sourceforge.net/p/log4cplus/news/new 31 | [4]: https://sourceforge.net/projects/log4cplus/files/ 32 | -------------------------------------------------------------------------------- /iOS/README.md: -------------------------------------------------------------------------------- 1 | See `../README.md` for details on how to build for iOS. 2 | 3 | -------------------------------------------------------------------------------- /iOS/scripts/cmake_ios_armv7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | scripts_dir=`cd $(dirname $0);pwd` 3 | cd $scripts_dir/.. 4 | 5 | mkdir -p build_armv7 6 | cd build_armv7 7 | 8 | cmake -G "Xcode" -DBUILD_SHARED_LIBS="FALSE" \ 9 | -DCMAKE_TOOLCHAIN_FILE=$scripts_dir/../iOS.cmake \ 10 | -DLOG4CPLUS_SINGLE_THREADED="TRUE" \ 11 | -DLOG4CPLUS_BUILD_TESTING="OFF" \ 12 | -DLOG4CPLUS_QT4="OFF" \ 13 | -DLOG4CPLUS_BUILD_LOGGINGSERVER="OFF" \ 14 | -DLOG4CPLUS_CONFIGURE_CHECKS_PATH=$scripts_dir/../ConfigureChecks.cmake \ 15 | -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$scripts_dir/../build_armv7/Binaries \ 16 | -DCMAKE_CXX_FLAGS="-std=c++17" \ 17 | $@ \ 18 | $scripts_dir/../.. 19 | 20 | -------------------------------------------------------------------------------- /iOS/scripts/cmake_ios_i386.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | scripts_dir=`cd $(dirname $0);pwd` 3 | cd $scripts_dir/.. 4 | 5 | mkdir -p build_i386 6 | cd build_i386 7 | 8 | cmake -G "Xcode" -DBUILD_SHARED_LIBS="FALSE" \ 9 | -DIOS_PLATFORM="SIMULATOR" \ 10 | -DCMAKE_TOOLCHAIN_FILE=$scripts_dir/../iOS.cmake \ 11 | -DLOG4CPLUS_SINGLE_THREADED="TRUE" \ 12 | -DLOG4CPLUS_BUILD_TESTING="OFF" \ 13 | -DLOG4CPLUS_QT4="OFF" \ 14 | -DLOG4CPLUS_BUILD_LOGGINGSERVER="OFF" \ 15 | -DLOG4CPLUS_CONFIGURE_CHECKS_PATH=$scripts_dir/../ConfigureChecks.cmake \ 16 | -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$scripts_dir/../build_i386/Binaries \ 17 | -DCMAKE_CXX_FLAGS="-std=c++17" \ 18 | $@ \ 19 | $scripts_dir/../.. 20 | 21 | -------------------------------------------------------------------------------- /include/Makefile.am.def: -------------------------------------------------------------------------------- 1 | AutoGen definitions Makefile.am.tpl; 2 | 3 | src-dirs = { name = log4cplus; }; 4 | -------------------------------------------------------------------------------- /include/Makefile.am.tpl: -------------------------------------------------------------------------------- 1 | [= AutoGen5 template -*- Mode: scheme -*- 2 | am 3 | =][= 4 | (use-modules (ice-9 ftw)) 5 | =]## Generated by Autogen from [= (tpl-file) =] 6 | log4cplusincdir = $(includedir) 7 | 8 | nobase_log4cplusinc_HEADERS = \ 9 | [= FOR src-dirs =][= 10 | (let ((files (list))) 11 | (define (emit-am-file-ftw-cb filename statinfo flag) 12 | (begin 13 | (if (or (string-suffix-ci? ".h" filename) 14 | (string-suffix-ci? ".hxx" filename)) 15 | (set! files (append! files (list filename)))) 16 | #t)) 17 | (begin 18 | (ftw (get "name") emit-am-file-ftw-cb) 19 | ;; Add the generated header as it will not be found by file search. 20 | (append! files (list "log4cplus/config/defines.hxx")) 21 | (set! files (sort! files string-ci 35 | #include 36 | #include 37 | #if defined (LOG4CPLUS_HAVE_INTRIN_H) 38 | #include 39 | #endif 40 | #endif 41 | 42 | // NOTE: This file is a fragment intentionally left without include guards. 43 | -------------------------------------------------------------------------------- /include/log4cplus/exception.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023, Vaclav Haisman. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without modifica- 4 | // tion, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, 7 | // this list of conditions and the following disclaimer. 8 | // 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, 10 | // this list of conditions and the following disclaimer in the documentation 11 | // and/or other materials provided with the distribution. 12 | // 13 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 14 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 16 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 18 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 19 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #ifndef LOG4CPLUS_EXCEPTION_HXX 25 | #define LOG4CPLUS_EXCEPTION_HXX 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | 37 | namespace log4cplus 38 | { 39 | 40 | /** 41 | * \brief Exception class thrown by LogLog. 42 | * \sa helpers::LogLog 43 | * 44 | */ 45 | class LOG4CPLUS_EXPORT exception : public std::runtime_error 46 | { 47 | public: 48 | exception (tstring const &); 49 | exception (exception const &); 50 | exception & operator=(exception const &); 51 | virtual ~exception (); 52 | }; 53 | 54 | } // namespace log4cplus 55 | 56 | #endif // LOG4CPLUS_EXCEPTION_HXX -------------------------------------------------------------------------------- /include/log4cplus/fstreams.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: fstreams.h 4 | // Created: 4/2003 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2003-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_FSTREAMS_HEADER_ 25 | #define LOG4CPLUS_FSTREAMS_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | 37 | namespace log4cplus 38 | { 39 | 40 | 41 | typedef std::basic_ofstream tofstream; 42 | typedef std::basic_ifstream tifstream; 43 | 44 | 45 | } 46 | 47 | #endif // LOG4CPLUS_FSTREAMS_HEADER_ 48 | -------------------------------------------------------------------------------- /include/log4cplus/helpers/fileinfo.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // 3 | // Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modifica- 6 | // tion, are permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, 12 | // this list of conditions and the following disclaimer in the documentation 13 | // and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 16 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 17 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 18 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 19 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 20 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 21 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | #if ! defined (LOG4CPLUS_HELPERS_FILEINFO_H) 27 | #define LOG4CPLUS_HELPERS_FILEINFO_H 28 | 29 | #include 30 | 31 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 32 | #pragma once 33 | #endif 34 | 35 | #include 36 | #ifdef LOG4CPLUS_HAVE_SYS_TYPES_H 37 | #include 38 | #endif 39 | 40 | 41 | namespace log4cplus { namespace helpers { 42 | 43 | //! FileInfo structure is OS independent abstraction of the 44 | //! stat() function. 45 | struct LOG4CPLUS_EXPORT FileInfo 46 | { 47 | helpers::Time mtime; 48 | bool is_link; 49 | off_t size; 50 | }; 51 | 52 | 53 | //! OS independent abstraction of stat() function. 54 | LOG4CPLUS_EXPORT int getFileInfo (FileInfo * fi, tstring const & name); 55 | 56 | 57 | } } // namespace log4cplus { namespace helpers { 58 | 59 | #endif // LOG4CPLUS_HELPERS_FILEINFO_H 60 | -------------------------------------------------------------------------------- /include/log4cplus/helpers/snprintf.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Copyright (C) 2010-2017, Vaclav Zeman. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modifica- 5 | // tion, are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 15 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 16 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 17 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 19 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 20 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | #ifndef LOG4CPLUS_HELPERS_SNPRINTF_H 26 | #define LOG4CPLUS_HELPERS_SNPRINTF_H 27 | 28 | #include 29 | 30 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 31 | #pragma once 32 | #endif 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | namespace log4cplus { namespace helpers { 40 | 41 | 42 | class LOG4CPLUS_EXPORT snprintf_buf 43 | { 44 | public: 45 | snprintf_buf (); 46 | 47 | tchar const * print (tchar const * fmt, ...) 48 | LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 2, 3); 49 | 50 | int print_va_list (tchar const * & str, tchar const * fmt, std::va_list) 51 | LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 0); 52 | 53 | private: 54 | std::vector buf; 55 | }; 56 | 57 | 58 | } } // namespace log4cplus { namespace helpers 59 | 60 | 61 | 62 | #endif // LOG4CPLUS_HELPERS_SNPRINTF_H 63 | -------------------------------------------------------------------------------- /include/log4cplus/helpers/socketbuffer.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: socketbuffer.h 4 | // Created: 5/2003 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2003-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_ 25 | #define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | 35 | 36 | namespace log4cplus { 37 | namespace helpers { 38 | 39 | /** 40 | * 41 | */ 42 | class LOG4CPLUS_EXPORT SocketBuffer 43 | { 44 | public: 45 | explicit SocketBuffer(std::size_t max); 46 | SocketBuffer(SocketBuffer const & rhs) = delete; 47 | SocketBuffer& operator= (SocketBuffer const& rhs) = delete; 48 | virtual ~SocketBuffer(); 49 | 50 | char *getBuffer() const { return buffer; } 51 | std::size_t getMaxSize() const { return maxsize; } 52 | std::size_t getSize() const { return size; } 53 | void setSize(std::size_t s) { size = s; } 54 | std::size_t getPos() const { return pos; } 55 | 56 | unsigned char readByte(); 57 | unsigned short readShort(); 58 | unsigned int readInt(); 59 | tstring readString(unsigned char sizeOfChar); 60 | 61 | void appendByte(unsigned char val); 62 | void appendShort(unsigned short val); 63 | void appendInt(unsigned int val); 64 | void appendString(const tstring& str); 65 | void appendBuffer(const SocketBuffer& buffer); 66 | 67 | private: 68 | // Data 69 | std::size_t maxsize; 70 | std::size_t size; 71 | std::size_t pos; 72 | char *buffer; 73 | }; 74 | 75 | } // end namespace helpers 76 | } // end namespace log4cplus 77 | 78 | #endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_ 79 | -------------------------------------------------------------------------------- /include/log4cplus/helpers/thread-config.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: thread-config.h 4 | // Created: 4/2003 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2003-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | /** @file */ 22 | 23 | #ifndef LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ 24 | #define LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ 25 | 26 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 27 | #pragma once 28 | #endif 29 | 30 | #if defined (LOG4CPLUS_USE_PTHREADS) 31 | # if defined (__APPLE__) 32 | # define LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE 33 | # endif 34 | 35 | #elif defined(LOG4CPLUS_USE_WIN32_THREADS) 36 | # define LOG4CPLUS_USE_SRW_LOCK 37 | //# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX 38 | # undef LOG4CPLUS_HAVE_TLS_SUPPORT 39 | # undef LOG4CPLUS_THREAD_LOCAL_VAR 40 | # if defined (_MSC_VER) 41 | // The __declspec(thread) functionality is not compatible with LoadLibrary(). 42 | // For more information why see and "Windows and TLS" note in README. 43 | // . 44 | # define LOG4CPLUS_HAVE_TLS_SUPPORT 1 45 | # define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread) 46 | # endif 47 | 48 | #elif defined(LOG4CPLUS_SINGLE_THREADED) 49 | # undef LOG4CPLUS_HAVE_TLS_SUPPORT 50 | # undef LOG4CPLUS_THREAD_LOCAL_VAR 51 | 52 | #else 53 | # error "You Must define a Threading model" 54 | 55 | #endif 56 | 57 | 58 | #endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ 59 | -------------------------------------------------------------------------------- /include/log4cplus/internal/cygwin-win32.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: cygwin-win32.h 4 | // Created: 7/2011 5 | // Author: Vaclav Zeman 6 | // 7 | // Copyright (C) 2011-2017, Vaclav Zeman. All rights reserved. 8 | // 9 | // Redistribution and use in source and binary forms, with or without modifica- 10 | // tion, are permitted provided that the following conditions are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // 15 | // 2. Redistributions in binary form must reproduce the above copyright notice, 16 | // this list of conditions and the following disclaimer in the documentation 17 | // and/or other materials provided with the distribution. 18 | // 19 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 20 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 24 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 25 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #if ! defined (LOG4CPLUS_CONFIG_CYGWIN_WIN32_H) 31 | #define LOG4CPLUS_CONFIG_CYGWIN_WIN32_H 32 | 33 | #include 34 | 35 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 36 | #pragma once 37 | #endif 38 | 39 | #if defined (__CYGWIN__) 40 | 41 | #if ! defined (INSIDE_LOG4CPLUS) 42 | # error "This header must not be be used outside log4cplus' implementation files." 43 | #endif 44 | 45 | 46 | namespace log4cplus { namespace cygwin { 47 | 48 | unsigned long get_current_win32_thread_id (); 49 | void output_debug_stringW (wchar_t const *); 50 | 51 | } } // namespace log4cplus { namespace cygwin { 52 | 53 | 54 | #endif // defined (__CYGWIN__) 55 | #endif // LOG4CPLUS_CONFIG_CYGWIN_WIN32_H 56 | -------------------------------------------------------------------------------- /include/log4cplus/nullappender.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: nullappender.h 4 | // Created: 6/2003 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2003-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_NULL_APPENDER_HEADER_ 25 | #define LOG4CPLUS_NULL_APPENDER_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | 35 | 36 | namespace log4cplus { 37 | 38 | /** 39 | * Appends log events to a file. 40 | */ 41 | class LOG4CPLUS_EXPORT NullAppender : public Appender { 42 | public: 43 | // Ctors 44 | NullAppender(); 45 | NullAppender(const log4cplus::helpers::Properties&); 46 | 47 | // Dtor 48 | virtual ~NullAppender(); 49 | 50 | // Methods 51 | virtual void close() override; 52 | 53 | protected: 54 | virtual void append(const log4cplus::spi::InternalLoggingEvent& event) override; 55 | 56 | private: 57 | // Disallow copying of instances of this class 58 | NullAppender(const NullAppender&); 59 | NullAppender& operator=(const NullAppender&); 60 | }; 61 | 62 | } // end namespace log4cplus 63 | 64 | #endif // LOG4CPLUS_NULL_APPENDER_HEADER_ 65 | 66 | -------------------------------------------------------------------------------- /include/log4cplus/spi/loggerfactory.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: loggerfactory.h 4 | // Created: 6/2001 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2001-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER 25 | #define LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | 35 | 36 | namespace log4cplus { 37 | // Forward Declarations 38 | class Logger; 39 | class Hierarchy; 40 | 41 | namespace spi { 42 | class LoggerImpl; 43 | 44 | /** 45 | * Implement this interface to create new instances of Logger or 46 | * a sub-class of Logger. 47 | */ 48 | class LOG4CPLUS_EXPORT LoggerFactory { 49 | public: 50 | /** 51 | * Creates a new Logger object. 52 | */ 53 | virtual Logger makeNewLoggerInstance(const log4cplus::tstring_view& name, 54 | Hierarchy& h) = 0; 55 | virtual ~LoggerFactory() = 0; 56 | 57 | protected: 58 | virtual LoggerImpl * makeNewLoggerImplInstance( 59 | const log4cplus::tstring_view& name, Hierarchy& h) = 0; 60 | }; 61 | 62 | } // end namespace spi 63 | } // end namespace log4cplus 64 | 65 | #endif // LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER 66 | -------------------------------------------------------------------------------- /include/log4cplus/streams.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: streams.h 4 | // Created: 4/2003 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2003-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_STREAMS_HEADER_ 25 | #define LOG4CPLUS_STREAMS_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #include 34 | 35 | #include 36 | 37 | 38 | namespace log4cplus 39 | { 40 | typedef std::basic_ostream tostream; 41 | typedef std::basic_istream tistream; 42 | typedef std::basic_ostringstream tostringstream; 43 | typedef std::basic_istringstream tistringstream; 44 | extern LOG4CPLUS_EXPORT tostream & tcout; 45 | extern LOG4CPLUS_EXPORT tostream & tcerr; 46 | } 47 | 48 | #if defined (UNICODE) && defined (LOG4CPLUS_ENABLE_GLOBAL_C_STRING_STREAM_INSERTER) 49 | 50 | LOG4CPLUS_EXPORT log4cplus::tostream& operator <<(log4cplus::tostream&, const char* psz ); 51 | 52 | #endif 53 | 54 | #endif // LOG4CPLUS_STREAMS_HEADER_ 55 | 56 | -------------------------------------------------------------------------------- /include/log4cplus/tchar.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modifica- 5 | // tion, are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 15 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 16 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 17 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 19 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 20 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | /** @file */ 26 | 27 | #ifndef LOG4CPLUS_TCHAR_HEADER_ 28 | #define LOG4CPLUS_TCHAR_HEADER_ 29 | 30 | #include 31 | 32 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 33 | #pragma once 34 | #endif 35 | 36 | #if defined (_WIN32) 37 | #include 38 | #endif 39 | 40 | 41 | #ifdef UNICODE 42 | # define LOG4CPLUS_TEXT2(STRING) L##STRING 43 | #else 44 | # define LOG4CPLUS_TEXT2(STRING) STRING 45 | #endif // UNICODE 46 | #define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING) 47 | 48 | 49 | namespace log4cplus 50 | { 51 | 52 | #if defined (UNICODE) 53 | typedef wchar_t tchar; 54 | 55 | #else 56 | typedef char tchar; 57 | 58 | #endif 59 | 60 | } // namespace log4cplus 61 | 62 | 63 | #endif // LOG4CPLUS_TCHAR_HEADER_ 64 | -------------------------------------------------------------------------------- /include/log4cplus/thread/impl/syncprims-cxx11.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Copyright (C) 2013-2017, Vaclav Zeman. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modifica- 5 | // tion, are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 15 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 16 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 17 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 19 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 20 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | 25 | //! @file 26 | //! This file contains implementations of synchronization 27 | //! primitives using the C++11 API. It does not contain any include 28 | //! guards because it is only a fragment to be included by 29 | //! syncprims.h. 30 | 31 | namespace log4cplus { namespace thread { namespace impl { 32 | 33 | #include "log4cplus/thread/impl/syncprims-pmsm.h" 34 | 35 | } } } // namespace log4cplus { namespace thread { namespace impl { 36 | -------------------------------------------------------------------------------- /include/log4cplus/thread/impl/threads-impl.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: threads.h 4 | // Created: 6/2001 5 | // Author: Tad E. Smith 6 | // 7 | // 8 | // Copyright 2001-2017 Tad E. Smith 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ 25 | #define LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #if defined (_WIN32) 34 | #include 35 | #endif 36 | #include 37 | #include 38 | #include 39 | 40 | #if ! defined (INSIDE_LOG4CPLUS) 41 | # error "This header must not be be used outside log4cplus' implementation files." 42 | #endif 43 | 44 | 45 | namespace log4cplus { namespace thread { namespace impl { 46 | 47 | 48 | #if defined (LOG4CPLUS_USE_PTHREADS) 49 | 50 | typedef pthread_t os_handle_type; 51 | typedef pthread_t os_id_type; 52 | 53 | 54 | inline 55 | pthread_t 56 | getCurrentThreadId () 57 | { 58 | return pthread_self (); 59 | } 60 | 61 | 62 | #elif defined (LOG4CPLUS_USE_WIN32_THREADS) 63 | 64 | typedef HANDLE os_handle_type; 65 | typedef DWORD os_id_type; 66 | 67 | 68 | inline 69 | DWORD 70 | getCurrentThreadId () 71 | { 72 | return GetCurrentThreadId (); 73 | } 74 | 75 | 76 | #elif defined (LOG4CPLUS_SINGLE_THREADED) 77 | 78 | typedef void * os_handle_type; 79 | typedef int os_id_type; 80 | 81 | 82 | inline 83 | int 84 | getCurrentThreadId () 85 | { 86 | return 1; 87 | } 88 | 89 | 90 | #endif 91 | 92 | 93 | } } } // namespace log4cplus { namespace thread { namespace impl { 94 | 95 | 96 | #endif // LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ 97 | -------------------------------------------------------------------------------- /include/log4cplus/win32debugappender.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | // Module: Log4CPLUS 3 | // File: win32debugappender.h 4 | // Created: 12/2003 5 | // Author: Eduardo Francos, Odalio SARL 6 | // 7 | // 8 | // Copyright 2003-2017 Odalio SARL 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); 11 | // you may not use this file except in compliance with the License. 12 | // You may obtain a copy of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, 18 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | // See the License for the specific language governing permissions and 20 | // limitations under the License. 21 | 22 | /** @file */ 23 | 24 | #ifndef LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_ 25 | #define LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_ 26 | 27 | #include 28 | 29 | #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 30 | #pragma once 31 | #endif 32 | 33 | #if defined (LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING) 34 | 35 | #include 36 | 37 | 38 | namespace log4cplus { 39 | 40 | /** 41 | * Prints log events using OutputDebugString(). 42 | */ 43 | class LOG4CPLUS_EXPORT Win32DebugAppender 44 | : public Appender 45 | { 46 | public: 47 | // Ctors 48 | Win32DebugAppender(); 49 | Win32DebugAppender(const log4cplus::helpers::Properties& properties); 50 | 51 | // Dtor 52 | virtual ~Win32DebugAppender(); 53 | 54 | // Methods 55 | virtual void close() override; 56 | 57 | protected: 58 | virtual void append(const log4cplus::spi::InternalLoggingEvent& event) override; 59 | 60 | private: 61 | // Disallow copying of instances of this class 62 | Win32DebugAppender(const Win32DebugAppender&); 63 | Win32DebugAppender& operator=(const Win32DebugAppender&); 64 | }; 65 | 66 | } // end namespace log4cplus 67 | 68 | #endif // LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING 69 | #endif // LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_ 70 | -------------------------------------------------------------------------------- /log4cplus.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | modules= 6 | 7 | Name: log4cplus 8 | Version: @VERSION@ 9 | Description: Simple to use, thread-safe C++ logging API 10 | Requires: 11 | Libs: -L${libdir} -llog4cplus 12 | Libs.private: @LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /m4/ax_append_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_append_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space 12 | # added in between. 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains 16 | # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly 17 | # FLAG. 18 | # 19 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. 20 | # 21 | # LICENSE 22 | # 23 | # Copyright (c) 2008 Guido U. Draheim 24 | # Copyright (c) 2011 Maarten Bosmans 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 8 32 | 33 | AC_DEFUN([AX_APPEND_FLAG], 34 | [dnl 35 | AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF 36 | AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) 37 | AS_VAR_SET_IF(FLAGS,[ 38 | AS_CASE([" AS_VAR_GET(FLAGS) "], 39 | [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], 40 | [ 41 | AS_VAR_APPEND(FLAGS,[" $1"]) 42 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 43 | ]) 44 | ], 45 | [ 46 | AS_VAR_SET(FLAGS,[$1]) 47 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 48 | ]) 49 | AS_VAR_POPDEF([FLAGS])dnl 50 | ])dnl AX_APPEND_FLAG 51 | -------------------------------------------------------------------------------- /m4/ax_c_ifdef.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_c_ifdef.html 3 | # =========================================================================== 4 | # 5 | # OBSOLETE MACRO 6 | # 7 | # Deprecated in favor of the standard Autoconf macro AC_CHECK_DECL. 8 | # 9 | # SYNOPSIS 10 | # 11 | # AX_C_IFDEF(MACRO-NAME, ACTION-IF-DEF, ACTION-IF-NOT-DEF) 12 | # 13 | # DESCRIPTION 14 | # 15 | # Check for the definition of macro MACRO-NAME using the current 16 | # language's compiler. 17 | # 18 | # LICENSE 19 | # 20 | # Copyright (c) 2008 Ludovic Courtes 21 | # 22 | # Copying and distribution of this file, with or without modification, are 23 | # permitted in any medium without royalty provided the copyright notice 24 | # and this notice are preserved. This file is offered as-is, without any 25 | # warranty. 26 | 27 | #serial 6 28 | 29 | AU_ALIAS([_AC_C_IFDEF], [AX_C_IFDEF]) 30 | AC_DEFUN([AX_C_IFDEF], 31 | [AC_COMPILE_IFELSE([#ifndef $1 32 | # error "Macro $1 is undefined!" 33 | /* For some compilers (eg. SGI's CC), #error is not 34 | enough... */ 35 | please, do fail 36 | #endif], 37 | [$2], [$3])]) 38 | -------------------------------------------------------------------------------- /m4/ax_getaddrinfo.m4: -------------------------------------------------------------------------------- 1 | dnl AX_GETADDRINFO checks for getaddrinfo() function and sets 2 | dnl $ax_cv_have_getaddrinfo accordingly and defines 3 | dnl HAVE_GETADDRINFO. 4 | 5 | AC_DEFUN([AX_GETADDRINFO], [ 6 | AH_TEMPLATE([HAVE_GETADDRINFO]) 7 | AC_CACHE_CHECK([for getaddrinfo], [ax_cv_have_getaddrinfo], 8 | [AC_COMPILE_IFELSE( 9 | [AC_LANG_PROGRAM([ 10 | #ifdef __cplusplus 11 | #include 12 | #else 13 | #include 14 | #endif 15 | 16 | #include 17 | #include 18 | #include 19 | ], [ 20 | getaddrinfo (NULL, NULL, NULL, NULL); 21 | ])], 22 | [ax_cv_have_getaddrinfo=yes], 23 | [ax_cv_have_getaddrinfo=no])]) 24 | 25 | AS_IF([test "x$ax_cv_have_getaddrinfo" = "xyes"], 26 | [AC_DEFINE([HAVE_GETADDRINFO])]) 27 | ]) 28 | -------------------------------------------------------------------------------- /m4/ax_gethostbyname_r.m4: -------------------------------------------------------------------------------- 1 | dnl AX_GETHOSTBYNAME_R checks for gethostbyname_r() function and sets 2 | dnl $ax_cv_have_gethostbyname_r accordingly and defines 3 | dnl HAVE_GETHOSTBYNAME_R. 4 | 5 | AC_DEFUN([AX_GETHOSTBYNAME_R], [ 6 | AH_TEMPLATE([HAVE_GETHOSTBYNAME_R]) 7 | AC_CACHE_CHECK([for gethostbyname_r], [ax_cv_have_gethostbyname_r], 8 | [AC_COMPILE_IFELSE( 9 | [AC_LANG_PROGRAM([ 10 | #ifdef __cplusplus 11 | #include 12 | #else 13 | #include 14 | #endif 15 | 16 | #include 17 | #include 18 | #include 19 | ], [ 20 | gethostbyname_r (NULL, NULL, NULL, 0, NULL, NULL); 21 | ])], 22 | [ax_cv_have_gethostbyname_r=yes], 23 | [ax_cv_have_gethostbyname_r=no])]) 24 | 25 | AS_IF([test "x$ax_cv_have_gethostbyname_r" = "xyes"], 26 | [AC_DEFINE([HAVE_GETHOSTBYNAME_R])]) 27 | ]) 28 | -------------------------------------------------------------------------------- /m4/ax_log4cplus_wrappers.m4: -------------------------------------------------------------------------------- 1 | dnl LOG4CPLUS_CHECK_HEADER([header], [preprocessor symbol to define]) 2 | AC_DEFUN([LOG4CPLUS_CHECK_HEADER], 3 | [AH_TEMPLATE([$2]) 4 | AC_CHECK_HEADER([$1], [AC_DEFINE([$2])])]) 5 | 6 | dnl LOG4CPLUS_CHECK_FUNCS([function], [preprocessor symbol to define]) 7 | AC_DEFUN([LOG4CPLUS_CHECK_FUNCS], 8 | [AH_TEMPLATE([$2]) 9 | AC_CHECK_FUNCS([$1], [AC_DEFINE([$2])])]) 10 | 11 | dnl Define log4cplus_check_yesno_func(). 12 | AC_DEFUN([LOG4CPLUS_CHECK_YESNO_FUNC], 13 | [log4cplus_check_yesno_func() { 14 | AS_CASE(["$][1"], 15 | [yes], [], 16 | [no], [], 17 | [AC_MSG_ERROR([bad value "$][1" for "$][2"])]) 18 | }]) 19 | 20 | dnl Check for use with AC_ARG_ENABLE macro. 21 | AC_DEFUN([LOG4CPLUS_CHECK_YESNO], 22 | [AC_REQUIRE([LOG4CPLUS_CHECK_YESNO_FUNC]) 23 | log4cplus_check_yesno_func "$1" "$2"]) 24 | 25 | dnl Define log4cplus_grep_cxxflags_for_optimization() shell function. 26 | AC_DEFUN([LOG4CPLUS_GREP_CXXFLAGS_FOR_OPTIMIZATION], 27 | [AC_REQUIRE([AC_PROG_GREP]) 28 | log4cplus_grep_cxxflags_for_optimization() { 29 | AS_ECHO_N(["$CXXFLAGS"]) dnl 30 | | $GREP -e ['\(^\|[[:space:]]\)-O\([^[:space:]]*\([[:space:]]\|$\)\)']dnl 31 | >/dev/null 32 | }]) 33 | 34 | dnl Add switch to CXXFLAGS if it does not contain any -Oxyz option. 35 | AC_DEFUN([LOG4CPLUS_CXXFLAGS_ADD_IF_NO_OPTIMIZATION], 36 | [AC_REQUIRE([LOG4CPLUS_GREP_CXXFLAGS_FOR_OPTIMIZATION]) 37 | AS_IF([log4cplus_grep_cxxflags_for_optimization], 38 | [], 39 | [AX_CXXFLAGS_GCC_OPTION([$1])])]) 40 | 41 | dnl Declare --with-foo. 42 | AC_DEFUN([LOG4CPLUS_ARG_WITH], 43 | [AC_ARG_WITH([$1], 44 | [AS_HELP_STRING([--with-$1], [$2])], 45 | [LOG4CPLUS_CHECK_YESNO([${withval}], [--with-$1])], 46 | [$3])]) 47 | 48 | dnl Declare --enable-bar. 49 | AC_DEFUN([LOG4CPLUS_ARG_ENABLE], 50 | [AC_ARG_ENABLE([$1], 51 | [AS_HELP_STRING([--enable-$1], [$2])], 52 | [LOG4CPLUS_CHECK_YESNO([${enableval}], [--enable-$1])], 53 | [$3])]) 54 | 55 | dnl Define C++ preprocessor symbol if condition evaluates true. 56 | AC_DEFUN([LOG4CPLUS_DEFINE_MACRO_IF], 57 | [AH_TEMPLATE([$1], [$2])dnl 58 | AS_IF([$3], [AC_DEFINE([$1], [$4])], [])]) 59 | -------------------------------------------------------------------------------- /m4/ax_macro_function.m4: -------------------------------------------------------------------------------- 1 | dnl Macros that check for availability of __FUNCTION__ and 2 | dnl __PRETTY_FUNCTIN__ macros. 3 | 4 | AC_DEFUN([AX___FUNCTION___MACRO], 5 | [ 6 | AH_TEMPLATE([HAVE___FUNCTION___MACRO], 7 | [Defined if the compiler supports __FUNCTION__ macro.]) 8 | 9 | AC_CACHE_CHECK([for __FUNCTION__ macro], [ac_cv_have___function___macro], 10 | [ 11 | AC_COMPILE_IFELSE( 12 | [AC_LANG_PROGRAM( 13 | [[]], 14 | [[ 15 | char const * func = __FUNCTION__; 16 | ]] 17 | )], 18 | [ac_cv_have___function___macro=yes], 19 | [ac_cv_have___function___macro=no]) 20 | ]) 21 | ]) 22 | 23 | 24 | AC_DEFUN([AX___PRETTY_FUNCTION___MACRO], 25 | [ 26 | AH_TEMPLATE([HAVE___PRETTY_FUNCTION___MACRO], 27 | [Defined if the compiler supports __PRETTY_FUNCTION__ macro.]) 28 | 29 | AC_CACHE_CHECK([for __PRETTY_FUNCTION__ macro], 30 | [ac_cv_have___pretty_function___macro], 31 | [ 32 | AC_COMPILE_IFELSE( 33 | [AC_LANG_PROGRAM( 34 | [[]], 35 | [[ 36 | char const * func = __PRETTY_FUNCTION__; 37 | ]] 38 | )], 39 | [ac_cv_have___pretty_function___macro=yes], 40 | [ac_cv_have___pretty_function___macro=no]) 41 | ]) 42 | ]) 43 | 44 | 45 | AC_DEFUN([AX___FUNC___SYMBOL], 46 | [ 47 | AH_TEMPLATE([HAVE___FUNC___SYMBOL], 48 | [Defined if the compiler supports __func__ symbol.]) 49 | 50 | AC_CACHE_CHECK([for __func__ symbol], 51 | [ac_cv_have___func___symbol], 52 | [ 53 | AC_LINK_IFELSE( 54 | [AC_LANG_PROGRAM( 55 | [[]], 56 | [[ 57 | char const * func = __func__; 58 | ]] 59 | )], 60 | [ac_cv_have___func___symbol=yes], 61 | [ac_cv_have___func___symbol=no]) 62 | ]) 63 | ]) 64 | -------------------------------------------------------------------------------- /m4/ax_prepend_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_prepend_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_PREPEND_FLAG(FLAG, [FLAGS-VARIABLE]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # FLAG is added to the front of the FLAGS-VARIABLE shell variable, with a 12 | # space added in between. 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains 16 | # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly 17 | # FLAG. 18 | # 19 | # NOTE: Implementation based on AX_APPEND_FLAG. 20 | # 21 | # LICENSE 22 | # 23 | # Copyright (c) 2008 Guido U. Draheim 24 | # Copyright (c) 2011 Maarten Bosmans 25 | # Copyright (c) 2018 John Zaitseff 26 | # 27 | # Copying and distribution of this file, with or without modification, are 28 | # permitted in any medium without royalty provided the copyright notice 29 | # and this notice are preserved. This file is offered as-is, without any 30 | # warranty. 31 | 32 | #serial 2 33 | 34 | AC_DEFUN([AX_PREPEND_FLAG], 35 | [dnl 36 | AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF 37 | AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) 38 | AS_VAR_SET_IF(FLAGS,[ 39 | AS_CASE([" AS_VAR_GET(FLAGS) "], 40 | [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], 41 | [ 42 | FLAGS="$1 $FLAGS" 43 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 44 | ]) 45 | ], 46 | [ 47 | AS_VAR_SET(FLAGS,[$1]) 48 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 49 | ]) 50 | AS_VAR_POPDEF([FLAGS])dnl 51 | ])dnl AX_PREPEND_FLAG 52 | -------------------------------------------------------------------------------- /m4/ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 2 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation, 4 | # Inc. 5 | # Written by Scott James Remnant, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # @configure_input@ 12 | 13 | # serial 4392 ltversion.m4 14 | # This file is part of GNU Libtool 15 | 16 | m4_define([LT_PACKAGE_VERSION], [2.5.3]) 17 | m4_define([LT_PACKAGE_REVISION], [2.5.3]) 18 | 19 | AC_DEFUN([LTVERSION_VERSION], 20 | [macro_version='2.5.3' 21 | macro_revision='2.5.3' 22 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 23 | _LT_DECL(, macro_revision, 0) 24 | ]) 25 | -------------------------------------------------------------------------------- /msvc14/CLFSAppender.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | log4cplus-$(ProjectName) 8 | 9 | 10 | 11 | ..\include;%(AdditionalIncludeDirectories) 12 | INSIDE_LOG4CPLUS_CLFSAPPENDER;LOG4CPLUS_CLFSAPPENDER_BUILD_DLL;LOG4CPLUS_BUILD_DLL;%(PreprocessorDefinitions) 13 | $(OutDir)$(TargetName).pdb 14 | Level3 15 | stdcpp20 16 | stdc17 17 | 18 | 19 | $(SolutionDir)$(Platform)\bin.$(Configuration);%(AdditionalLibraryDirectories) 20 | clfsw32.lib;%(AdditionalDependencies) 21 | true 22 | 23 | 24 | -------------------------------------------------------------------------------- /msvc14/MSTTSAppender.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | log4cplus-$(ProjectName) 8 | 9 | 10 | 11 | ..\include;%(AdditionalIncludeDirectories) 12 | INSIDE_LOG4CPLUS_MSTTSAPPENDER;LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL;LOG4CPLUS_BUILD_DLL;%(PreprocessorDefinitions) 13 | $(OutDir)$(TargetName).pdb 14 | Level3 15 | stdcpp20 16 | stdc17 17 | 18 | 19 | $(SolutionDir)$(Platform)\bin.$(Configuration);%(AdditionalLibraryDirectories) 20 | sapi.lib;%(AdditionalDependencies) 21 | true 22 | 23 | 24 | -------------------------------------------------------------------------------- /msvc14/Qt4DebugAppender.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | log4cplus-$(ProjectName) 8 | 9 | 10 | 11 | ..\include;C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\include;C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\include\Qt;C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\include\QtCore;%(AdditionalIncludeDirectories) 12 | INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER;LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL;LOG4CPLUS_BUILD_DLL;QT_SHARED;QT_THREAD_SUPPORT;%(PreprocessorDefinitions) 13 | $(OutDir)$(TargetName).pdb 14 | Level3 15 | stdcpp20 16 | stdc17 17 | 18 | 19 | $(SolutionDir)$(Platform)\bin.$(Configuration);C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib;%(AdditionalLibraryDirectories) 20 | true 21 | 22 | 23 | -------------------------------------------------------------------------------- /msvc14/Qt5DebugAppender.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | log4cplus-$(ProjectName) 8 | 9 | 10 | 11 | ..\include;C:\Qt\Qt5.0.2\5.0.2\msvc2010\include;C:\Qt\Qt5.0.2\5.0.2\msvc2010\include\QtCore;%(AdditionalIncludeDirectories) 12 | INSIDE_LOG4CPLUS_QT5DEBUGAPPENDER;LOG4CPLUS_QT5DEBUGAPPENDER_BUILD_DLL;LOG4CPLUS_BUILD_DLL;QT_SHARED;QT_THREAD_SUPPORT;%(PreprocessorDefinitions) 13 | $(OutDir)$(TargetName).pdb 14 | Level3 15 | stdcpp20 16 | stdc17 17 | 18 | 19 | $(SolutionDir)$(Platform)\bin.$(Configuration);C:\Qt\Qt5.0.2\5.0.2\msvc2010\lib;%(AdditionalLibraryDirectories) 20 | true 21 | 22 | 23 | -------------------------------------------------------------------------------- /msvc14/log4cplus_debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | 6 | 7 | 8 | Disabled 9 | _DEBUG;DEBUG;%(PreprocessorDefinitions) 10 | MultiThreadedDebugDLL 11 | true 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/log4cplus_release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | 6 | 7 | 8 | MaxSpeed 9 | AnySuitable 10 | true 11 | Speed 12 | true 13 | true 14 | NDEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;%(PreprocessorDefinitions) 15 | false 16 | 17 | 18 | -------------------------------------------------------------------------------- /msvc14/log4cplus_static.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | .lib 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /msvc14/loggingserver.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | 8 | 9 | 10 | ..\include;%(AdditionalIncludeDirectories) 11 | LOG4CPLUS_BUILD_DLL;%(PreprocessorDefinitions) 12 | $(OutDir)$(TargetName).pdb 13 | Level3 14 | stdcpp20 15 | stdc17 16 | 17 | 18 | $(SolutionDir)$(Platform)\bin.$(Configuration);%(AdditionalLibraryDirectories) 19 | 20 | 21 | -------------------------------------------------------------------------------- /msvc14/loggingserver.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fdcfbd77-3762-49ca-ae73-c4a26d9b8c69} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /msvc14/tests/appender_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {cdb4a051-bd14-43e2-8c16-969d47bbbc52} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/appender_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {cdb4a051-bd14-43e2-8c16-969d47bbbc52} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/configandwatch_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {cc488b10-6196-4822-84f6-45113dad516f} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/configandwatch_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {cc488b10-6196-4822-84f6-45113dad516f} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/customloglevel_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d9fa0575-bb83-4a00-b98e-de8fb0099466} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /msvc14/tests/customloglevel_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d9fa0575-bb83-4a00-b98e-de8fb0099466} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /msvc14/tests/fileappender_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {f8c4f23f-9b9e-45a5-9398-52ec3d181271} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/fileappender_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {f8c4f23f-9b9e-45a5-9398-52ec3d181271} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/filter_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fe49f965-3bd7-463e-9488-2f11a50b722e} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/filter_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fe49f965-3bd7-463e-9488-2f11a50b722e} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/hierarchy_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {81394ec9-d432-4eb0-aa7a-b8e48e776cec} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/hierarchy_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {81394ec9-d432-4eb0-aa7a-b8e48e776cec} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/log4cplus_tests.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.40219.1 5 | $(SolutionDir)$(PlatformName)\bin.$(Configuration)\ 6 | $(SolutionDir)$(PlatformName)\obj.$(ProjectName).$(Configuration)\ 7 | 8 | 9 | 10 | ..\..\include;..\..\catch\single_include\catch2;%(AdditionalIncludeDirectories) 11 | ProgramDatabase 12 | $(OutDir)$(TargetName).pdb 13 | Level3 14 | stdcpp20 15 | stdc17 16 | 17 | 18 | $(SolutionDir)$(Platform)\bin.$(Configuration);%(AdditionalLibraryDirectories) 19 | true 20 | false 21 | 22 | 23 | -------------------------------------------------------------------------------- /msvc14/tests/log4cplus_tests_dll.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | LOG4CPLUS_BUILD_DLL;%(PreprocessorDefinitions) 6 | 7 | 8 | -------------------------------------------------------------------------------- /msvc14/tests/log4cplus_tests_static.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | LOG4CPLUS_STATIC;%(PreprocessorDefinitions) 6 | 7 | 8 | -------------------------------------------------------------------------------- /msvc14/tests/loglog_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {8bee4727-e23d-4e69-b78c-d921095cba8c} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/loglog_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {8bee4727-e23d-4e69-b78c-d921095cba8c} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/ndc_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {075adf0f-278c-46f6-94c7-90778c810024} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/ndc_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {075adf0f-278c-46f6-94c7-90778c810024} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/ostream_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {3fe898d7-09b6-4e73-9cc5-07aec4ed223c} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/ostream_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {3fe898d7-09b6-4e73-9cc5-07aec4ed223c} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/patternlayout_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {ea7894e1-50e7-4774-a121-c1aba8c3dc54} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/patternlayout_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {ea7894e1-50e7-4774-a121-c1aba8c3dc54} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/performance_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {a5eab79c-b344-477b-92c9-bc33699a92cc} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/performance_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {a5eab79c-b344-477b-92c9-bc33699a92cc} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/priority_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {67d392e9-34ac-45e1-8c74-95d9236fa5bc} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /msvc14/tests/priority_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {67d392e9-34ac-45e1-8c74-95d9236fa5bc} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | -------------------------------------------------------------------------------- /msvc14/tests/propertyconfig_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {34631475-FC1B-4856-9E3F-95323D5701B7} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/propertyconfig_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {34631475-FC1B-4856-9E3F-95323D5701B7} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/socket_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {e70368a7-53a0-4f2c-90cb-856e304783b0} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/socket_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {e70368a7-53a0-4f2c-90cb-856e304783b0} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/thread_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {a457e09c-4ed8-402a-8a23-706d67b89295} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/thread_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {a457e09c-4ed8-402a-8a23-706d67b89295} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/timeformat_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {98660f6a-7434-46af-8fb0-0f533de1c647} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /msvc14/tests/timeformat_testS.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {98660f6a-7434-46af-8fb0-0f533de1c647} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /qt4debugappender/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (qt4debugappender_sources 2 | qt4debugappender.cxx) 3 | 4 | find_package (Qt4 REQUIRED) 5 | include (${QT_USE_FILE}) 6 | 7 | set (qt4debugappender log4cplusqt4debugappender${log4cplus_postfix}) 8 | add_library (${qt4debugappender} ${qt4debugappender_sources}) 9 | add_library (log4cplus::qt4debugappender ALIAS ${qt4debugappender}) 10 | if (UNICODE) 11 | target_compile_definitions (${qt4debugappender} PUBLIC UNICODE) 12 | target_compile_definitions (${qt4debugappender} PUBLIC _UNICODE) 13 | add_definitions (-UMBCS -U_MBCS) 14 | endif (UNICODE) 15 | if (${BUILD_SHARED_LIBS}) 16 | target_compile_definitions (${qt4debugappender} PRIVATE ${log4cplus}_EXPORTS) 17 | endif () 18 | target_link_libraries (${qt4debugappender} 19 | ${log4cplus} 20 | ${QT_LIBRARIES} 21 | ${CMAKE_THREAD_LIBS_INIT}) 22 | 23 | if (ANDROID) 24 | # Android does not seem to have SO version support. 25 | elseif (WIN32) 26 | set_target_properties (${qt4debugappender} PROPERTIES 27 | VERSION "${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}") 28 | else () 29 | set_target_properties (${qt4debugappender} PROPERTIES 30 | SOVERSION "${log4cplus_soversion}") 31 | endif () 32 | target_compile_definitions (${qt4debugappender} PRIVATE INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER) 33 | 34 | if (APPLE) 35 | set_target_properties (${log4cplus} PROPERTIES 36 | MACHO_CURRENT_VERSION "${log4cplus_macho_current_version}" 37 | MACHO_COMPATIBILITY_VERSION "${log4cplus_macho_compatibility_version}") 38 | endif () 39 | 40 | if (WIN32) 41 | set_target_properties (${qt4debugappender} PROPERTIES 42 | DEBUG_POSTFIX "D") 43 | endif () 44 | 45 | install (TARGETS ${qt4debugappender} 46 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 47 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 48 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 49 | 50 | install (FILES ../include/log4cplus/qt4debugappender.h 51 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/log4cplus) 52 | -------------------------------------------------------------------------------- /qt4debugappender/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES += liblog4cplusqt4debugappender.la 2 | 3 | liblog4cplusqt4debugappender_la_cppflags = \ 4 | $(AM_CPPFLAGS) \ 5 | -DINSIDE_LOG4CPLUS_QT4DEBUGAPPENDER \ 6 | @QT_CFLAGS@ 7 | liblog4cplusqt4debugappender_la_CPPFLAGS = \ 8 | $(liblog4cplusqt4debugappender_la_cppflags) 9 | 10 | liblog4cplusqt4debugappender_la_sources = \ 11 | $(INCLUDES_SRC_PATH)/qt4debugappender.h \ 12 | qt4debugappender/qt4debugappender.cxx 13 | liblog4cplusqt4debugappender_la_SOURCES = $(liblog4cplusqt4debugappender_la_sources) 14 | 15 | liblog4cplusqt4debugappender_la_LIBADD = $(liblog4cplus_la_file) 16 | 17 | liblog4cplusqt4debugappender_la_ldflags = -no-undefined \ 18 | $(LOG4CPLUS_VERSION_LT_FLAGS) \ 19 | @QT_LIBS@ @LOG4CPLUS_PROFILING_LDFLAGS@ 20 | liblog4cplusqt4debugappender_la_LDFLAGS = \ 21 | $(liblog4cplusqt4debugappender_la_ldflags) 22 | 23 | if BUILD_WITH_WCHAR_T_SUPPORT 24 | lib_LTLIBRARIES += liblog4cplusqt4debugappenderU.la 25 | liblog4cplusqt4debugappenderU_la_CPPFLAGS = \ 26 | $(liblog4cplusqt4debugappender_la_cppflags) -DUNICODE=1 -D_UNICODE=1 27 | liblog4cplusqt4debugappenderU_la_SOURCES = \ 28 | $(liblog4cplusqt4debugappender_la_sources) 29 | liblog4cplusqt4debugappenderU_la_LIBADD = $(liblog4cplusU_la_file) 30 | liblog4cplusqt4debugappenderU_la_LDFLAGS = \ 31 | $(liblog4cplusqt4debugappender_la_ldflags) 32 | endif 33 | -------------------------------------------------------------------------------- /qt5debugappender/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (qt5debugappender_sources 2 | qt5debugappender.cxx) 3 | 4 | find_package (Qt5Core REQUIRED) 5 | #include (${QT_USE_FILE}) 6 | 7 | set (qt5debugappender log4cplusqt5debugappender${log4cplus_postfix}) 8 | add_library (${qt5debugappender} ${qt5debugappender_sources}) 9 | add_library (log4cplus::qt5debugappender ALIAS ${qt5debugappender}) 10 | if (UNICODE) 11 | target_compile_definitions (${qt5debugappender} PUBLIC UNICODE) 12 | target_compile_definitions (${qt5debugappender} PUBLIC _UNICODE) 13 | add_definitions (-UMBCS -U_MBCS) 14 | endif (UNICODE) 15 | if (${BUILD_SHARED_LIBS}) 16 | target_compile_definitions (${qt5debugappender} PRIVATE ${log4cplus}_EXPORTS) 17 | endif () 18 | target_link_libraries (${qt5debugappender} 19 | ${log4cplus} 20 | ${Qt5Widgets_LIBRARIES} 21 | ${CMAKE_THREAD_LIBS_INIT}) 22 | 23 | if (ANDROID) 24 | # Android does not seem to have SO version support. 25 | elseif (WIN32) 26 | set_target_properties (${qt5debugappender} PROPERTIES 27 | VERSION "${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}") 28 | else () 29 | set_target_properties (${qt5debugappender} PROPERTIES 30 | SOVERSION "${log4cplus_soversion}") 31 | endif () 32 | target_compile_definitions (${qt5debugappender} PRIVATE INSIDE_LOG4CPLUS_QT5DEBUGAPPENDER) 33 | 34 | if (APPLE) 35 | set_target_properties (${log4cplus} PROPERTIES 36 | MACHO_CURRENT_VERSION "${log4cplus_macho_current_version}" 37 | MACHO_COMPATIBILITY_VERSION "${log4cplus_macho_compatibility_version}") 38 | endif () 39 | 40 | qt5_use_modules(${qt5debugappender} Core) 41 | 42 | if (WIN32) 43 | set_target_properties (${qt5debugappender} PROPERTIES 44 | DEBUG_POSTFIX "D") 45 | endif () 46 | 47 | install (TARGETS ${qt5debugappender} 48 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 49 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 50 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 51 | 52 | install (FILES ../include/log4cplus/qt5debugappender.h 53 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/log4cplus) 54 | -------------------------------------------------------------------------------- /qt5debugappender/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES += liblog4cplusqt5debugappender.la 2 | 3 | liblog4cplusqt5debugappender_la_cppflags = \ 4 | $(AM_CPPFLAGS) \ 5 | -DINSIDE_LOG4CPLUS_QT5DEBUGAPPENDER \ 6 | @QT5_CFLAGS@ 7 | liblog4cplusqt5debugappender_la_CPPFLAGS = \ 8 | $(liblog4cplusqt5debugappender_la_cppflags) 9 | 10 | liblog4cplusqt5debugappender_la_sources = \ 11 | $(INCLUDES_SRC_PATH)/qt5debugappender.h \ 12 | qt5debugappender/qt5debugappender.cxx 13 | liblog4cplusqt5debugappender_la_SOURCES = \ 14 | $(liblog4cplusqt5debugappender_la_sources) 15 | 16 | liblog4cplusqt5debugappender_la_LIBADD = $(liblog4cplus_la_file) 17 | 18 | liblog4cplusqt5debugappender_la_ldflags = -no-undefined \ 19 | $(LOG4CPLUS_VERSION_LT_FLAGS) \ 20 | @QT5_LIBS@ @LOG4CPLUS_PROFILING_LDFLAGS@ 21 | liblog4cplusqt5debugappender_la_LDFLAGS = \ 22 | $(liblog4cplusqt5debugappender_la_ldflags) 23 | 24 | if BUILD_WITH_WCHAR_T_SUPPORT 25 | lib_LTLIBRARIES += liblog4cplusqt5debugappenderU.la 26 | liblog4cplusqt5debugappenderU_la_CPPFLAGS = \ 27 | $(liblog4cplusqt5debugappender_la_cppflags) -DUNICODE=1 -D_UNICODE=1 28 | liblog4cplusqt5debugappenderU_la_SOURCES = \ 29 | $(liblog4cplusqt5debugappender_la_sources) 30 | liblog4cplusqt5debugappenderU_la_LIBADD = $(liblog4cplusU_la_file) 31 | liblog4cplusqt5debugappenderU_la_LDFLAGS = \ 32 | $(liblog4cplusqt5debugappender_la_ldflags) 33 | endif 34 | -------------------------------------------------------------------------------- /scripts/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | libtoolize --force --automake 4 | 5 | autoheader 6 | aclocal $ACLOCAL_FLAGS 7 | autoconf 8 | automake --ignore-deps --add-missing 9 | 10 | echo 'run "configure; make"' 11 | 12 | -------------------------------------------------------------------------------- /scripts/clean_cmake_files.bat: -------------------------------------------------------------------------------- 1 | 2 | REM Make changes to environment local 3 | setlocal 4 | 5 | SET RMDIR=rmdir /S /Q 6 | SET DEL=del /Q 7 | 8 | %RMDIR% CMakeFiles 9 | %RMDIR% debug 10 | %RMDIR% log4cplus.dir 11 | %RMDIR% loggingserver.dir 12 | %RMDIR% minsizerel 13 | %RMDIR% release 14 | %RMDIR% relwithdebinfo 15 | %RMDIR% ZERO_CHECK.dir 16 | 17 | %DEL% cmake_install.cmake 18 | %DEL% CMakeCache.txt 19 | 20 | REM Clean up changes to environment. 21 | endlocal 22 | -------------------------------------------------------------------------------- /scripts/clean_cmake_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | for f in CMakeFiles \ 6 | debug \ 7 | log4cplus.dir \ 8 | loggingserver.dir \ 9 | minsizerel \ 10 | release \ 11 | relwithdebinfo \ 12 | ZERO_CHECK.dir \ 13 | cmake_install.cmake \ 14 | CMakeCache.txt \ 15 | ; 16 | do 17 | rm -rf "${f}" 18 | done 19 | -------------------------------------------------------------------------------- /scripts/doautoreconf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export AUTOMAKE_SUFFIX=-1.17 4 | export AUTOCONF_SUFFIX=-2.72 5 | export LIBTOOL_SUFFIX=-2.5.3 6 | 7 | export ACLOCAL="aclocal${AUTOMAKE_SUFFIX}" 8 | export AUTOMAKE="automake${AUTOMAKE_SUFFIX}" 9 | 10 | export AUTOCONF="autoconf${AUTOCONF_SUFFIX}" 11 | export AUTOHEADER="autoheader${AUTOCONF_SUFFIX}" 12 | export AUTOM4TE="autom4te${AUTOCONF_SUFFIX}" 13 | export AUTORECONF="autoreconf${AUTOCONF_SUFFIX}" 14 | export AUTOSCAN="autoscan${AUTOCONF_SUFFIX}" 15 | export AUTOUPDATE="autoupdate${AUTOCONF_SUFFIX}" 16 | export IFNAMES="ifnames${AUTOCONF_SUFFIX}" 17 | export AUTOM4TE="autom4te${AUTOCONF_SUFFIX}" 18 | 19 | export LIBTOOLIZE="libtoolize${LIBTOOL_SUFFIX}" 20 | export LIBTOOL="libtool${LIBTOOL_SUFFIX}" 21 | 22 | export AUTOGEN=autogen 23 | 24 | (cd tests && $AUTOGEN ./Makefile.am.def) 25 | (cd include && $AUTOGEN ./Makefile.am.def) 26 | $AUTOGEN ./Makefile.am.def 27 | $LIBTOOLIZE -vcif 28 | $ACLOCAL -I m4 --install -Wall --force 29 | $AUTOMAKE -vcaf 30 | $AUTOCONF -I m4 -f -Wall 31 | $AUTOM4TE --language=Autotest -I tests tests/testsuite.at -o tests/testsuite 32 | -------------------------------------------------------------------------------- /scripts/fix-timestamps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | touch aclocal.m4 6 | find . -name 'Makefile.in' -print -exec touch '{}' ';' 7 | touch configure 8 | touch tests/testsuite 9 | -------------------------------------------------------------------------------- /scripts/msvc10_to_msvc11.cmd: -------------------------------------------------------------------------------- 1 | @echo on 2 | setlocal 3 | set "THIS_SCRIPT_FILE=%~nx0" 4 | 5 | if "%1" == "" ( 6 | echo. 7 | echo USAGE: %THIS_SCRIPT_FILE% log4cplus.sln 8 | echo. 9 | exit /b 1 10 | ) 11 | 12 | if not defined VS110COMNTOOLS ( 13 | echo. 14 | echo VS110COMNTOOLS environment variable is not defined 15 | echo. 16 | exit /b 2 17 | ) 18 | 19 | set "SLN_PATH=%~f1" 20 | set "SLN_BASE_DIR=%~dp1" 21 | set "SLN_FILE_NAME=%~nx1" 22 | set "MSVC11_BASE_DIR=%SLN_BASE_DIR%\..\msvc11" 23 | 24 | rmdir /S /Q "%MSVC11_BASE_DIR%" 25 | mkdir "%MSVC11_BASE_DIR%" 26 | xcopy /F /H /Y /Z /I "%SLN_BASE_DIR%\*.*" "%MSVC11_BASE_DIR%" 27 | xcopy /F /H /Y /Z /I "%SLN_BASE_DIR%\tests\*.*" "%MSVC11_BASE_DIR%\tests" 28 | 29 | call "%VS110COMNTOOLS%\..\IDE\devenv.com" "%MSVC11_BASE_DIR%\%SLN_FILE_NAME%" /Upgrade 30 | 31 | start "Migration log" "%MSVC11_BASE_DIR%\UpgradeLog.htm" 32 | 33 | endlocal 34 | 35 | -------------------------------------------------------------------------------- /scripts/msvc10_to_msvc12.cmd: -------------------------------------------------------------------------------- 1 | @echo on 2 | setlocal 3 | set "THIS_SCRIPT_FILE=%~nx0" 4 | 5 | if "%1" == "" ( 6 | echo. 7 | echo USAGE: %THIS_SCRIPT_FILE% log4cplus.sln 8 | echo. 9 | exit /b 1 10 | ) 11 | 12 | if not defined VS120COMNTOOLS ( 13 | echo. 14 | echo VS120COMNTOOLS environment variable is not defined 15 | echo. 16 | exit /b 2 17 | ) 18 | 19 | set "SLN_PATH=%~f1" 20 | set "SLN_BASE_DIR=%~dp1" 21 | set "SLN_FILE_NAME=%~nx1" 22 | set "MSVC12_BASE_DIR=%SLN_BASE_DIR%\..\msvc12" 23 | 24 | rmdir /S /Q "%MSVC12_BASE_DIR%" 25 | mkdir "%MSVC12_BASE_DIR%" 26 | xcopy /F /H /Y /Z /I "%SLN_BASE_DIR%\*.*" "%MSVC12_BASE_DIR%" 27 | xcopy /F /H /Y /Z /I "%SLN_BASE_DIR%\tests\*.*" "%MSVC12_BASE_DIR%\tests" 28 | 29 | call "%VS120COMNTOOLS%\..\IDE\devenv.com" "%MSVC12_BASE_DIR%\%SLN_FILE_NAME%" /Upgrade 30 | 31 | start "Migration log" "%MSVC12_BASE_DIR%\UpgradeLog.htm" 32 | 33 | endlocal 34 | 35 | -------------------------------------------------------------------------------- /scripts/update_copyrights.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | find_files() { 4 | find . \( \( \! -path './objdir*' \) \ 5 | \( -name '*.h' -o -name '*.hxx' -o -name '*.cxx' \) \) 6 | } 7 | 8 | find_files | while read file ; do 9 | echo "modifying file $file"; 10 | perl -wn -i.bak -e ' 11 | use strict; 12 | 13 | my $YEAR = 2017; 14 | 15 | my $sep = qr/[\s,;]/; 16 | if (/copyright/i) 17 | { 18 | print STDERR; 19 | } 20 | if (/(copyright $sep+ (?:\(c\) $sep+)? (?:\d{4})) (\s* - \s*) (\d{4})/ixgp) 21 | { 22 | #print STDERR "($1) ($2) ($3)\n"; 23 | #print STDERR "${^PREMATCH}$1$2$YEAR${^POSTMATCH}"; 24 | print "${^PREMATCH}$1$2$YEAR${^POSTMATCH}"; 25 | } 26 | elsif (/(copyright $sep+ (?:\(c\) $sep+)? (\d{4}))/ixgp) 27 | { 28 | #print STDERR "($1)\n"; 29 | #print STDERR "${^PREMATCH}$1-$YEAR${^POSTMATCH}"; 30 | print "${^PREMATCH}$1-$YEAR${^POSTMATCH}"; 31 | } 32 | else 33 | { 34 | print; 35 | } 36 | ' $file; 37 | done 38 | 39 | -------------------------------------------------------------------------------- /simpleserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message (STATUS "Threads: ${CMAKE_THREAD_LIBS_INIT}") 2 | set (loggingserver_sources loggingserver.cxx) 3 | 4 | message (STATUS "Sources: ${loggingserver_sources}") 5 | 6 | set (loggingserver loggingserver${log4cplus_postfix}) 7 | add_executable (${loggingserver} ${loggingserver_sources}) 8 | if (UNICODE) 9 | target_compile_definitions (${loggingserver} PUBLIC UNICODE) 10 | target_compile_definitions (${loggingserver} PUBLIC _UNICODE) 11 | add_definitions (-UMBCS -U_MBCS) 12 | endif (UNICODE) 13 | target_link_libraries (${loggingserver} ${log4cplus}) 14 | 15 | install(TARGETS ${loggingserver} DESTINATION ${CMAKE_INSTALL_BINDIR}) 16 | -------------------------------------------------------------------------------- /simpleserver/Makefile.am: -------------------------------------------------------------------------------- 1 | if MULTI_THREADED 2 | noinst_PROGRAMS += loggingserver 3 | loggingserver_sources = simpleserver/loggingserver.cxx 4 | loggingserver_SOURCES = $(loggingserver_sources) 5 | loggingserver_LDADD = $(liblog4cplus_la_file) 6 | 7 | if BUILD_WITH_WCHAR_T_SUPPORT 8 | noinst_PROGRAMS += loggingserverU 9 | loggingserverU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 10 | loggingserverU_SOURCES = $(loggingserver_sources) 11 | loggingserverU_LDADD = $(liblog4cplusU_la_file) 12 | endif 13 | 14 | endif 15 | -------------------------------------------------------------------------------- /src/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 2 | -------------------------------------------------------------------------------- /src/cygwin-win32.cxx: -------------------------------------------------------------------------------- 1 | // Module: Log4CPLUS 2 | // File: cygwin-win32.cxx 3 | // Created: 7/2011 4 | // Author: Vaclav Zeman 5 | // 6 | // Copyright (C) 2011-2017, Vaclav Zeman. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modifica- 9 | // tion, are permitted provided that the following conditions are met: 10 | // 11 | // 1. Redistributions of source code must retain the above copyright notice, 12 | // this list of conditions and the following disclaimer. 13 | // 14 | // 2. Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // 18 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 19 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 23 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | #if defined (__CYGWIN__) 30 | 31 | // Work around missing _X86_ symbol with Clang on Cygwin. 32 | #if ! defined (_X86_) && defined (__i386__) 33 | # define _X86_ 1 34 | #endif 35 | 36 | #include 37 | 38 | // This is intentionally included directly instead of through 39 | // windowsh-inc.h. 40 | #include 41 | 42 | 43 | namespace log4cplus { namespace cygwin { 44 | 45 | unsigned long 46 | get_current_win32_thread_id () 47 | { 48 | return GetCurrentThreadId (); 49 | } 50 | 51 | 52 | void 53 | output_debug_stringW (wchar_t const * str) 54 | { 55 | OutputDebugStringW (str); 56 | } 57 | 58 | } } // namespace log4cplus { namespace cygwin { 59 | 60 | #endif // defined (__CYGWIN__) 61 | -------------------------------------------------------------------------------- /src/exception.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace log4cplus { 4 | 5 | exception::exception (tstring const & message) 6 | : std::runtime_error (LOG4CPLUS_TSTRING_TO_STRING (message)) 7 | { } 8 | 9 | exception::exception (exception const &) = default; 10 | 11 | exception & exception::operator=(exception const &) = default; 12 | 13 | exception::~exception () 14 | { } 15 | 16 | } // namespace log4cplus -------------------------------------------------------------------------------- /src/log4cplus.rc.in: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef NDEBUG 4 | #define VER_DEBUG 0 5 | #else 6 | #define VER_DEBUG VS_FF_DEBUG 7 | #endif 8 | 9 | #if @log4cplus_build_shared@ 10 | #define VER_FILETYPE VFT_DLL 11 | #else 12 | #define VER_FILETYPE VFT_STATIC_LIB 13 | #endif 14 | 15 | #define VER_BINARY @log4cplus_version_major@,@log4cplus_version_minor@,@log4cplus_version_patch@,0 16 | #define VER_STR "@log4cplus_version_major@.@log4cplus_version_minor@.@log4cplus_version_patch@" 17 | 18 | VS_VERSION_INFO VERSIONINFO 19 | FILEVERSION VER_BINARY 20 | PRODUCTVERSION VER_BINARY 21 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 22 | FILEFLAGS VER_DEBUG 23 | FILEOS VOS_NT_WINDOWS32 24 | FILETYPE VER_FILETYPE 25 | FILESUBTYPE VFT2_UNKNOWN 26 | BEGIN 27 | BLOCK "StringFileInfo" 28 | BEGIN 29 | BLOCK "040904E4" 30 | BEGIN 31 | VALUE "CompanyName", "log4cplus" 32 | VALUE "FileDescription", "log4cplus logging library" 33 | VALUE "FileVersion", VER_STR 34 | VALUE "InternalName", "@log4cplus@" 35 | VALUE "ProductName", "@log4cplus@" 36 | VALUE "ProductVersion", VER_STR 37 | END 38 | END 39 | BLOCK "VarFileInfo" 40 | BEGIN 41 | VALUE "Translation", 0x0409, 1200 42 | END 43 | END 44 | -------------------------------------------------------------------------------- /src/nullappender.cxx: -------------------------------------------------------------------------------- 1 | // Module: Log4CPLUS 2 | // File: nullappender.cxx 3 | // Created: 6/2003 4 | // Author: Tad E. Smith 5 | // 6 | // 7 | // Copyright 2003-2017 Tad E. Smith 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace log4cplus 26 | { 27 | 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // NullAppender ctors and dtor 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | NullAppender::NullAppender() = default; 34 | 35 | 36 | NullAppender::NullAppender(const helpers::Properties& properties) 37 | : Appender(properties) 38 | { 39 | } 40 | 41 | 42 | 43 | NullAppender::~NullAppender() 44 | { 45 | destructorImpl(); 46 | } 47 | 48 | 49 | 50 | /////////////////////////////////////////////////////////////////////////////// 51 | // NullAppender public methods 52 | /////////////////////////////////////////////////////////////////////////////// 53 | 54 | void 55 | NullAppender::close() 56 | { 57 | } 58 | 59 | 60 | 61 | /////////////////////////////////////////////////////////////////////////////// 62 | // NullAppender protected methods 63 | /////////////////////////////////////////////////////////////////////////////// 64 | 65 | // This method does not need to be locked since it is called by 66 | // doAppend() which performs the locking 67 | void 68 | NullAppender::append(const spi::InternalLoggingEvent&) 69 | { 70 | } 71 | 72 | 73 | } // namespace log4cplus 74 | -------------------------------------------------------------------------------- /src/pointer.cxx: -------------------------------------------------------------------------------- 1 | // Module: Log4CPLUS 2 | // File: pointer.cxx 3 | // Created: 6/2001 4 | // Author: Tad E. Smith 5 | // 6 | // 7 | // Copyright 2001-2017 Tad E. Smith 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace log4cplus::helpers { 29 | 30 | 31 | /////////////////////////////////////////////////////////////////////////////// 32 | // log4cplus::helpers::SharedObject dtor 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | SharedObject::~SharedObject() 36 | { 37 | assert(count__ == 0); 38 | } 39 | 40 | 41 | 42 | /////////////////////////////////////////////////////////////////////////////// 43 | // log4cplus::helpers::SharedObject public methods 44 | /////////////////////////////////////////////////////////////////////////////// 45 | 46 | void 47 | SharedObject::addReference() const LOG4CPLUS_NOEXCEPT 48 | { 49 | #if defined (LOG4CPLUS_SINGLE_THREADED) 50 | ++count__; 51 | 52 | #else 53 | std::atomic_fetch_add_explicit (&count__, 1U, 54 | std::memory_order_relaxed); 55 | 56 | #endif 57 | } 58 | 59 | 60 | void 61 | SharedObject::removeReference() const 62 | { 63 | assert (count__ > 0); 64 | bool destroy; 65 | 66 | #if defined (LOG4CPLUS_SINGLE_THREADED) 67 | destroy = --count__ == 0; 68 | 69 | #else 70 | destroy = std::atomic_fetch_sub_explicit (&count__, 1U, 71 | std::memory_order_release) == 1; 72 | if (destroy) [[unlikely]] 73 | std::atomic_thread_fence (std::memory_order_acquire); 74 | 75 | #endif 76 | if (destroy) [[unlikely]] 77 | delete this; 78 | } 79 | 80 | 81 | } // namespace log4cplus::helpers 82 | -------------------------------------------------------------------------------- /src/rootlogger.cxx: -------------------------------------------------------------------------------- 1 | // Module: Log4CPLUS 2 | // File: rootlogger.cxx 3 | // Created: 4/2003 4 | // Author: Tad E. Smith 5 | // 6 | // 7 | // Copyright 2003-2017 Tad E. Smith 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | namespace log4cplus::spi { 27 | 28 | 29 | ////////////////////////////////////////////////////////////////////////////// 30 | // RootLogger Constructor 31 | ////////////////////////////////////////////////////////////////////////////// 32 | 33 | RootLogger::RootLogger(Hierarchy& h, LogLevel loglevel) 34 | : LoggerImpl(LOG4CPLUS_TEXT("root"), h) 35 | { 36 | setLogLevel(loglevel); 37 | } 38 | 39 | 40 | 41 | ////////////////////////////////////////////////////////////////////////////// 42 | // Logger Methods 43 | ////////////////////////////////////////////////////////////////////////////// 44 | 45 | LogLevel 46 | RootLogger::getChainedLogLevel() const 47 | { 48 | return ll; 49 | } 50 | 51 | 52 | void 53 | RootLogger::setLogLevel(LogLevel loglevel) 54 | { 55 | if(loglevel == NOT_SET_LOG_LEVEL) { 56 | helpers::getLogLog().error( 57 | LOG4CPLUS_TEXT("You have tried to set NOT_SET_LOG_LEVEL to root.")); 58 | } 59 | else { 60 | LoggerImpl::setLogLevel(loglevel); 61 | } 62 | } 63 | 64 | 65 | } // namespace log4cplus::spi 66 | -------------------------------------------------------------------------------- /src/syncprims.cxx: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009-2017, Vaclav Haisman. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without modifica- 4 | // tion, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, 7 | // this list of conditions and the following disclaimer. 8 | // 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, 10 | // this list of conditions and the following disclaimer in the documentation 11 | // and/or other materials provided with the distribution. 12 | // 13 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 14 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 16 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 18 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 19 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #include 25 | #define LOG4CPLUS_ENABLE_SYNCPRIMS_PUB_IMPL 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | namespace log4cplus::thread::impl 32 | { 33 | 34 | 35 | LOG4CPLUS_EXPORT 36 | void 37 | syncprims_throw_exception (char const * const msg, char const * const file, 38 | int line) 39 | { 40 | log4cplus::tostringstream oss; 41 | oss << LOG4CPLUS_C_STR_TO_TSTRING (file) << LOG4CPLUS_TEXT (":") << line 42 | << LOG4CPLUS_TEXT (": ") << LOG4CPLUS_C_STR_TO_TSTRING (msg); 43 | throw log4cplus::exception (oss.str ()); 44 | } 45 | 46 | 47 | } // namespace log4cplus::thread::impl 48 | -------------------------------------------------------------------------------- /src/tls.cxx: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without modifica- 4 | // tion, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, 7 | // this list of conditions and the following disclaimer. 8 | // 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, 10 | // this list of conditions and the following disclaimer in the documentation 11 | // and/or other materials provided with the distribution. 12 | // 13 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 14 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 16 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 18 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 19 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #include 25 | 26 | 27 | namespace log4cplus::thread::impl { 28 | 29 | 30 | #if defined (LOG4CPLUS_SINGLE_THREADED) 31 | 32 | //! This is intentionally allocated using freestore and leaked. The 33 | //! amount is small (so far only 1 length vector). This is to avoid 34 | //! initialization order fiasco. 35 | std::vector * tls_single_threaded_values; 36 | 37 | #endif 38 | 39 | 40 | } // namespace log4cplus::thread::impl 41 | -------------------------------------------------------------------------------- /src/version.cxx: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010-2017, Vaclav Haisman. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without modifica- 4 | // tion, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, 7 | // this list of conditions and the following disclaimer. 8 | // 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, 10 | // this list of conditions and the following disclaimer in the documentation 11 | // and/or other materials provided with the distribution. 12 | // 13 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 14 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 15 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 16 | // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- 18 | // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 19 | // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | #include 25 | 26 | 27 | namespace log4cplus 28 | { 29 | 30 | #if ! defined (LOG4CPLUS_VERSION_STR_SUFFIX) 31 | #define LOG4CPLUS_VERSION_STR_SUFFIX "" 32 | #endif 33 | 34 | unsigned const version = LOG4CPLUS_VERSION; 35 | char const versionStr[] = LOG4CPLUS_VERSION_STR LOG4CPLUS_VERSION_STR_SUFFIX; 36 | 37 | } // namespace log4cplus 38 | -------------------------------------------------------------------------------- /swig/Makefile.common.am: -------------------------------------------------------------------------------- 1 | if WITH_SWIG 2 | SWIG_SOURCES = \ 3 | %D%/configurator.swg \ 4 | %D%/hierarchy.swg \ 5 | %D%/log4cplus.swg \ 6 | %D%/logger.swg \ 7 | %D%/loggingevent.swg 8 | 9 | %D%/log4cplus.swg: %D%/configurator.swg \ 10 | %D%/hierarchy.swg \ 11 | %D%/logger.swg \ 12 | %D%/loggingevent.swg 13 | 14 | endif 15 | -------------------------------------------------------------------------------- /swig/configurator.swg: -------------------------------------------------------------------------------- 1 | #ifndef LOG4CPLUS_CONFIGURATOR_SWG 2 | #define LOG4CPLUS_CONFIGURATOR_SWG 3 | 4 | %{ 5 | 6 | #include "log4cplus/configurator.h" 7 | 8 | %} 9 | 10 | %include "hierarchy.swg" 11 | 12 | namespace log4cplus { 13 | 14 | /* class PropertyConfigurator 15 | { 16 | public: 17 | enum PCFLags 18 | { 19 | fRecursiveExpansion 20 | , fShadowEnvironment 21 | , fAllowEmptyVars 22 | , fUnspecEncoding 23 | #if defined (LOG4CPLUS_HAVE_CODECVT_UTF8_FACET) && defined (UNICODE) 24 | , fUTF8 25 | #endif 26 | #if (defined (LOG4CPLUS_HAVE_CODECVT_UTF16_FACET) || defined (_WIN32)) \ 27 | && defined (UNICODE) 28 | , fUTF16 29 | #endif 30 | #if defined (LOG4CPLUS_HAVE_CODECVT_UTF32_FACET) && defined (UNICODE) 31 | , fUTF32 32 | #endif 33 | }; 34 | 35 | PropertyConfigurator (log4cplus::tstring const & propertyFile, 36 | Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0 37 | }; */ 38 | 39 | class BasicConfigurator 40 | { 41 | public: 42 | BasicConfigurator (Hierarchy & h 43 | = log4cplus::Logger::getDefaultHierarchy (), bool logToStdErr = false); 44 | virtual ~BasicConfigurator (); 45 | 46 | static void doConfigure(log4cplus::Hierarchy & h 47 | = log4cplus::Logger::getDefaultHierarchy (), 48 | bool logToStdErr = false); 49 | }; 50 | 51 | } // namespace log4cplus 52 | 53 | #endif // LOG4CPLUS_CONFIGURATOR_SWG 54 | 55 | -------------------------------------------------------------------------------- /swig/hierarchy.swg: -------------------------------------------------------------------------------- 1 | #ifndef LOG4CPLUS_HIERARCHY_SWG 2 | #define LOG4CPLUS_HIERARCHY_SWG 3 | 4 | %{ 5 | 6 | #include "log4cplus/hierarchy.h" 7 | 8 | %} 9 | 10 | namespace log4cplus { 11 | 12 | class Hierarchy; 13 | 14 | } // namespace log4cplus 15 | 16 | #endif // LOG4CPLUS_HIERARCHY_SWG 17 | 18 | -------------------------------------------------------------------------------- /swig/log4cplus.swg: -------------------------------------------------------------------------------- 1 | #ifndef LOG4CPLUS_LOG4CPLUS_SWG 2 | #define LOG4CPLUS_LOG4CPLUS_SWG 3 | 4 | %module log4cplus 5 | 6 | %include "std_basic_string.i" 7 | #ifdef SWIGPYTHON 8 | %include "std_string.i" 9 | #ifdef UNICODE 10 | %include "std_wstring.i" 11 | #endif 12 | #endif 13 | 14 | %{ 15 | #include "log4cplus/tchar.h" 16 | #include "log4cplus/tstring.h" 17 | %} 18 | 19 | namespace log4cplus 20 | { 21 | 22 | #ifdef UNICODE 23 | typedef wchar_t tchar; 24 | #else 25 | typedef char tchar; 26 | #endif 27 | 28 | typedef std::basic_string tstring; 29 | 30 | typedef int LogLevel; 31 | 32 | } // namespace log4cplus 33 | 34 | %include "hierarchy.swg" 35 | %include "loggingevent.swg" 36 | %include "logger.swg" 37 | %include "configurator.swg" 38 | 39 | #endif // LOG4CPLUS_LOG4CPLUS_SWG 40 | 41 | -------------------------------------------------------------------------------- /swig/logger.swg: -------------------------------------------------------------------------------- 1 | #ifndef LOG4CPLUS_LOGGER_SWG 2 | #define LOG4CPLUS_LOGGER_SWG 3 | 4 | %module log4cplus 5 | 6 | %{ 7 | 8 | #include "log4cplus/logger.h" 9 | 10 | %} 11 | 12 | %include "hierarchy.swg" 13 | 14 | 15 | namespace log4cplus 16 | { 17 | 18 | %rename(assign) Logger::operator =; 19 | 20 | class Logger 21 | { 22 | public: 23 | Logger (); 24 | Logger (Logger const & other); 25 | Logger & operator = (Logger const & other); 26 | virtual ~Logger (); 27 | 28 | void swap (Logger & other); 29 | Logger getParent () const; 30 | 31 | void assertion (bool assertionVal, log4cplus::tstring const & message) const; 32 | bool isEnabledFor (LogLevel ll) const; 33 | void log (LogLevel ll, log4cplus::tstring const & message, 34 | char const * file = NULL, int line = -1, char const * function = NULL) 35 | const; 36 | void log (spi::InternalLoggingEvent const & event) const; 37 | void forcedLog (LogLevel ll, log4cplus::tstring const & message, 38 | char const * file = NULL, int line = -1, char const * function = NULL) 39 | const; 40 | void forcedLog (spi::InternalLoggingEvent const & event) const; 41 | LogLevel getChainedLogLevel () const; 42 | LogLevel getLogLevel () const; 43 | void setLogLevel (LogLevel ll); 44 | log4cplus::tstring const & getName () const; 45 | bool getAdditivity () const; 46 | void setAdditivity (bool additive); 47 | 48 | static Hierarchy & getDefaultHierarchy (); 49 | static bool exists (log4cplus::tstring const & loggerName); 50 | static Logger getInstance (log4cplus::tstring const & loggerName); 51 | static Logger getRoot (); 52 | }; 53 | 54 | } // namespace Logger 55 | 56 | #endif // LOG4CPLUS_LOGGER_SWG 57 | 58 | -------------------------------------------------------------------------------- /swig/loggingevent.swg: -------------------------------------------------------------------------------- 1 | #ifndef LOG4CPLUS_LOGGINGEVENT_SWG 2 | #define LOG4CPLUS_LOGGINGEVENT_SWG 3 | 4 | %{ 5 | 6 | #include "log4cplus/spi/loggingevent.h" 7 | 8 | %} 9 | 10 | namespace log4cplus { namespace spi { 11 | 12 | %rename(assign) InternalLoggingEvent::operator =; 13 | 14 | class InternalLoggingEvent 15 | { 16 | public: 17 | InternalLoggingEvent (); 18 | InternalLoggingEvent (log4cplus::tstring const & logger, 19 | log4cplus::LogLevel ll, log4cplus::tstring const & message, 20 | char const * filename, int line, char const * function); 21 | InternalLoggingEvent (InternalLoggingEvent const & other); 22 | virtual ~InternalLoggingEvent (); 23 | 24 | InternalLoggingEvent & operator = (InternalLoggingEvent const & other); 25 | 26 | void swap (InternalLoggingEvent & other); 27 | 28 | void setLoggingEvent (log4cplus::tstring const & logger, 29 | log4cplus::LogLevel ll, log4cplus::tstring const & message, 30 | char const * filename, int line, char const * function); 31 | 32 | void setFunction (char const * func); 33 | void setFunction (log4cplus::tstring const & func); 34 | 35 | virtual log4cplus::tstring const & getMessage () const; 36 | log4cplus::tstring const & getLoggerName () const; 37 | log4cplus::LogLevel getLogLevel () const; 38 | log4cplus::tstring const & getFile () const; 39 | int getLine () const; 40 | 41 | }; 42 | 43 | } } // namespace log4cplus { namespace spi { 44 | 45 | #endif // LOG4CPLUS_LOGGINGEVENT_SWG 46 | 47 | -------------------------------------------------------------------------------- /swig/python/Makefile.am: -------------------------------------------------------------------------------- 1 | if WITH_PYTHON 2 | PYTHON_WRAP_CXX = python_wrap.cxx 3 | BUILT_SOURCES = $(PYTHON_WRAP_CXX) 4 | 5 | pkgpython_PYTHON = log4cplus.py 6 | pkgpyexec_LTLIBRARIES = _log4cplus.la 7 | _log4cplus_la_SOURCES = $(PYTHON_WRAP_CXX) $(SWIG_SOURCES) 8 | _log4cplus_la_CPPFLAGS = $(AM_CPPFLAGS) $(SWIG_PYTHON_CPPFLAGS) \ 9 | $(PYTHON_CPPFLAGS) -DSWIG_TYPE_TABLE=log4cplus \ 10 | "-Dregister=/*register*/" \ 11 | "-DPyUnicode_GetSize(X)=PyUnicode_GetLength(X)" 12 | _log4cplus_la_LDFLAGS = -no-undefined -shared -module -avoid-version \ 13 | $(PYTHON_LDFLAGS) $(AM_LDFLAGS) 14 | _log4cplus_la_LIBADD = $(liblog4cplus_la_file) 15 | 16 | $(PYTHON_WRAP_CXX): $(SWIG_SOURCES) 17 | $(SWIG) $(SWIG_FLAGS) -c++ -python $(SWIG_PYTHON_OPT) \ 18 | -I$(top_srcdir)/include -I$(top_builddir)/include \ 19 | -I$(top_srcdir)/swig -o $(PYTHON_WRAP_CXX) \ 20 | $(top_srcdir)/swig/log4cplus.swg 21 | 22 | if BUILD_WITH_WCHAR_T_SUPPORT 23 | PYTHON_WRAPU_CXX = python_wrapU.cxx 24 | BUILT_SOURCES += $(PYTHON_WRAPU_CXX) 25 | 26 | pkgpython_PYTHON += log4cplusU.py 27 | pkgpyexec_LTLIBRARIES += _log4cplusU.la 28 | _log4cplusU_la_SOURCES = $(PYTHON_WRAPU_CXX) $(SWIG_SOURCES) 29 | _log4cplusU_la_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 \ 30 | $(SWIG_PYTHON_CPPFLAGS) $(PYTHON_CPPFLAGS) -DSWIG_TYPE_TABLE=log4cplus \ 31 | "-Dregister=/*register*/" \ 32 | "-DPyUnicode_GetSize(X)=PyUnicode_GetLength(X)" 33 | _log4cplusU_la_LDFLAGS = -no-undefined -shared -module -avoid-version \ 34 | $(PYTHON_LDFLAGS) $(AM_LDFLAGS) 35 | _log4cplusU_la_LIBADD = $(liblog4cplusU_la_file) 36 | 37 | $(PYTHON_WRAPU_CXX): $(SWIG_SOURCES) 38 | $(SWIG) -DUNICODE=1 -D_UNICODE=1 $(SWIG_FLAGS) -c++ -python $(SWIG_PYTHON_OPT) \ 39 | -I$(top_srcdir)/include -I$(top_builddir)/include \ 40 | -I$(top_srcdir)/swig -o $(PYTHON_WRAPU_CXX) \ 41 | $(top_srcdir)/swig/log4cplus.swg 42 | endif 43 | 44 | endif 45 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (UNICODE) 2 | add_compile_definitions (UNICODE _UNICODE) 3 | add_definitions (-UMBCS -U_MBCS) 4 | endif (UNICODE) 5 | 6 | if (${BUILD_SHARED_LIBS}) 7 | add_compile_definitions (log4cplus_EXPORTS) 8 | endif () 9 | 10 | # A function to set up a test, since it's the same for each one. Note: 11 | # unit_tests test is not set up using this function because it does not like 12 | # the additional argument on commmand line and consequently does not run any 13 | # test. 14 | function(log4cplus_add_test _name) 15 | set(_srcs ${ARGN}) 16 | # message (STATUS "${_name} sources: ${_srcs}") 17 | add_executable (${_name} ${_srcs}) 18 | target_link_libraries (${_name} ${log4cplus}) 19 | get_filename_component (_log4cplus_properties "log4cplus.properties.in" 20 | ABSOLUTE) 21 | add_test(NAME ${_name} 22 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 23 | COMMAND ${_name} ${_log4cplus_properties}) 24 | endfunction() 25 | 26 | 27 | add_subdirectory (appender_test) 28 | add_subdirectory (configandwatch_test) 29 | add_subdirectory (customloglevel_test) 30 | add_subdirectory (fileappender_test) 31 | add_subdirectory (filter_test) 32 | add_subdirectory (hierarchy_test) 33 | add_subdirectory (loglog_test) 34 | add_subdirectory (ndc_test) 35 | add_subdirectory (ostream_test) 36 | add_subdirectory (patternlayout_test) 37 | add_subdirectory (performance_test) 38 | add_subdirectory (priority_test) 39 | add_subdirectory (propertyconfig_test) 40 | #add_subdirectory (socket_test) # I don't know how this test is supposed to be executed 41 | add_subdirectory (thread_test) 42 | add_subdirectory (timeformat_test) 43 | if (WITH_UNIT_TESTS) 44 | add_subdirectory (unit_tests) 45 | endif (WITH_UNIT_TESTS) 46 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | TESTSUITE = %D%/testsuite 4 | AUTOTEST = $(AUTOM4TE) --language=Autotest 5 | TESTSUITE_AT = \ 6 | %D%/appender_test.at \ 7 | %D%/configandwatch_test.at \ 8 | %D%/customloglevel_test.at \ 9 | %D%/fileappender_test.at \ 10 | %D%/filter_test.at \ 11 | %D%/headers.at \ 12 | %D%/hierarchy_test.at \ 13 | %D%/local.at \ 14 | %D%/loglog_test.at \ 15 | %D%/ndc_test.at \ 16 | %D%/ostream_test.at \ 17 | %D%/patternlayout_test.at \ 18 | %D%/performance_test.at \ 19 | %D%/priority_test.at \ 20 | %D%/propertyconfig_test.at \ 21 | %D%/testsuite.at \ 22 | %D%/thread_test.at \ 23 | %D%/timeformat_test.at \ 24 | %D%/unit_tests.at 25 | 26 | 27 | all: $(TESTSUITE) 28 | 29 | $(TESTSUITE): $(TESTSUITE_AT) %D%/atlocal.in 30 | cd "$(abs_top_srcdir)" && $(AUTOTEST) -I tests %D%/testsuite.at -o $@ 31 | 32 | %D%/atconfig: $(top_builddir)/config.status 33 | cd "$(top_builddir)" && ./config.status $@ 34 | 35 | check-local: %D%/atconfig %D%/atlocal $(TESTSUITE) 36 | cd "$(top_builddir)/tests" && $(SHELL) "$(abs_top_srcdir)/$(TESTSUITE)" $(TESTSUITEFLAGS) 37 | 38 | clean-local: 39 | cd "$(top_builddir)/tests" && (test ! -f "$(abs_top_srcdir)/$(TESTSUITE)" || $(SHELL) "$(abs_top_srcdir)/$(TESTSUITE)" --clean) 40 | 41 | EXTRA_DIST += %D%/testsuite.at $(TESTSUITE) %D%/atlocal.in 42 | 43 | -------------------------------------------------------------------------------- /tests/Makefile.am.def: -------------------------------------------------------------------------------- 1 | AutoGen definitions Makefile.am.tpl; 2 | 3 | tests = { name = appender_test; }; 4 | tests = { 5 | name = configandwatch_test; 6 | need_threads = 1; }; 7 | tests = { name = customloglevel_test; }; 8 | tests = { name = fileappender_test; }; 9 | tests = { name = filter_test; }; 10 | tests = { name = hierarchy_test; }; 11 | tests = { name = loglog_test; }; 12 | tests = { name = ndc_test; }; 13 | tests = { name = ostream_test; }; 14 | tests = { name = patternlayout_test; }; 15 | tests = { name = performance_test; }; 16 | tests = { name = priority_test; }; 17 | tests = { name = propertyconfig_test; }; 18 | tests = { name = socket_test; }; 19 | tests = { 20 | name = thread_test; 21 | need_threads = 1; }; 22 | tests = { name = timeformat_test; }; 23 | tests = { name = unit_tests; }; -------------------------------------------------------------------------------- /tests/appender_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([appender_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/appender_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/appender_test" 2>&1], [0], [expout]) 6 | 7 | ATX_WCHAR_T_TEST([ 8 | AT_CHECK(["${abs_top_builddir}/appender_testU" 2>&1], [0], [expout])]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/appender_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(appender_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/appender_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += appender_test 4 | 5 | appender_test_sources = \ 6 | %D%/main.cxx 7 | 8 | appender_test_SOURCES = $(appender_test_sources) 9 | 10 | appender_test_LDADD = $(liblog4cplus_la_file) 11 | appender_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += appender_testU 15 | appender_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | appender_testU_SOURCES = $(appender_test_sources) 17 | appender_testU_LDADD = $(liblog4cplusU_la_file) 18 | appender_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/appender_test/expout: -------------------------------------------------------------------------------- 1 | log4cplus:WARN You have tried to set a null error-handler. 2 | log4cplus:WARN Tried to add NULL appender 3 | List size: 2 4 | Loop Body: Appender name = First 5 | Loop Body: Appender name = Second 6 | List size: 1 7 | Loop Body: Appender name = First 8 | log4cplus:WARN Tried to remove NULL appender 9 | List size: 0 10 | Should be First: First 11 | Should be Second: Second 12 | 13 | DEBUG - This is a test... 14 | DEBUG - This is a test... 15 | log4cplus: Entering ConsoleAppender::close().. 16 | log4cplus:ERROR Attempted to append to closed appender named [Second]. 17 | log4cplus:ERROR Cannot find LayoutFactory: "log4cplus::WrongLayout" 18 | Got expected exception: Cannot find LayoutFactory: "log4cplus::WrongLayout" 19 | log4cplus: Entering ConsoleAppender::close().. 20 | log4cplus: Destroying appender named [Fourth]. 21 | log4cplus:ERROR Unrecognized log level: WRONG 22 | log4cplus: Entering ConsoleAppender::close().. 23 | log4cplus: Destroying appender named [Fifth]. 24 | log4cplus:ERROR Appender::ctor()- Cannot find FilterFactory: log4cplus::spi::WrongFilter 25 | Got expected exception: Appender::ctor()- Cannot find FilterFactory: log4cplus::spi::WrongFilter 26 | log4cplus: Destroying appender named [Seventh]. 27 | log4cplus:ERROR Derived Appender did not call destructorImpl(). 28 | log4cplus: Destroying appender named [Second]. 29 | log4cplus: Entering ConsoleAppender::close().. 30 | log4cplus: Destroying appender named [First]. 31 | Exiting main()... 32 | -------------------------------------------------------------------------------- /tests/atlocal.in: -------------------------------------------------------------------------------- 1 | CPPFLAGS="-I$abs_top_builddir/include -I$abs_top_srcdir/include @CPPFLAGS@" 2 | 3 | : ${CC='@CC@'} 4 | : ${CXX='@CXX@'} 5 | : ${CXXFLAGS='@CXXFLAGS@'} 6 | : ${GREP='@GREP@'} 7 | : ${AWK='@AWK@'} 8 | : ${SED='@SED@'} 9 | : ${ENABLE_THREADS='@ENABLE_THREADS@'} 10 | : ${BUILD_WITH_WCHAR_T_SUPPORT='@BUILD_WITH_WCHAR_T_SUPPORT@'} 11 | -------------------------------------------------------------------------------- /tests/configandwatch_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([configandwatch_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_SKIP_IF([test "x$ENABLE_THREADS" != "xyes"]) 5 | AT_CHECK([cp -f "${abs_builddir}/configandwatch_test/log4cplus.properties" .]) 6 | AT_CHECK(["${abs_top_builddir}/configandwatch_test"], [0], [ignore], [stderr]) 7 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 8 | 9 | ATX_WCHAR_T_TEST([ 10 | AT_CHECK(["${abs_top_builddir}/configandwatch_testU"], [0], [ignore], [stderr]) 11 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 12 | ]) 13 | 14 | AT_CLEANUP 15 | -------------------------------------------------------------------------------- /tests/configandwatch_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(configandwatch_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/configandwatch_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | if MULTI_THREADED 4 | noinst_PROGRAMS += configandwatch_test 5 | 6 | configandwatch_test_sources = \ 7 | %D%/main.cxx 8 | 9 | configandwatch_test_SOURCES = $(configandwatch_test_sources) 10 | 11 | configandwatch_test_LDADD = $(liblog4cplus_la_file) 12 | configandwatch_test_LDFLAGS = -no-install 13 | 14 | if BUILD_WITH_WCHAR_T_SUPPORT 15 | noinst_PROGRAMS += configandwatch_testU 16 | configandwatch_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 17 | configandwatch_testU_SOURCES = $(configandwatch_test_sources) 18 | configandwatch_testU_LDADD = $(liblog4cplusU_la_file) 19 | configandwatch_testU_LDFLAGS = -no-install 20 | endif 21 | 22 | endif 23 | -------------------------------------------------------------------------------- /tests/configandwatch_test/log4cplus.properties.1: -------------------------------------------------------------------------------- 1 | 2 | log4cplus.rootLogger=INFO, STDOUT, R 3 | log4cplus.logger.test=WARN 4 | log4cplus.logger.test.log_1=FATAL 5 | log4cplus.logger.test.log_2=FATAL 6 | log4cplus.logger.test.log_3=WARN 7 | 8 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 9 | log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout 10 | log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n 11 | 12 | log4cplus.appender.R=log4cplus::RollingFileAppender 13 | log4cplus.appender.R.File=output.log 14 | #log4cplus.appender.R.MaxFileSize=5MB 15 | log4cplus.appender.R.MaxFileSize=500KB 16 | log4cplus.appender.R.MaxBackupIndex=5 17 | log4cplus.appender.R.layout=log4cplus::TTCCLayout 18 | -------------------------------------------------------------------------------- /tests/configandwatch_test/log4cplus.properties.2: -------------------------------------------------------------------------------- 1 | 2 | log4cplus.rootLogger=INFO, STDOUT, R 3 | log4cplus.logger.test=WARN 4 | log4cplus.logger.test.log_1=FATAL 5 | log4cplus.logger.test.log_2=FATAL 6 | log4cplus.logger.test.log_3=WARN, R3 7 | 8 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 9 | log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout 10 | log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n 11 | 12 | log4cplus.appender.R=log4cplus::RollingFileAppender 13 | log4cplus.appender.R.File=output.log 14 | #log4cplus.appender.R.MaxFileSize=5MB 15 | log4cplus.appender.R.MaxFileSize=500KB 16 | log4cplus.appender.R.MaxBackupIndex=5 17 | log4cplus.appender.R.layout=log4cplus::TTCCLayout 18 | 19 | log4cplus.appender.R3=log4cplus::RollingFileAppender 20 | log4cplus.appender.R3.File=log_3.log 21 | log4cplus.appender.R3.MaxFileSize=500KB 22 | log4cplus.appender.R3.MaxBackupIndex=5 23 | log4cplus.appender.R3.layout=log4cplus::TTCCLayout 24 | -------------------------------------------------------------------------------- /tests/configandwatch_test/log4cplus.properties.in: -------------------------------------------------------------------------------- 1 | 2 | log4cplus.rootLogger=INFO, STDOUT, R 3 | log4cplus.logger.test=WARN 4 | log4cplus.logger.test.log_1=FATAL 5 | log4cplus.logger.test.log_2=FATAL 6 | log4cplus.logger.test.log_3=WARN, R3 7 | 8 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 9 | log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout 10 | log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n 11 | 12 | log4cplus.appender.R=log4cplus::RollingFileAppender 13 | log4cplus.appender.R.File=output.log 14 | #log4cplus.appender.R.MaxFileSize=5MB 15 | log4cplus.appender.R.MaxFileSize=500KB 16 | log4cplus.appender.R.MaxBackupIndex=5 17 | log4cplus.appender.R.layout=log4cplus::TTCCLayout 18 | 19 | log4cplus.appender.R3=log4cplus::RollingFileAppender 20 | log4cplus.appender.R3.File=log_3.log 21 | log4cplus.appender.R3.MaxFileSize=500KB 22 | log4cplus.appender.R3.MaxBackupIndex=5 23 | #log4cplus.appender.R3.layout=log4cplus::TTCCLayout 24 | log4cplus.appender.R3.layout=log4cplus::PatternLayout 25 | log4cplus.appender.R3.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S,%Q} [%t] %-5p %c{2} - %m%n 26 | -------------------------------------------------------------------------------- /tests/configandwatch_test/main.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | using namespace log4cplus; 12 | using namespace log4cplus::helpers; 13 | 14 | 15 | Logger log_1; 16 | Logger log_2; 17 | Logger log_3; 18 | 19 | 20 | void 21 | printMsgs(Logger& logger) 22 | { 23 | LOG4CPLUS_TRACE_METHOD(logger, LOG4CPLUS_TEXT("printMsgs()")); 24 | LOG4CPLUS_DEBUG(logger, "printMsgs()"); 25 | LOG4CPLUS_INFO(logger, "printMsgs()"); 26 | LOG4CPLUS_WARN(logger, "printMsgs()"); 27 | LOG4CPLUS_ERROR(logger, "printMsgs()"); 28 | } 29 | 30 | 31 | log4cplus::tstring 32 | getPropertiesFileArgument (int argc, char * argv[]) 33 | { 34 | if (argc >= 2) 35 | { 36 | char const * arg = argv[1]; 37 | log4cplus::tstring file = LOG4CPLUS_C_STR_TO_TSTRING (arg); 38 | log4cplus::helpers::FileInfo fi; 39 | if (getFileInfo (&fi, file) == 0) 40 | return file; 41 | } 42 | 43 | return LOG4CPLUS_TEXT ("log4cplus.properties"); 44 | } 45 | 46 | 47 | int 48 | main(int argc, char * argv[]) 49 | { 50 | tcout << LOG4CPLUS_TEXT("Entering main()...") << endl; 51 | log4cplus::Initializer initializer; 52 | 53 | log_1 = Logger::getInstance(LOG4CPLUS_TEXT("test.log_1")); 54 | log_2 = Logger::getInstance(LOG4CPLUS_TEXT("test.log_2")); 55 | log_3 = Logger::getInstance(LOG4CPLUS_TEXT("test.log_3")); 56 | 57 | LogLog::getLogLog()->setInternalDebugging(true); 58 | Logger root = Logger::getRoot(); 59 | try 60 | { 61 | ConfigureAndWatchThread configureThread( 62 | getPropertiesFileArgument (argc, argv), 5 * 1000); 63 | 64 | LOG4CPLUS_WARN(root, "Testing...."); 65 | 66 | for(int i=0; i<4; ++i) { 67 | printMsgs(log_1); 68 | printMsgs(log_2); 69 | printMsgs(log_3); 70 | std::this_thread::sleep_for (std::chrono::seconds (1)); 71 | } 72 | } 73 | catch(...) { 74 | tcout << LOG4CPLUS_TEXT("Exception...") << endl; 75 | LOG4CPLUS_FATAL(root, "Exception occurred..."); 76 | } 77 | 78 | tcout << LOG4CPLUS_TEXT("Exiting main()...") << endl; 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /tests/configure.m4: -------------------------------------------------------------------------------- 1 | AC_CONFIG_FILES([ 2 | tests/configandwatch_test/log4cplus.properties 3 | tests/filter_test/log4cplus.properties 4 | tests/performance_test/log4cplus.properties 5 | tests/propertyconfig_test/log4cplus.properties 6 | tests/propertyconfig_test/log4cplus.tail.properties]) 7 | -------------------------------------------------------------------------------- /tests/customloglevel_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([customloglevel_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/customloglevel_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/customloglevel_test"], [0], [expout], [ignore]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/customloglevel_testU"], [0], [expout], 8 | [ignore]) 9 | ]) 10 | 11 | AT_CLEANUP 12 | -------------------------------------------------------------------------------- /tests/customloglevel_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(customloglevel_test main.cxx func.cxx) 2 | -------------------------------------------------------------------------------- /tests/customloglevel_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += customloglevel_test 4 | 5 | customloglevel_test_sources = \ 6 | %D%/func.cxx \ 7 | %D%/main.cxx 8 | 9 | customloglevel_test_SOURCES = $(customloglevel_test_sources) 10 | 11 | customloglevel_test_LDADD = $(liblog4cplus_la_file) 12 | customloglevel_test_LDFLAGS = -no-install 13 | 14 | if BUILD_WITH_WCHAR_T_SUPPORT 15 | noinst_PROGRAMS += customloglevel_testU 16 | customloglevel_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 17 | customloglevel_testU_SOURCES = $(customloglevel_test_sources) 18 | customloglevel_testU_LDADD = $(liblog4cplusU_la_file) 19 | customloglevel_testU_LDFLAGS = -no-install 20 | endif 21 | -------------------------------------------------------------------------------- /tests/customloglevel_test/customloglevel.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | #ifndef CUSTOMLOGLEVEL_HEADER 3 | #define CUSTOMLOGLEVEL_HEADER 4 | 5 | #include 6 | #include 7 | 8 | const log4cplus::LogLevel CRITICAL_LOG_LEVEL = 45000; 9 | 10 | #define LOG4CPLUS_CRITICAL(logger, logEvent) \ 11 | if(logger.isEnabledFor(CRITICAL_LOG_LEVEL)) { \ 12 | log4cplus::tostringstream _log4cplus_buf; \ 13 | _log4cplus_buf << logEvent; \ 14 | logger.forcedLog(CRITICAL_LOG_LEVEL, _log4cplus_buf.str(), __FILE__, __LINE__); \ 15 | } 16 | 17 | #endif // CUSTOMLOGLEVEL_HEADER 18 | -------------------------------------------------------------------------------- /tests/customloglevel_test/expout: -------------------------------------------------------------------------------- 1 | Entering main()... 2 | Getting root logger...DONE 3 | FATAL - root: DEBUG 4 | FATAL - test: DEBUG 5 | FATAL - test.subtest: DEBUG 6 | FATAL - Setting test.subtest to WARN 7 | FATAL - root: DEBUG 8 | FATAL - test: DEBUG 9 | FATAL - test.subtest: WARN 10 | FATAL - Setting test to CRITICAL 11 | FATAL - root: DEBUG 12 | FATAL - test: CRITICAL 13 | FATAL - test.subtest: WARN 14 | FATAL - Setting test.subtest to NOT_SET_LOG_LEVEL 15 | FATAL - root: DEBUG 16 | FATAL - test: CRITICAL 17 | FATAL - test.subtest: CRITICAL 18 | FATAL - Entering writeLogMessage()... 19 | CRITICAL - writeLogMessage()- This is a message from a different file 20 | FATAL - Exiting writeLogMessage()... 21 | Returned from writeLogMessage()... 22 | REALLY exiting main()... 23 | -------------------------------------------------------------------------------- /tests/customloglevel_test/func.cxx: -------------------------------------------------------------------------------- 1 | #include "customloglevel.h" 2 | #include 3 | #include 4 | 5 | 6 | void 7 | writeLogMessage() 8 | { 9 | { 10 | log4cplus::Logger subTest = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("test.subtest")); 11 | subTest.log(log4cplus::FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Entering writeLogMessage()...")); 12 | LOG4CPLUS_CRITICAL(subTest, 13 | LOG4CPLUS_TEXT("writeLogMessage()- This is a message from a different file")); 14 | subTest.log(log4cplus::FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Exiting writeLogMessage()...")); 15 | } 16 | log4cplus::helpers::LogLog::getLogLog()->warn(LOG4CPLUS_TEXT("REALLY exiting writeLogMessage()...")); 17 | } 18 | -------------------------------------------------------------------------------- /tests/fileappender_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([fileappender_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/fileappender_test/experr" .]) 5 | AT_CHECK(["${abs_top_builddir}/fileappender_test"], [0], [stdout], [experr]) 6 | AT_CHECK([test -f "a/b/c/d/Test.log"], [0]) 7 | ATX_WCHAR_T_TEST([ 8 | AT_CHECK([rm -rf "a"]) 9 | AT_CHECK(["${abs_top_builddir}/fileappender_testU"], [0], [stdout], [experr]) 10 | AT_CHECK([test -f "a/b/c/d/Test.log"], [0]) 11 | ]) 12 | 13 | AT_CLEANUP 14 | -------------------------------------------------------------------------------- /tests/fileappender_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(fileappender_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/fileappender_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += fileappender_test 4 | 5 | fileappender_test_sources = \ 6 | %D%/main.cxx 7 | 8 | fileappender_test_SOURCES = $(fileappender_test_sources) 9 | 10 | fileappender_test_LDADD = $(liblog4cplus_la_file) 11 | fileappender_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += fileappender_testU 15 | fileappender_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | fileappender_testU_SOURCES = $(fileappender_test_sources) 17 | fileappender_testU_LDADD = $(liblog4cplusU_la_file) 18 | fileappender_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/fileappender_test/experr: -------------------------------------------------------------------------------- 1 | log4cplus:WARN RollingFileAppender: MaxFileSize property value is too small. Resetting to 204800. 2 | log4cplus:ERROR Invalid filename 3 | log4cplus:ERROR Unable to open file: nonexistent/Test.log 4 | -------------------------------------------------------------------------------- /tests/filter_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([filter_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/filter_test/expout" .]) 5 | AT_CHECK([cp -f "${abs_builddir}/filter_test/log4cplus.properties" .]) 6 | 7 | m4_define([FILTER_TEST_GREPS], [ 8 | AT_CHECK([test -s debug_info_msgs.log]) 9 | AT_CHECK([! $GREP 'TRACE\|WARN\|ERROR\|FATAL' debug_info_msgs.log]) 10 | 11 | AT_CHECK([test -s fatal_msgs.log]) 12 | AT_CHECK([! $GREP 'TRACE\|DEBUG\|INFO\|WARN\|ERROR' fatal_msgs.log]) 13 | 14 | AT_CHECK([test -s trace_msgs.log]) 15 | AT_CHECK([! $GREP 'DEBUG\|INFO\|WARN\|ERROR\|FATAL' trace_msgs.log]) 16 | ]) 17 | 18 | AT_CHECK(["${abs_top_builddir}/filter_test"], [0], [expout], [stderr]) 19 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 20 | FILTER_TEST_GREPS 21 | 22 | ATX_WCHAR_T_TEST([ 23 | AT_CHECK([rm -f stderr debug_info_msgs.log fatal_msgs.log trace_msgs.log]) 24 | AT_CHECK(["${abs_top_builddir}/filter_testU"], [0], [expout], [stderr]) 25 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 26 | FILTER_TEST_GREPS 27 | ]) 28 | 29 | AT_CLEANUP 30 | -------------------------------------------------------------------------------- /tests/filter_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(filter_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/filter_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += filter_test 4 | 5 | filter_test_sources = \ 6 | %D%/main.cxx 7 | 8 | filter_test_SOURCES = $(filter_test_sources) 9 | 10 | filter_test_LDADD = $(liblog4cplus_la_file) 11 | filter_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += filter_testU 15 | filter_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | filter_testU_SOURCES = $(filter_test_sources) 17 | filter_testU_LDADD = $(liblog4cplusU_la_file) 18 | filter_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/filter_test/log4cplus.properties.in: -------------------------------------------------------------------------------- 1 | 2 | log4cplus.rootLogger=TRACE, STDOUT, ALL_MSGS, TRACE_MSGS, DEBUG_INFO_MSGS, FATAL_MSGS 3 | 4 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 5 | 6 | log4cplus.appender.ALL_MSGS=log4cplus::RollingFileAppender 7 | log4cplus.appender.ALL_MSGS.File=all_msgs.log 8 | log4cplus.appender.ALL_MSGS.layout=log4cplus::TTCCLayout 9 | 10 | log4cplus.appender.TRACE_MSGS=log4cplus::RollingFileAppender 11 | log4cplus.appender.TRACE_MSGS.File=trace_msgs.log 12 | log4cplus.appender.TRACE_MSGS.layout=log4cplus::TTCCLayout 13 | log4cplus.appender.TRACE_MSGS.filters.1=log4cplus::spi::LogLevelMatchFilter 14 | log4cplus.appender.TRACE_MSGS.filters.1.LogLevelToMatch=TRACE 15 | log4cplus.appender.TRACE_MSGS.filters.1.AcceptOnMatch=true 16 | log4cplus.appender.TRACE_MSGS.filters.2=log4cplus::spi::DenyAllFilter 17 | 18 | log4cplus.appender.DEBUG_INFO_MSGS=log4cplus::RollingFileAppender 19 | log4cplus.appender.DEBUG_INFO_MSGS.File=debug_info_msgs.log 20 | log4cplus.appender.DEBUG_INFO_MSGS.layout=log4cplus::TTCCLayout 21 | log4cplus.appender.DEBUG_INFO_MSGS.filters.1=log4cplus::spi::LogLevelRangeFilter 22 | log4cplus.appender.DEBUG_INFO_MSGS.filters.1.LogLevelMin=DEBUG 23 | log4cplus.appender.DEBUG_INFO_MSGS.filters.1.LogLevelMax=INFO 24 | log4cplus.appender.DEBUG_INFO_MSGS.filters.1.AcceptOnMatch=true 25 | log4cplus.appender.DEBUG_INFO_MSGS.filters.2=log4cplus::spi::DenyAllFilter 26 | 27 | log4cplus.appender.FATAL_MSGS=log4cplus::RollingFileAppender 28 | log4cplus.appender.FATAL_MSGS.File=fatal_msgs.log 29 | log4cplus.appender.FATAL_MSGS.layout=log4cplus::TTCCLayout 30 | log4cplus.appender.FATAL_MSGS.filters.1=log4cplus::spi::StringMatchFilter 31 | log4cplus.appender.FATAL_MSGS.filters.1.StringToMatch=FATAL 32 | log4cplus.appender.FATAL_MSGS.filters.1.AcceptOnMatch=true 33 | log4cplus.appender.FATAL_MSGS.filters.2=log4cplus::spi::DenyAllFilter 34 | -------------------------------------------------------------------------------- /tests/headers.at: -------------------------------------------------------------------------------- 1 | m4_foreach_w([HEADER], 2 | [ 3 | log4cplus/appender.h 4 | log4cplus/asyncappender.h 5 | log4cplus/clfsappender.h 6 | log4cplus/clogger.h 7 | log4cplus/config.hxx 8 | log4cplus/configurator.h 9 | log4cplus/consoleappender.h 10 | log4cplus/exception.h 11 | log4cplus/fileappender.h 12 | log4cplus/fstreams.h 13 | log4cplus/hierarchy.h 14 | log4cplus/hierarchylocker.h 15 | log4cplus/initializer.h 16 | log4cplus/layout.h 17 | log4cplus/log4cplus.h 18 | log4cplus/log4judpappender.h 19 | log4cplus/logger.h 20 | log4cplus/loggingmacros.h 21 | log4cplus/loglevel.h 22 | log4cplus/mdc.h 23 | log4cplus/msttsappender.h 24 | log4cplus/ndc.h 25 | log4cplus/nteventlogappender.h 26 | log4cplus/nullappender.h 27 | log4cplus/qt4debugappender.h 28 | log4cplus/socketappender.h 29 | log4cplus/streams.h 30 | log4cplus/syslogappender.h 31 | log4cplus/tchar.h 32 | log4cplus/tracelogger.h 33 | log4cplus/tstring.h 34 | log4cplus/version.h 35 | log4cplus/win32consoleappender.h 36 | log4cplus/win32debugappender.h 37 | 38 | log4cplus/helpers/appenderattachableimpl.h 39 | log4cplus/helpers/connectorthread.h 40 | log4cplus/helpers/fileinfo.h 41 | log4cplus/helpers/lockfile.h 42 | log4cplus/helpers/loglog.h 43 | log4cplus/helpers/pointer.h 44 | log4cplus/helpers/property.h 45 | log4cplus/helpers/queue.h 46 | log4cplus/helpers/snprintf.h 47 | log4cplus/helpers/socket.h 48 | log4cplus/helpers/socketbuffer.h 49 | log4cplus/helpers/stringhelper.h 50 | log4cplus/helpers/timehelper.h 51 | 52 | log4cplus/spi/appenderattachable.h 53 | log4cplus/spi/factory.h 54 | log4cplus/spi/filter.h 55 | log4cplus/spi/loggerfactory.h 56 | log4cplus/spi/loggerimpl.h 57 | log4cplus/spi/loggingevent.h 58 | log4cplus/spi/objectregistry.h 59 | log4cplus/spi/rootlogger.h 60 | 61 | log4cplus/thread/syncprims-pub-impl.h 62 | log4cplus/thread/syncprims.h 63 | log4cplus/thread/threads.h 64 | ], 65 | [ 66 | AT_SETUP([separate compilation of ]HEADER) 67 | AT_KEYWORDS([headers-compilation]) 68 | ATX_COMPILE_CXX_HEADER(HEADER) 69 | AT_CLEANUP 70 | ]) 71 | -------------------------------------------------------------------------------- /tests/hierarchy_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([hierarchy_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/hierarchy_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/hierarchy_test"], [0], [expout], [stderr]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/hierarchy_test"], [0], [expout], [stderr]) 8 | ]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/hierarchy_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(hierarchy_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/hierarchy_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += hierarchy_test 4 | 5 | hierarchy_test_sources = \ 6 | %D%/main.cxx 7 | 8 | hierarchy_test_SOURCES = $(hierarchy_test_sources) 9 | 10 | hierarchy_test_LDADD = $(liblog4cplus_la_file) 11 | hierarchy_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += hierarchy_testU 15 | hierarchy_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | hierarchy_testU_SOURCES = $(hierarchy_test_sources) 17 | hierarchy_testU_LDADD = $(liblog4cplusU_la_file) 18 | hierarchy_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/hierarchy_test/expout: -------------------------------------------------------------------------------- 1 | Logger name: test Parent = root 2 | Logger name: test2 Parent = root 3 | Logger name: test.subtest.a.b.c Parent = test 4 | Logger name: test.subtest.a Parent = test 5 | Logger name: test.subtest Parent = test 6 | Logger name: test.subtest.a Parent = test.subtest 7 | Logger name: test.subtest.a.b.c Parent = test.subtest.a 8 | Logger name: test.subtest.a.b.c.d Parent = test.subtest.a.b.c 9 | Logger name: test.subtest.a.b.c Parent = test.subtest.a 10 | Logger name: test.subtest.a Parent = test.subtest 11 | Logger name: test.subtest Parent = test 12 | ERROR - WARN log level and below are disabled and that is fine 13 | FATAL - ERROR log level and below are disabled and this should still be printed 14 | Exiting main()... 15 | -------------------------------------------------------------------------------- /tests/local.at: -------------------------------------------------------------------------------- 1 | m4_define([ATX_WCHAR_T_TEST], [ 2 | AS_IF([test "x$BUILD_WITH_WCHAR_T_SUPPORT" = "xyes"], [$1]) 3 | ]) 4 | 5 | 6 | m4_define([ATX_COMPILE_CXX], [ 7 | AT_CHECK([$CXX $CPPFLAGS $CXXFLAGS -c "$1"], [0], [stdout], [stderr]) 8 | ATX_WCHAR_T_TEST([ 9 | AT_CHECK([$CXX $CPPFLAGS $CXXFLAGS -DUNICODE=1 -D_UNICODE=1 -c "$1"], [0], [stdout], 10 | [stderr])]) 11 | ]) 12 | 13 | 14 | m4_define([ATX_COMPILE_CXX_HEADER], [ 15 | AT_CHECK([AS_ECHO([["#include \"$1\""]])>test.cxx]) 16 | AT_CAPTURE_FILE([test.cxx]) 17 | ATX_COMPILE_CXX([test.cxx]) 18 | ]) 19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/loglog_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([loglog_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/loglog_test/expout" .]) 5 | AT_CHECK([cp -f "${abs_srcdir}/loglog_test/experr" .]) 6 | AT_CHECK(["${abs_top_builddir}/loglog_test"], [0], [expout], [experr]) 7 | ATX_WCHAR_T_TEST([ 8 | AT_CHECK(["${abs_top_builddir}/loglog_test"], [0], [expout], [experr]) 9 | ]) 10 | 11 | AT_CLEANUP 12 | -------------------------------------------------------------------------------- /tests/loglog_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(loglog_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/loglog_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += loglog_test 4 | 5 | loglog_test_sources = \ 6 | %D%/main.cxx 7 | 8 | loglog_test_SOURCES = $(loglog_test_sources) 9 | 10 | loglog_test_LDADD = $(liblog4cplus_la_file) 11 | loglog_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += loglog_testU 15 | loglog_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | loglog_testU_SOURCES = $(loglog_test_sources) 17 | loglog_testU_LDADD = $(liblog4cplusU_la_file) 18 | loglog_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/loglog_test/experr: -------------------------------------------------------------------------------- 1 | log4cplus:WARN This is a Warning... 2 | log4cplus:WARN This is a Warning... 3 | log4cplus:ERROR This is a Error... 4 | log4cplus:ERROR This is a Error... 5 | log4cplus:WARN This is a Warning... 6 | log4cplus:WARN This is a Warning... 7 | log4cplus:ERROR This is a Error... 8 | log4cplus:ERROR This is a Error... 9 | -------------------------------------------------------------------------------- /tests/loglog_test/expout: -------------------------------------------------------------------------------- 1 | Entering printMsgs()... 2 | Exiting printMsgs()... 3 | 4 | Turning on debug... 5 | Entering printMsgs()... 6 | log4cplus: This is a Debug statement... 7 | log4cplus: This is a Debug statement... 8 | Exiting printMsgs()... 9 | 10 | Turning on quiet mode... 11 | Entering printMsgs()... 12 | Exiting printMsgs()... 13 | 14 | -------------------------------------------------------------------------------- /tests/loglog_test/main.cxx: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace log4cplus::helpers; 9 | 10 | void printMsgs() { 11 | cout << "Entering printMsgs()..." << endl; 12 | 13 | LogLog::getLogLog()->debug(LOG4CPLUS_TEXT("This is a Debug statement...")); 14 | LogLog::getLogLog()->debug( 15 | log4cplus::tstring(LOG4CPLUS_TEXT("This is a Debug statement..."))); 16 | 17 | LogLog::getLogLog()->warn(LOG4CPLUS_TEXT("This is a Warning...")); 18 | LogLog::getLogLog()->warn( 19 | log4cplus::tstring(LOG4CPLUS_TEXT("This is a Warning..."))); 20 | 21 | LogLog::getLogLog()->error(LOG4CPLUS_TEXT("This is a Error...")); 22 | LogLog::getLogLog()->error( 23 | log4cplus::tstring(LOG4CPLUS_TEXT("This is a Error..."))); 24 | 25 | cout << "Exiting printMsgs()..." << endl << endl; 26 | } 27 | 28 | 29 | int 30 | main() { 31 | log4cplus::Initializer initializer; 32 | printMsgs(); 33 | 34 | cout << "Turning on debug..." << endl; 35 | LogLog::getLogLog()->setInternalDebugging(true); 36 | printMsgs(); 37 | 38 | cout << "Turning on quiet mode..." << endl; 39 | LogLog::getLogLog()->setQuietMode(true); 40 | printMsgs(); 41 | 42 | return 0; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /tests/ndc_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([ndc_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/ndc_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/ndc_test"], [0], [expout]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/ndc_test"], [0], [expout]) 8 | ]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/ndc_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(ndc_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/ndc_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += ndc_test 4 | 5 | ndc_test_sources = \ 6 | %D%/main.cxx 7 | 8 | ndc_test_SOURCES = $(ndc_test_sources) 9 | 10 | ndc_test_LDADD = $(liblog4cplus_la_file) 11 | ndc_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += ndc_testU 15 | ndc_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | ndc_testU_SOURCES = $(ndc_test_sources) 17 | ndc_testU_LDADD = $(liblog4cplusU_la_file) 18 | ndc_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/ndc_test/expout: -------------------------------------------------------------------------------- 1 | Entering main()... 2 | Logger: test 3 | DEBUG test - This is a short test... 4 | DEBUG test - This should have my password now 5 | DEBUG test - This should NOT have my password now 6 | Just returned from pop... 7 | DEBUG test <> - There should be no NDC... 8 | DEBUG test - This should have my password now 9 | DEBUG test <> - There should be no NDC... 10 | Exiting main()... 11 | log4cplus: Entering ConsoleAppender::close().. 12 | log4cplus: Destroying appender named [First]. 13 | -------------------------------------------------------------------------------- /tests/ndc_test/main.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | using namespace log4cplus; 12 | using namespace log4cplus::helpers; 13 | 14 | int 15 | main() 16 | { 17 | cout << "Entering main()..." << endl; 18 | log4cplus::Initializer initializer; 19 | LogLog::getLogLog()->setInternalDebugging(true); 20 | try { 21 | SharedObjectPtr append_1(new ConsoleAppender()); 22 | append_1->setName(LOG4CPLUS_TEXT("First")); 23 | append_1->setLayout( 24 | std::unique_ptr( 25 | new log4cplus::PatternLayout( 26 | LOG4CPLUS_TEXT ("%-5p %c <%x> - %m%n")))); 27 | Logger::getRoot().addAppender(append_1); 28 | 29 | Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("test")); 30 | log4cplus::tcout << "Logger: " << logger.getName() << endl; 31 | getNDC().push(LOG4CPLUS_TEXT("tsmith")); 32 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("This is a short test...")); 33 | 34 | getNDC().push(LOG4CPLUS_TEXT("password")); 35 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("This should have my password now")); 36 | 37 | getNDC().pop(); 38 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("This should NOT have my password now")); 39 | 40 | getNDC().pop_void (); 41 | cout << "Just returned from pop..." << endl; 42 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("There should be no NDC...")); 43 | 44 | getNDC().push(LOG4CPLUS_TEXT("tsmith")); 45 | getNDC().push(LOG4CPLUS_TEXT("password")); 46 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("This should have my password now")); 47 | getNDC().remove(); 48 | LOG4CPLUS_DEBUG(logger, LOG4CPLUS_TEXT("There should be no NDC...")); 49 | } 50 | catch(...) { 51 | cout << "Exception..." << endl; 52 | Logger::getRoot().log(FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Exception occurred...")); 53 | } 54 | 55 | cout << "Exiting main()..." << endl; 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /tests/ostream_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([ostream_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/ostream_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/ostream_test"], [0], [expout]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/ostream_test"], [0], [expout]) 8 | ]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/ostream_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(ostream_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/ostream_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += ostream_test 4 | 5 | ostream_test_sources = \ 6 | %D%/main.cxx 7 | 8 | ostream_test_SOURCES = $(ostream_test_sources) 9 | 10 | ostream_test_LDADD = $(liblog4cplus_la_file) 11 | ostream_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += ostream_testU 15 | ostream_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | ostream_testU_SOURCES = $(ostream_test_sources) 17 | ostream_testU_LDADD = $(liblog4cplusU_la_file) 18 | ostream_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/ostream_test/expout: -------------------------------------------------------------------------------- 1 | DEBUG - This is a really long message. 2 | Just testing it out 3 | What do you think? 4 | DEBUG - This is a bool: 1 5 | INFO - This is a char: x 6 | INFO - This is a short: -100 7 | INFO - This is a unsigned short: 100 8 | INFO - This is a int: 1000 9 | INFO - This is a unsigned int: 1000 10 | INFO - This is a long(hex): 5f5e100 11 | INFO - This is a unsigned long: 100000000 12 | WARN - This is a float: 1.2345 13 | ERROR - This is a double: 1.2345234234 14 | FATAL - This is a long double: 123452342342.25 15 | WARN - The following message is empty: 16 | WARN - 17 | INFO - 1st, 2nd 18 | -------------------------------------------------------------------------------- /tests/ostream_test/main.cxx: -------------------------------------------------------------------------------- 1 | 2 | #include "log4cplus/logger.h" 3 | #include "log4cplus/consoleappender.h" 4 | #include "log4cplus/loglevel.h" 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | using namespace log4cplus; 11 | 12 | int 13 | main() 14 | { 15 | log4cplus::Initializer initializer; 16 | SharedAppenderPtr append_1(new ConsoleAppender()); 17 | append_1->setName(LOG4CPLUS_TEXT("First")); 18 | Logger::getRoot().addAppender(append_1); 19 | 20 | Logger root = Logger::getRoot(); 21 | Logger test = Logger::getInstance(LOG4CPLUS_TEXT("test")); 22 | 23 | LOG4CPLUS_DEBUG(root, 24 | "This is" 25 | << " a reall" 26 | << "y long message." << endl 27 | << "Just testing it out" << endl 28 | << "What do you think?"); 29 | test.setLogLevel(NOT_SET_LOG_LEVEL); 30 | LOG4CPLUS_DEBUG(test, "This is a bool: " << true); 31 | LOG4CPLUS_INFO(test, "This is a char: " << 'x'); 32 | LOG4CPLUS_INFO(test, "This is a short: " << static_cast(-100)); 33 | LOG4CPLUS_INFO(test, "This is a unsigned short: " 34 | << static_cast(100)); 35 | LOG4CPLUS_INFO(test, "This is a int: " << 1000); 36 | LOG4CPLUS_INFO(test, "This is a unsigned int: " << 1000u); 37 | LOG4CPLUS_INFO(test, "This is a long(hex): " << hex << 100000000l); 38 | LOG4CPLUS_INFO(test, "This is a unsigned long: " << 100000000ul); 39 | LOG4CPLUS_WARN(test, "This is a float: " << 1.2345f); 40 | LOG4CPLUS_ERROR(test, 41 | "This is a double: " 42 | << setprecision(15) 43 | << 1.2345234234); 44 | LOG4CPLUS_FATAL(test, 45 | "This is a long double: " 46 | << setprecision(15) 47 | << 123452342342.25L); 48 | LOG4CPLUS_WARN(test, "The following message is empty:"); 49 | LOG4CPLUS_WARN(test, ""); 50 | 51 | #if ! defined (__ANDROID__) 52 | LOG4CPLUS_INFO_FORMAT(test, "{}, {}", "1st", "2nd"); 53 | #endif // ! defined (__ANDROID__) 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /tests/patternlayout_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([patternlayout_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | m4_define([PATTERNLAYOUT_TEST_AWK], 5 | [[$AWK ' 6 | BEGIN {count = 0} 7 | /^Entering main/ && ++count; 8 | /(DEBUG|INFO|WARN|ERROR|FATAL)[ ]+c\.logger %[^%]*% - MDC value - This is the (FIRST|SECOND|THIRD|FOURTH|FIFTH) log message\.\.\. \[.*main\.cxx:[0-9]+\]/ && ++count; 9 | /^Exiting main/ && ++count; 10 | END {exit count}' /dev/null]]) 11 | 12 | AT_CHECK(["${abs_top_builddir}/patternlayout_test"], [0], [stdout], [stderr]) 13 | AT_CHECK([PATTERNLAYOUT_TEST_AWK], [7]) 14 | 15 | ATX_WCHAR_T_TEST([ 16 | AT_CHECK(["${abs_top_builddir}/patternlayout_testU"], [0], [stdout], [stderr]) 17 | AT_CHECK([PATTERNLAYOUT_TEST_AWK], [7]) 18 | ]) 19 | 20 | AT_CLEANUP 21 | -------------------------------------------------------------------------------- /tests/patternlayout_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(patternlayout_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/patternlayout_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += patternlayout_test 4 | 5 | patternlayout_test_sources = \ 6 | %D%/main.cxx 7 | 8 | patternlayout_test_SOURCES = $(patternlayout_test_sources) 9 | 10 | patternlayout_test_LDADD = $(liblog4cplus_la_file) 11 | patternlayout_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += patternlayout_testU 15 | patternlayout_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | patternlayout_testU_SOURCES = $(patternlayout_test_sources) 17 | patternlayout_testU_LDADD = $(liblog4cplusU_la_file) 18 | patternlayout_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/patternlayout_test/main.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | using namespace log4cplus; 15 | using namespace log4cplus::helpers; 16 | 17 | int 18 | main() 19 | { 20 | cout << "Entering main()..." << endl; 21 | log4cplus::Initializer initializer; 22 | LogLog::getLogLog()->setInternalDebugging(true); 23 | try { 24 | SharedObjectPtr append_1(new ConsoleAppender()); 25 | append_1->setName(LOG4CPLUS_TEXT("First")); 26 | 27 | log4cplus::getMDC ().put (LOG4CPLUS_TEXT ("key"), 28 | LOG4CPLUS_TEXT ("MDC value")); 29 | log4cplus::tstring pattern = LOG4CPLUS_TEXT("%d{%m/%d/%y %H:%M:%S,%Q} [%t] %-5p %c{2} %%%x%% - %X{key} - %m [%l]%n"); 30 | // std::tstring pattern = LOG4CPLUS_TEXT("%d{%c} [%t] %-5p [%.15c{3}] %%%x%% - %m [%l]%n"); 31 | append_1->setLayout( std::unique_ptr(new PatternLayout(pattern)) ); 32 | Logger::getRoot().addAppender(append_1); 33 | 34 | Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("test.a.long_logger_name.c.logger")); 35 | LOG4CPLUS_DEBUG(logger, "This is the FIRST log message..."); 36 | 37 | std::this_thread::sleep_for (std::chrono::seconds (1)); 38 | { 39 | NDCContextCreator ndc(LOG4CPLUS_TEXT("second")); 40 | LOG4CPLUS_INFO(logger, "This is the SECOND log message..."); 41 | } 42 | 43 | std::this_thread::sleep_for (std::chrono::seconds (1)); 44 | LOG4CPLUS_WARN(logger, "This is the THIRD log message..."); 45 | 46 | std::this_thread::sleep_for (std::chrono::seconds (1)); 47 | LOG4CPLUS_ERROR(logger, "This is the FOURTH log message..."); 48 | 49 | std::this_thread::sleep_for (std::chrono::seconds (1)); 50 | LOG4CPLUS_FATAL(logger, "This is the FIFTH log message..."); 51 | } 52 | catch(...) { 53 | cout << "Exception..." << endl; 54 | Logger::getRoot().log(FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Exception occurred...")); 55 | } 56 | 57 | cout << "Exiting main()..." << endl; 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /tests/performance_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([performance_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_builddir}/performance_test/log4cplus.properties" .]) 5 | AT_CHECK(["${abs_top_builddir}/performance_test"], [0], [stdout], [stderr]) 6 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 7 | ATX_WCHAR_T_TEST([ 8 | AT_CHECK(["${abs_top_builddir}/performance_testU"], [0], [stdout], [stderr]) 9 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 10 | ]) 11 | 12 | AT_CLEANUP 13 | -------------------------------------------------------------------------------- /tests/performance_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(performance_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/performance_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += performance_test 4 | 5 | performance_test_sources = \ 6 | %D%/main.cxx 7 | 8 | performance_test_SOURCES = $(performance_test_sources) 9 | 10 | performance_test_LDADD = $(liblog4cplus_la_file) 11 | performance_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += performance_testU 15 | performance_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | performance_testU_SOURCES = $(performance_test_sources) 17 | performance_testU_LDADD = $(liblog4cplusU_la_file) 18 | performance_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/performance_test/README: -------------------------------------------------------------------------------- 1 | This test is used to get a basic idea how log4cplus will perform in "your" environment. 2 | Customize the log4cplus.properties file to match your desired configuration. 3 | 4 | Note: 5 | Set the "logger.testlogger" logger to FATAL to test the performace of the "no logging" 6 | scenario. 7 | -------------------------------------------------------------------------------- /tests/performance_test/log4cplus.properties.in: -------------------------------------------------------------------------------- 1 | log4cplus.rootLogger=TRACE, STDOUT 2 | log4cplus.logger.testlogger=TRACE, TEST 3 | log4cplus.additivity.testlogger=FALSE 4 | 5 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 6 | log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout 7 | log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c - %m %n 8 | 9 | #log4cplus.appender.TEST=log4cplus::NullAppender 10 | log4cplus.appender.TEST=log4cplus::FileAppender 11 | log4cplus.appender.TEST.File=test_output.log 12 | log4cplus.appender.TEST.BufferSize=16384 13 | 14 | # For AsyncAppender testing. 15 | #log4cplus.appender.TEST=log4cplus::AsyncAppender 16 | #log4cplus.appender.TEST.Appender=log4cplus::FileAppender 17 | #log4cplus.appender.TEST.Appender.File=test_output.log 18 | #log4cplus.appender.TEST.Appender.layout=log4cplus::PatternLayout 19 | #log4cplus.appender.TEST.Appender.layout.ConversionPattern=%d{%y-%m-%d %H:%M:%S,%q} [%t] %-5p %c <%x> - %m%n 20 | 21 | #log4cplus.appender.TEST.layout=log4cplus::TTCCLayout 22 | log4cplus.appender.TEST.layout=log4cplus::PatternLayout 23 | log4cplus.appender.TEST.layout.ConversionPattern=%d{%y-%m-%d %H:%M:%S,%q} [%t] %-5p %c <%x> - %m%n 24 | #log4cplus.appender.TEST.layout.ConversionPattern=%d{%y-%m-%d %H:%M:%S,%q} %-5p %c <%x> - %m%n 25 | #log4cplus.appender.TEST.layout.ConversionPattern=%p - %m%n 26 | #log4cplus.appender.TEST.layout.ConversionPattern=%-5p - %m%n 27 | #log4cplus.appender.TEST.layout.ConversionPattern=%l - %m%n 28 | #log4cplus.appender.TEST.layout.ConversionPattern=%C.%M.%L - %m%n 29 | 30 | # For remote SyslogAppender testing. 31 | #log4cplus.appender.TEST=log4cplus::SysLogAppender 32 | #log4cplus.appender.TEST.host=localhost 33 | #log4cplus.appender.TEST.ident=log4cplus 34 | #log4cplus.appender.TEST.port=514 35 | #log4cplus.appender.TEST.udp=true 36 | #log4cplus.appender.TEST.IPv6=true 37 | 38 | # For Log4jUdpAppender testing. 39 | #log4cplus.appender.TEST=log4cplus::Log4jUdpAppender 40 | #log4cplus.appender.TEST.host=localhost 41 | #log4cplus.appender.TEST.port=5000 42 | #log4cplus.appender.TEST.IPv6=true 43 | -------------------------------------------------------------------------------- /tests/priority_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([priority_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_srcdir}/priority_test/expout" .]) 5 | AT_CHECK(["${abs_top_builddir}/priority_test"], [0], [expout], [ignore]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/priority_testU"], [0], [expout], [ignore]) 8 | ]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/priority_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(priority_test main.cxx func.cxx) 2 | -------------------------------------------------------------------------------- /tests/priority_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += priority_test 4 | 5 | priority_test_sources = \ 6 | %D%/func.cxx \ 7 | %D%/main.cxx 8 | 9 | priority_test_SOURCES = $(priority_test_sources) 10 | 11 | priority_test_LDADD = $(liblog4cplus_la_file) 12 | priority_test_LDFLAGS = -no-install 13 | 14 | if BUILD_WITH_WCHAR_T_SUPPORT 15 | noinst_PROGRAMS += priority_testU 16 | priority_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 17 | priority_testU_SOURCES = $(priority_test_sources) 18 | priority_testU_LDADD = $(liblog4cplusU_la_file) 19 | priority_testU_LDFLAGS = -no-install 20 | endif 21 | -------------------------------------------------------------------------------- /tests/priority_test/expout: -------------------------------------------------------------------------------- 1 | Entering main()... 2 | Getting root logger...DONE 3 | FATAL - root: DEBUG 4 | FATAL - test: DEBUG 5 | FATAL - test.subtest: DEBUG 6 | FATAL - 7 | Setting test.subtest to WARN 8 | FATAL - root: DEBUG 9 | FATAL - test: DEBUG 10 | FATAL - test.subtest: WARN 11 | FATAL - 12 | Setting test to ERROR 13 | FATAL - root: DEBUG 14 | FATAL - test: ERROR 15 | FATAL - test.subtest: WARN 16 | FATAL - 17 | Setting test.subtest to NOT_SET_LOG_LEVEL 18 | FATAL - root: DEBUG 19 | FATAL - test: ERROR 20 | FATAL - test.subtest: ERROR 21 | 22 | FATAL - Entering writeLogMessage()... 23 | FATAL - writeLogMessage()- This is a message from a different file 24 | FATAL - Exiting writeLogMessage()... 25 | Returned from writeLogMessage()... 26 | REALLY exiting main()... 27 | -------------------------------------------------------------------------------- /tests/priority_test/func.cxx: -------------------------------------------------------------------------------- 1 | 2 | #include "log4cplus/logger.h" 3 | #include "log4cplus/helpers/loglog.h" 4 | #include "log4cplus/loggingmacros.h" 5 | 6 | using namespace log4cplus; 7 | using namespace log4cplus::helpers; 8 | 9 | void 10 | writeLogMessage() 11 | { 12 | { 13 | Logger subTest = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest")); 14 | subTest.log(FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Entering writeLogMessage()...")); 15 | LOG4CPLUS_FATAL(subTest, "writeLogMessage()- This is a message from a different file"); 16 | subTest.log(FATAL_LOG_LEVEL, LOG4CPLUS_TEXT("Exiting writeLogMessage()...")); 17 | } 18 | LogLog::getLogLog()->warn(LOG4CPLUS_TEXT("REALLY exiting writeLogMessage()...")); 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/propertyconfig_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([propertyconfig_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK([cp -f "${abs_builddir}/propertyconfig_test/log4cplus.properties" .]) 5 | AT_CHECK([cp -f "${abs_builddir}/propertyconfig_test/log4cplus.tail.properties" .]) 6 | AT_CHECK([ENV_VAR=test "${abs_top_builddir}/propertyconfig_test"], [0], [stdout], [stderr]) 7 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 8 | AT_CHECK([test -f "output_test.log"]) 9 | ATX_WCHAR_T_TEST([ 10 | AT_CHECK([rm -f "output_test.log"]) 11 | AT_CHECK([ENV_VAR=test "${abs_top_builddir}/propertyconfig_testU"], [0], [stdout], [stderr]) 12 | AT_CHECK([! $GREP "Please initialize the log4cplus system properly"< stderr]) 13 | AT_CHECK([test -f "output_test.log"]) 14 | ]) 15 | 16 | AT_CLEANUP 17 | -------------------------------------------------------------------------------- /tests/propertyconfig_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(propertyconfig_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/propertyconfig_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += propertyconfig_test 4 | 5 | propertyconfig_test_sources = \ 6 | %D%/main.cxx 7 | 8 | propertyconfig_test_SOURCES = $(propertyconfig_test_sources) 9 | 10 | propertyconfig_test_LDADD = $(liblog4cplus_la_file) 11 | propertyconfig_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += propertyconfig_testU 15 | propertyconfig_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | propertyconfig_testU_SOURCES = $(propertyconfig_test_sources) 17 | propertyconfig_testU_LDADD = $(liblog4cplusU_la_file) 18 | propertyconfig_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/propertyconfig_test/log4cplus.properties.in: -------------------------------------------------------------------------------- 1 | 2 | log4cplus.threadPoolSize = 2 3 | log4cplus.rootLogger=INFO, STDOUT, R 4 | log4cplus.logger.test.a.b.c=WARN 5 | log4cplus.logger.filelogger=WARN, R 6 | log4cplus.additivity.filelogger=FALSE 7 | 8 | log4cplus.appender.STDOUT=log4cplus::ConsoleAppender 9 | log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout 10 | log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%%x%% - %m [%l]%n 11 | 12 | include log4cplus.tail.properties 13 | -------------------------------------------------------------------------------- /tests/propertyconfig_test/log4cplus.tail.properties.in: -------------------------------------------------------------------------------- 1 | log4cplus.appender.R=log4cplus::RollingFileAppender 2 | log4cplus.appender.R.File=output_${ENV_VAR}.log 3 | #log4cplus.appender.R.MaxFileSize=5MB 4 | log4cplus.appender.R.MaxFileSize=500KB 5 | log4cplus.appender.R.MaxBackupIndex=5 6 | log4cplus.appender.R.layout=log4cplus::TTCCLayout 7 | -------------------------------------------------------------------------------- /tests/propertyconfig_test/main.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | using namespace std; 11 | using namespace log4cplus; 12 | using namespace log4cplus::helpers; 13 | 14 | 15 | log4cplus::tstring 16 | getPropertiesFileArgument (int argc, char * argv[]) 17 | { 18 | if (argc >= 2) 19 | { 20 | char const * arg = argv[1]; 21 | log4cplus::tstring file = LOG4CPLUS_C_STR_TO_TSTRING (arg); 22 | log4cplus::helpers::FileInfo fi; 23 | if (getFileInfo (&fi, file) == 0) 24 | return file; 25 | } 26 | 27 | return LOG4CPLUS_TEXT ("log4cplus.properties"); 28 | } 29 | 30 | 31 | int 32 | main(int argc, char * argv[]) 33 | { 34 | tcout << LOG4CPLUS_TEXT("Entering main()...") << endl; 35 | log4cplus::Initializer initializer; 36 | LogLog::getLogLog()->setInternalDebugging(true); 37 | Logger root = Logger::getRoot(); 38 | try { 39 | PropertyConfigurator::doConfigure( 40 | getPropertiesFileArgument (argc, argv)); 41 | Logger fileCat = Logger::getInstance(LOG4CPLUS_TEXT("filelogger")); 42 | 43 | LOG4CPLUS_WARN(root, LOG4CPLUS_TEXT("Testing....")); 44 | LOG4CPLUS_WARN(root, LOG4CPLUS_TEXT("Writing messages to log....")); 45 | for (int i=0; i<10000; ++i) 46 | LOG4CPLUS_WARN(fileCat, LOG4CPLUS_TEXT("This is a WARNING...") 47 | << i); 48 | 49 | // Test that DOS EOLs in property files get removed. 50 | #define TEST_TEXT LOG4CPLUS_TEXT ("this is a test with DOS EOL-->") 51 | tistringstream propsStream ( 52 | LOG4CPLUS_TEXT ("text=") TEST_TEXT LOG4CPLUS_TEXT ("\r\n")); 53 | Properties props (propsStream); 54 | LOG4CPLUS_ASSERT (root, 55 | props.getProperty (LOG4CPLUS_TEXT ("text")) == TEST_TEXT); 56 | } 57 | catch(...) { 58 | tcout << LOG4CPLUS_TEXT("Exception...") << endl; 59 | LOG4CPLUS_FATAL(root, LOG4CPLUS_TEXT("Exception occurred...")); 60 | } 61 | 62 | tcout << LOG4CPLUS_TEXT("Exiting main()...") << endl; 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /tests/socket_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(socket_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/socket_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += socket_test 4 | 5 | socket_test_sources = \ 6 | %D%/main.cxx 7 | 8 | socket_test_SOURCES = $(socket_test_sources) 9 | 10 | socket_test_LDADD = $(liblog4cplus_la_file) 11 | socket_test_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += socket_testU 15 | socket_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | socket_testU_SOURCES = $(socket_test_sources) 17 | socket_testU_LDADD = $(liblog4cplusU_la_file) 18 | socket_testU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/socket_test/main.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | using namespace log4cplus; 6 | 7 | int 8 | main(int argc, char **argv) 9 | { 10 | log4cplus::Initializer initializer; 11 | 12 | std::this_thread::sleep_for (std::chrono::seconds (1)); 13 | tstring serverName = (argc > 1 14 | ? LOG4CPLUS_C_STR_TO_TSTRING(argv[1]) : tstring()); 15 | tstring host = LOG4CPLUS_TEXT("localhost"); 16 | SharedAppenderPtr append_1(new SocketAppender(host, 9998, serverName)); 17 | append_1->setName( LOG4CPLUS_TEXT("First") ); 18 | Logger::getRoot().addAppender(append_1); 19 | 20 | Logger root = Logger::getRoot(); 21 | Logger test = Logger::getInstance( LOG4CPLUS_TEXT("socket.test") ); 22 | 23 | LOG4CPLUS_DEBUG(root, 24 | "This is" 25 | << " a reall" 26 | << "y long message." << endl 27 | << "Just testing it out" << endl 28 | << "What do you think?"); 29 | test.setLogLevel(NOT_SET_LOG_LEVEL); 30 | LOG4CPLUS_DEBUG(test, "This is a bool: " << true); 31 | LOG4CPLUS_INFO(test, "This is a char: " << 'x'); 32 | LOG4CPLUS_INFO(test, "This is a short: " << static_cast(-100)); 33 | LOG4CPLUS_INFO(test, "This is a unsigned short: " 34 | << static_cast(100)); 35 | std::this_thread::sleep_for (std::chrono::microseconds (500)); 36 | LOG4CPLUS_INFO(test, "This is a int: " << 1000); 37 | LOG4CPLUS_INFO(test, "This is a unsigned int: " << 1000u); 38 | LOG4CPLUS_INFO(test, "This is a long(hex): " << hex << 100000000l); 39 | LOG4CPLUS_INFO(test, "This is a unsigned long: " << 100000000ul); 40 | LOG4CPLUS_WARN(test, "This is a float: " << 1.2345f); 41 | LOG4CPLUS_ERROR(test, 42 | "This is a double: " 43 | << setprecision(15) 44 | << 1.2345234234); 45 | LOG4CPLUS_FATAL(test, 46 | "This is a long double: " 47 | << setprecision(15) 48 | << 123452342342.342L); 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /tests/socket_test/run_test: -------------------------------------------------------------------------------- 1 | 2 | for (( i=0; i<100; i=i+1 )) 3 | do 4 | ./socket_test test-$i & 5 | done; 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/testsuite.at: -------------------------------------------------------------------------------- 1 | # Process with autom4te to create an -*- Autotest -*- test suite. 2 | 3 | m4_define([AT_PACKAGE_STRING], [log4cplus]) 4 | m4_define([AT_PACKAGE_BUGREPORT], [log4cplus-devel@lists.sourceforge.net]) 5 | 6 | AT_INIT([log4cplus]) 7 | AT_COLOR_TESTS 8 | 9 | m4_include([local.at]) 10 | 11 | AT_BANNER([separate headers compilation]) 12 | m4_include([headers.at]) 13 | 14 | AT_BANNER([other tests]) 15 | m4_include([appender_test.at]) 16 | m4_include([configandwatch_test.at]) 17 | m4_include([customloglevel_test.at]) 18 | m4_include([fileappender_test.at]) 19 | m4_include([filter_test.at]) 20 | m4_include([hierarchy_test.at]) 21 | m4_include([loglog_test.at]) 22 | m4_include([ndc_test.at]) 23 | m4_include([ostream_test.at]) 24 | m4_include([patternlayout_test.at]) 25 | m4_include([performance_test.at]) 26 | m4_include([priority_test.at]) 27 | m4_include([propertyconfig_test.at]) 28 | m4_include([thread_test.at]) 29 | m4_include([timeformat_test.at]) 30 | m4_include([unit_tests.at]) 31 | -------------------------------------------------------------------------------- /tests/thread_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([thread_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_SKIP_IF([test "x$ENABLE_THREADS" != "xyes"]) 5 | AT_CHECK(["${abs_top_builddir}/thread_test"], [0], [stdout], [stderr]) 6 | ATX_WCHAR_T_TEST([ 7 | AT_CHECK(["${abs_top_builddir}/thread_testU"], [0], [stdout], [stderr]) 8 | ]) 9 | 10 | AT_CLEANUP 11 | -------------------------------------------------------------------------------- /tests/thread_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | log4cplus_add_test(thread_test main.cxx) 2 | -------------------------------------------------------------------------------- /tests/thread_test/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | if MULTI_THREADED 4 | noinst_PROGRAMS += thread_test 5 | 6 | thread_test_sources = \ 7 | %D%/main.cxx 8 | 9 | thread_test_SOURCES = $(thread_test_sources) 10 | 11 | thread_test_LDADD = $(liblog4cplus_la_file) 12 | thread_test_LDFLAGS = -no-install 13 | 14 | if BUILD_WITH_WCHAR_T_SUPPORT 15 | noinst_PROGRAMS += thread_testU 16 | thread_testU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 17 | thread_testU_SOURCES = $(thread_test_sources) 18 | thread_testU_LDADD = $(liblog4cplusU_la_file) 19 | thread_testU_LDFLAGS = -no-install 20 | endif 21 | 22 | endif 23 | -------------------------------------------------------------------------------- /tests/timeformat_test.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([timeformat_test]) 2 | AT_KEYWORDS([appenders]) 3 | 4 | AT_CHECK(["${abs_top_builddir}/timeformat_test"], [0], [stdout], [stderr]) 5 | AT_CHECK([cp -f "${abs_srcdir}/timeformat_test/expout" .]) 6 | AT_CHECK([$SED -e '2d' 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace log4cplus; 8 | using namespace log4cplus::helpers; 9 | 10 | 11 | log4cplus::tchar const fmtstr[] = 12 | LOG4CPLUS_TEXT("%s, %Q%%q%q %%Q %%q=%%%q%%;%%q, %%Q=%Q"); 13 | 14 | 15 | int 16 | main() 17 | { 18 | std::cout << "Entering main()..." << std::endl; 19 | log4cplus::Initializer initializer; 20 | try 21 | { 22 | Time time; 23 | log4cplus::tstring str; 24 | 25 | time = now (); 26 | str = getFormattedTime (fmtstr, time); 27 | log4cplus::tcout << LOG4CPLUS_TEXT ("now: ") << str << std::endl; 28 | 29 | time = time_from_parts (0, 7); 30 | str = getFormattedTime (fmtstr, time); 31 | log4cplus::tcout << str << std::endl; 32 | 33 | time = time_from_parts (0, 17); 34 | str = getFormattedTime (fmtstr, time); 35 | log4cplus::tcout << str << std::endl; 36 | 37 | time = time_from_parts (0, 123); 38 | str = getFormattedTime (fmtstr, time); 39 | log4cplus::tcout << str << std::endl; 40 | 41 | time = time_from_parts (0, 1234); 42 | str = getFormattedTime (fmtstr, time); 43 | log4cplus::tcout << str << std::endl; 44 | 45 | time = time_from_parts (0, 12345); 46 | str = getFormattedTime (fmtstr, time); 47 | log4cplus::tcout << str << std::endl; 48 | 49 | time = time_from_parts (0, 123456); 50 | str = getFormattedTime (fmtstr, time); 51 | log4cplus::tcout << str << std::endl; 52 | 53 | time = time_from_parts (0, 0); 54 | str = getFormattedTime (fmtstr, time); 55 | log4cplus::tcout << str << std::endl; 56 | } 57 | catch(std::exception const & e) 58 | { 59 | std::cout << "Exception: " << e.what () << std::endl; 60 | } 61 | catch(...) 62 | { 63 | std::cout << "Exception..." << std::endl; 64 | } 65 | 66 | std::cout << "Exiting main()..." << std::endl; 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /tests/unit_tests.at: -------------------------------------------------------------------------------- 1 | AT_SETUP([unit_tests]) 2 | AT_KEYWORDS([unit-tests]) 3 | 4 | AT_CHECK(["${abs_top_builddir}/unit_tests"], [0], [stdout], [stderr]) 5 | ATX_WCHAR_T_TEST([ 6 | AT_CHECK(["${abs_top_builddir}/unit_testsU"], [0], [stdout], [stderr]) 7 | ]) 8 | 9 | AT_CLEANUP 10 | -------------------------------------------------------------------------------- /tests/unit_tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (unit_tests_sources unit_tests.cxx) 2 | set (unit_tests_libs ${log4cplus}) 3 | 4 | 5 | add_executable (unit_tests ${unit_tests_sources}) 6 | target_link_libraries (unit_tests PUBLIC ${unit_tests_libs}) 7 | add_test (NAME unit_tests 8 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 9 | COMMAND unit_tests) 10 | -------------------------------------------------------------------------------- /tests/unit_tests/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Generated by Autogen from Makefile.am.tpl 2 | 3 | noinst_PROGRAMS += unit_tests 4 | 5 | unit_tests_sources = \ 6 | %D%/unit_tests.cxx 7 | 8 | unit_tests_SOURCES = $(unit_tests_sources) 9 | 10 | unit_tests_LDADD = $(liblog4cplus_la_file) 11 | unit_tests_LDFLAGS = -no-install 12 | 13 | if BUILD_WITH_WCHAR_T_SUPPORT 14 | noinst_PROGRAMS += unit_testsU 15 | unit_testsU_CPPFLAGS = $(AM_CPPFLAGS) -DUNICODE=1 -D_UNICODE=1 16 | unit_testsU_SOURCES = $(unit_tests_sources) 17 | unit_testsU_LDADD = $(liblog4cplusU_la_file) 18 | unit_testsU_LDFLAGS = -no-install 19 | endif 20 | -------------------------------------------------------------------------------- /tests/unit_tests/unit_tests.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main (int argc, char* argv[]) 5 | { 6 | log4cplus::Initializer initializer; 7 | int result = 0; 8 | 9 | #if defined (LOG4CPLUS_WITH_UNIT_TESTS) 10 | result = log4cplus::unit_tests_main (argc, argv); 11 | #endif 12 | 13 | return result; 14 | } 15 | --------------------------------------------------------------------------------