├── .cvsignore ├── .gitattributes ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.md ├── THANKS ├── TODO ├── aclocal.m4 ├── autogen.sh ├── bcb5 ├── Makefile.am ├── Makefile.in ├── bcb5.bpg ├── bcb5.mak ├── log4cpp │ ├── Makefile.am │ ├── Makefile.in │ ├── log4cpp.bpf │ ├── log4cpp.bpr │ └── log4cpp.mak ├── testCategory │ ├── Makefile.am │ ├── Makefile.in │ ├── testCategory.bpf │ ├── testCategory.bpr │ └── testCategory.mak ├── testConfig │ ├── Makefile.am │ ├── Makefile.in │ ├── testConfig.bpf │ ├── testConfig.bpr │ └── testConfig.mak ├── testFixedContextCategory │ ├── Makefile.am │ ├── Makefile.in │ ├── testFixedContextCategory.bpf │ ├── testFixedContextCategory.bpr │ └── testFixedContextCategory.mak ├── testNDC │ ├── Makefile.am │ ├── Makefile.in │ ├── testNDC.bpf │ ├── testNDC.bpr │ └── testNDC.mak ├── testPattern │ ├── Makefile.am │ ├── Makefile.in │ ├── testPattern.bpf │ ├── testPattern.bpr │ └── testPattern.mak └── testmain │ ├── Makefile.am │ ├── Makefile.in │ ├── testmain.bpf │ ├── testmain.bpr │ └── testmain.mak ├── config ├── .cvsignore ├── Makefile.am ├── Makefile.in ├── compile ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh ├── missing ├── mkinstalldirs └── test-driver ├── configure ├── configure.in ├── doc ├── .cvsignore ├── Doxyfile.in ├── Makefile.am ├── Makefile.in ├── html │ ├── Makefile.am │ ├── Makefile.in │ ├── default.css │ ├── index.html │ └── sflogo.png └── mainPage.txt ├── include ├── .cvsignore ├── Makefile.am ├── Makefile.in ├── config.h.in ├── config.h.in~ └── log4cpp │ ├── .cvsignore │ ├── AbortAppender.hh │ ├── Appender.hh │ ├── AppenderSkeleton.hh │ ├── AppendersFactory.hh │ ├── BasicConfigurator.hh │ ├── BasicLayout.hh │ ├── BufferingAppender.hh │ ├── Category.hh │ ├── CategoryStream.hh │ ├── Configurator.hh │ ├── DailyRollingFileAppender.hh │ ├── Export.hh │ ├── FactoryParams.hh │ ├── FileAppender.hh │ ├── Filter.hh │ ├── FixedContextCategory.hh │ ├── HierarchyMaintainer.hh │ ├── IdsaAppender.hh │ ├── Layout.hh │ ├── LayoutAppender.hh │ ├── LayoutsFactory.hh │ ├── LevelEvaluator.hh │ ├── LoggingEvent.hh │ ├── Makefile.am │ ├── Makefile.in │ ├── Manipulator.hh │ ├── NDC.hh │ ├── NTEventLogAppender.hh │ ├── OstreamAppender.hh │ ├── PassThroughLayout.hh │ ├── PatternLayout.hh │ ├── Portability.hh │ ├── Priority.hh │ ├── PropertyConfigurator.hh │ ├── RemoteSyslogAppender.hh │ ├── RollingFileAppender.hh │ ├── SimpleConfigurator.hh │ ├── SimpleLayout.hh │ ├── SmtpAppender.hh │ ├── StringQueueAppender.hh │ ├── SyslogAppender.hh │ ├── TimeStamp.hh │ ├── TriggeringEventEvaluator.hh │ ├── TriggeringEventEvaluatorFactory.hh │ ├── Win32DebugAppender.hh │ ├── config-MinGW32.h │ ├── config-openvms.h │ ├── config-win32-stlport-boost.h │ ├── config-win32.h │ ├── convenience.h │ └── threading │ ├── BoostThreads.hh │ ├── DummyThreads.hh │ ├── MSThreads.hh │ ├── Makefile.am │ ├── Makefile.in │ ├── OmniThreads.hh │ ├── PThreads.hh │ └── Threading.hh ├── jamfile ├── log4cpp-1.1.5rc1.tar.gz ├── log4cpp-config.in ├── log4cpp.cfg ├── log4cpp.m4 ├── log4cpp.pc.in ├── log4cpp.spec.in ├── m4 ├── .cvsignore ├── ACX_PTHREAD.m4 ├── AC_CREATE_PREFIX_CONFIG_H.m4 ├── AC_CXX_HAVE_SSTREAM.m4 ├── AC_CXX_NAMESPACES.m4 ├── AC_C_INT64_T.m4 ├── AC_FUNC_SNPRINTF.m4 ├── BB_CHECK_OMNITHREADS.m4 ├── BB_CHECK_PTHREADS.m4 ├── BB_ENABLE_DOXYGEN.m4 ├── BB_ENABLE_REMOTE_SYSLOG.m4 ├── BB_ENABLE_SMTP.m4 ├── PETI_PEDANTIC_GCC.m4 ├── ac_config_libconfig_in.m4 └── ac_config_pkgconfig_in.m4 ├── msvc10 ├── .cvsignore ├── NTEventLogCategories.mc ├── log4cpp │ ├── .cvsignore │ └── log4cpp.vcxproj ├── log4cppLIB │ ├── .cvsignore │ └── log4cppLIB.vcxproj ├── log4cppRunnable │ └── log4cppRunnable.vcxproj ├── log4cpp_stlport_boost │ ├── log4cpp_stlport_boost.vcproj │ └── readme.txt ├── msvc10.sln ├── testCategory │ ├── .cvsignore │ └── testCategory.vcxproj ├── testDLL │ ├── .cvsignore │ └── testDLL.vcxproj ├── testDailyRollingFileAppender │ ├── nesteddir │ │ └── .gitignore │ ├── testConfig.log4cpp.dailyroll.nt.properties │ ├── testDailyRollingFileAppender.vcxproj │ └── testDailyRollingFileAppender.vcxproj.user ├── testMain │ ├── .cvsignore │ └── testMain.vcxproj ├── testMain_stlport_boost │ └── testMain_stlport_boost.vcproj ├── testNDC │ ├── .cvsignore │ └── testNDC.vcxproj ├── testNDC_stlport_boost │ └── testNDC_stlport_boost.vcproj ├── testNTEventLog │ ├── .cvsignore │ └── testNTEventLog.vcxproj ├── testNTEventLog_stlport_boost │ └── testNTEventLog_stlport_boost.vcproj ├── testPattern │ ├── .cvsignore │ └── testPattern.vcxproj ├── testPropConfig │ ├── .cvsignore │ └── testPropConfig.vcxproj └── testRollingFileAppender │ ├── testRollingFileAppender.vcxproj │ └── testRollingFileAppender.vcxproj.user ├── msvc6 ├── .gitattributes ├── Makefile.am ├── Makefile.in ├── NTEventLogCategories.mc ├── log4cpp │ ├── Makefile.am │ ├── Makefile.in │ └── log4cpp.dsp ├── log4cppDLL │ ├── Makefile.am │ ├── Makefile.in │ ├── log4cppDLL.dsp │ └── log4cppDLL.rc ├── log4cppDLL_stlport_boost │ ├── log4cppDLL_stlport_boost.dsp │ ├── log4cppDLL_stlport_boost.rc │ └── readme.txt ├── msvc6.dsw ├── testCategory │ ├── Makefile.am │ ├── Makefile.in │ └── testCategory.dsp ├── testDLL │ ├── Makefile.am │ ├── Makefile.in │ └── testDLL.dsp ├── testMain │ ├── Makefile.am │ ├── Makefile.in │ └── testMain.dsp ├── testMain_stlport_boost │ └── testMain_stlport_boost.dsp ├── testNDC │ ├── Makefile.am │ ├── Makefile.in │ └── testNDC.dsp ├── testNDC_stlport_boost │ └── testNDC_stlport_boost.dsp ├── testNTEventLog │ ├── Makefile.am │ ├── Makefile.in │ └── testNTEventLog.dsp ├── testNTEventLog_stlport_boost │ └── testNTEventLog_stlport_boost.dsp ├── testPattern │ ├── Makefile.am │ ├── Makefile.in │ └── testPattern.dsp └── testPropConfig │ └── testPropConfig.dsp ├── msvc7 ├── .cvsignore ├── Makefile.am ├── NTEventLogCategories.mc ├── log4cpp │ ├── .cvsignore │ └── log4cpp.vcproj ├── log4cppLIB │ ├── .cvsignore │ ├── Makefile.am │ └── log4cppLIB.vcproj ├── log4cpp_stlport_boost │ ├── log4cpp_stlport_boost.vcproj │ └── readme.txt ├── msvc7.sln ├── testCategory │ ├── .cvsignore │ ├── Makefile.am │ └── testCategory.vcproj ├── testDLL │ ├── .cvsignore │ ├── Makefile.am │ └── testDLL.vcproj ├── testMain │ ├── .cvsignore │ ├── Makefile.am │ └── testMain.vcproj ├── testMain_stlport_boost │ └── testMain_stlport_boost.vcproj ├── testNDC │ ├── .cvsignore │ ├── Makefile.am │ └── testNDC.vcproj ├── testNDC_stlport_boost │ └── testNDC_stlport_boost.vcproj ├── testNTEventLog │ ├── .cvsignore │ ├── Makefile.am │ └── testNTEventLog.vcproj ├── testNTEventLog_stlport_boost │ └── testNTEventLog_stlport_boost.vcproj ├── testPattern │ ├── .cvsignore │ ├── Makefile.am │ └── testPattern.vcproj └── testPropConfig │ ├── .cvsignore │ └── testPropConfig.vcproj ├── openvms ├── Makefile.am └── Makefile.in ├── src ├── .cvsignore ├── AbortAppender.cpp ├── Appender.cpp ├── AppenderSkeleton.cpp ├── AppendersFactory.cpp ├── BasicConfigurator.cpp ├── BasicLayout.cpp ├── BufferingAppender.cpp ├── Category.cpp ├── CategoryStream.cpp ├── Configurator.cpp ├── DailyRollingFileAppender.cpp ├── DllMain.cpp ├── DummyThreads.cpp ├── FactoryParams.cpp ├── FileAppender.cpp ├── Filter.cpp ├── FixedContextCategory.cpp ├── HierarchyMaintainer.cpp ├── IdsaAppender.cpp ├── LayoutAppender.cpp ├── LayoutsFactory.cpp ├── LevelEvaluator.cpp ├── Localtime.cpp ├── Localtime.hh ├── LoggingEvent.cpp ├── MSThreads.cpp ├── Makefile.am ├── Makefile.in ├── Manipulator.cpp ├── NDC.cpp ├── NTEventLogAppender.cpp ├── OmniThreads.cpp ├── OstreamAppender.cpp ├── PThreads.cpp ├── PassThroughLayout.cpp ├── PatternLayout.cpp ├── PortabilityImpl.cpp ├── PortabilityImpl.hh ├── Priority.cpp ├── Properties.cpp ├── Properties.hh ├── PropertyConfigurator.cpp ├── PropertyConfiguratorImpl.cpp ├── PropertyConfiguratorImpl.hh ├── RemoteSyslogAppender.cpp ├── RollingFileAppender.cpp ├── SimpleConfigurator.cpp ├── SimpleLayout.cpp ├── SmtpAppender.cpp ├── StringQueueAppender.cpp ├── StringUtil.cpp ├── StringUtil.hh ├── SyslogAppender.cpp ├── TimeStamp.cpp ├── TriggeringEventEvaluatorFactory.cpp ├── Win32DebugAppender.cpp └── snprintf.c └── tests ├── .cvsignore ├── Clock.cpp ├── Clock.hh ├── Makefile.am ├── Makefile.in ├── NDCTest.hh ├── jamfile ├── log4cpp.init ├── log4cpp.nt.property ├── log4cpp.properties ├── log4cpp.property ├── nesteddir └── .gitignore ├── testCategory.cpp ├── testConfig.cpp ├── testConfig.log4cpp.dailyroll.properties ├── testConfig.log4cpp.properties ├── testDLL.cpp ├── testDailyRollingFileAppender.cpp ├── testErrorCollision.cpp ├── testFilter.cpp ├── testFixedContextCategory.cpp ├── testNDC.cpp ├── testNDCMain.cpp ├── testNTEventLog.cpp ├── testPattern.cpp ├── testPriority.cpp ├── testPropConfig.cpp ├── testProperties.cpp ├── testProperties.properties ├── testPropertyConfig.cpp ├── testRollingFileAppender.cpp ├── test_convenience.cpp ├── testbench.cpp └── testmain.cpp /.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | config.log 3 | config.cache 4 | configure 5 | libtool 6 | config.status 7 | Makefile 8 | Makefile.in 9 | log4cpp.spec 10 | aclocal.m4 11 | bin 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.am linguist-detectable=false 2 | *.in linguist-detectable=false 3 | *.m4 linguist-detectable=false 4 | *.mak linguist-detectable=false 5 | *.bpr linguist-detectable=false 6 | *.bpf linguist-detectable=false 7 | *.sh linguist-detectable=false 8 | *.bash linguist-detectable=false 9 | *.bash linguist-detectable=false 10 | *.zsh linguist-detectable=false 11 | CMakeLists.txt linguist-detectable=false 12 | *.cmake linguist-detectable=false 13 | autogen.sh linguist-detectable=false 14 | install-sh linguist-detectable=false 15 | configure linguist-detectable=false 16 | config.guess linguist-detectable=false 17 | config.sub linguist-detectable=false 18 | depcomp linguist-detectable=false 19 | missing linguist-detectable=false 20 | libtool linguist-detectable=false 21 | libtoolize linguist-detectable=false 22 | build-aux/* linguist-detectable=false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.lo 9 | *.la 10 | *.so 11 | #auto generated 12 | Makefile.in 13 | Makefile 14 | *.log 15 | 16 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Bastiaan Bakker 2 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | See 'Building Log4cpp' section of HTML documentation. 2 | 3 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | if DOC 2 | SUBDIRS = msvc6 bcb5 config src include tests doc 3 | else 4 | SUBDIRS = msvc6 bcb5 config src include tests 5 | endif 6 | 7 | DIST_SUBDIRS = msvc6 bcb5 openvms config src include doc tests 8 | 9 | bin_SCRIPTS = log4cpp-config 10 | 11 | m4datadir = $(datadir)/aclocal 12 | m4data_DATA = log4cpp.m4 13 | 14 | pkgconfigdir = $(libdir)/pkgconfig 15 | pkgconfig_DATA = log4cpp.pc 16 | 17 | EXTRA_DIST = \ 18 | log4cpp.spec.in log4cpp.spec log4cpp.m4 \ 19 | m4/ac_config_libconfig_in.m4 \ 20 | m4/ac_config_pkgconfig_in.m4 \ 21 | m4/AC_CREATE_PREFIX_CONFIG_H.m4 \ 22 | m4/BB_ENABLE_DOXYGEN.m4 \ 23 | m4/BB_ENABLE_REMOTE_SYSLOG.m4 \ 24 | m4/BB_ENABLE_SMTP.m4 \ 25 | m4/AC_CXX_HAVE_SSTREAM.m4 \ 26 | m4/AC_CXX_NAMESPACES.m4 \ 27 | m4/PETI_PEDANTIC_GCC.m4 \ 28 | m4/AC_FUNC_SNPRINTF.m4 \ 29 | m4/AC_C_INT64_T.m4 \ 30 | m4/BB_CHECK_OMNITHREADS.m4 \ 31 | m4/BB_CHECK_PTHREADS.m4 32 | 33 | .PHONY: check rpm docs doc-dist 34 | 35 | dist-hook: 36 | perl -pi -e 's/\n/\r\n/g' `find $(distdir) -name '*.ds?'` 37 | perl -pi -e 's/\n/\r\n/g' `find $(distdir) -name '*.bpg'` 38 | 39 | distclean-local: 40 | $(RM) CONTENTS TAGS log4cpp-config 41 | 42 | CONTENTS:: 43 | find $(top_srcdir) \( ! -type l -a -name '*.cpp' -o -name '*.hh' -o -name Makefile.am \) > $@ 44 | 45 | TAGS:: CONTENTS 46 | etags `cat $<` 47 | 48 | convenience.h \ 49 | rpm: dist 50 | rpm -ta $(PACKAGE)-$(VERSION).tar.gz 51 | mv -f /usr/src/redhat/SRPMS/$(PACKAGE)-$(VERSION)-*.rpm $(top_srcdir) 52 | mv -f /usr/src/redhat/RPMS/*/$(PACKAGE)-$(VERSION)-*.rpm $(top_srcdir) 53 | mv -f /usr/src/redhat/RPMS/*/$(PACKAGE)-devel-$(VERSION)-*.rpm \ 54 | $(top_srcdir) 55 | mv -f /usr/src/redhat/RPMS/*/$(PACKAGE)-doc-$(VERSION)-*.rpm \ 56 | $(top_srcdir) 57 | 58 | docs: 59 | $(MAKE) -C doc 60 | 61 | doc-dist: docs 62 | tar -zcf $(PACKAGE)-docs-$(VERSION).tar.gz -C $(top_srcdir)/doc/html --exclude CVS . 63 | 64 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See 'Releases' section of HTML documentation. 2 | 3 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | All 'README' information is now in the HTML documentation, 2 | see doc/html or the project website (http://log4cpp.sf.net/). 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # log4cpp 2 | log4cpp 3 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/THANKS -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO 2 | 3 | This file contains an imcomplete list of things to be done, not necessarily 4 | ordered by importance or urgence. 5 | 6 | 7 | Add provisional category nodes. Maybe work it out a bit differently than 8 | LOG4J. First actually document what the exact behaviour should be. 9 | 10 | Add a simple configurator of type 'keyword=value'. Done: 0.2.6 11 | 12 | Port PatternLayout. Done: 0.2.6 13 | 14 | Document multithreading policy and behaviour (i.e. all log calls are thread 15 | safe, others are 'mulithread prepared'). 16 | 17 | Add multithread support for the NDC class. 18 | 19 | Add switches to configure to tune document generation (e.g. --with-latex, etc). Done: 0.2.3 20 | 21 | Move stuff from Hints to autconf. E.g. LOG4CPP_USE_OLD_IOSTREAM. Done: 0.2.3 22 | 23 | Document all classes. 24 | 25 | Add more tests. 26 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Adding libtools." 4 | libtoolize --force --automake 5 | 6 | echo "Building macros." 7 | aclocal -I m4 $ACLOCAL_FLAGS 8 | 9 | echo "Building config header." 10 | autoheader 11 | 12 | echo "Building makefiles." 13 | automake --add-missing 14 | 15 | echo "Building configure." 16 | autoconf 17 | 18 | echo 'run "configure; make"' 19 | -------------------------------------------------------------------------------- /bcb5/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = log4cpp testCategory testFixedContextCategory testmain testNDC testPattern testConfig 2 | 3 | EXTRA_DIST = bcb5.bpg bcb5.mak 4 | -------------------------------------------------------------------------------- /bcb5/bcb5.bpg: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | VERSION = BWS.01 3 | #------------------------------------------------------------------------------ 4 | !ifndef ROOT 5 | ROOT = $(MAKEDIR)\.. 6 | !endif 7 | #------------------------------------------------------------------------------ 8 | MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** 9 | DCC = $(ROOT)\bin\dcc32.exe $** 10 | BRCC = $(ROOT)\bin\brcc32.exe $** 11 | #------------------------------------------------------------------------------ 12 | PROJECTS = log4cpp.dll testPattern.exe testmain.exe testCategory.exe \ 13 | testFixedContextCategory.exe testNDC.exe testConfig.exe 14 | #------------------------------------------------------------------------------ 15 | default: $(PROJECTS) 16 | #------------------------------------------------------------------------------ 17 | 18 | log4cpp.dll: log4cpp\log4cpp.bpr 19 | $(ROOT)\bin\bpr2mak $** 20 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 21 | 22 | testPattern.exe: testPattern\testPattern.bpr 23 | $(ROOT)\bin\bpr2mak $** 24 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 25 | 26 | testmain.exe: testmain\testmain.bpr 27 | $(ROOT)\bin\bpr2mak $** 28 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 29 | 30 | testCategory.exe: testCategory\testCategory.bpr 31 | $(ROOT)\bin\bpr2mak $** 32 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 33 | 34 | testFixedContextCategory.exe: testFixedContextCategory\testFixedContextCategory.bpr 35 | $(ROOT)\bin\bpr2mak $** 36 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 37 | 38 | testNDC.exe: testNDC\testNDC.bpr 39 | $(ROOT)\bin\bpr2mak $** 40 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 41 | 42 | testConfig.exe: testConfig\testConfig.bpr 43 | $(ROOT)\bin\bpr2mak $** 44 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 45 | 46 | 47 | -------------------------------------------------------------------------------- /bcb5/bcb5.mak: -------------------------------------------------------------------------------- 1 | !ifndef ROOT 2 | ROOT = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECTS = log4cpp.dll testmain.exe testCategory.exe testNDC.exe \ 6 | testFixedContextCategory.exe testPattern.exe testConfig.exe 7 | 8 | default: $(PROJECTS) 9 | 10 | 11 | 12 | log4cpp.dll: 13 | cd log4cpp 14 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 15 | cd .. 16 | 17 | testmain.exe: 18 | cd testmain 19 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 20 | cd .. 21 | 22 | testCategory.exe: 23 | cd testCategory 24 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 25 | cd .. 26 | 27 | testNDC.exe: 28 | cd testNDC 29 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 30 | cd .. 31 | 32 | testFixedContextCategory.exe: 33 | cd testFixedContextCategory 34 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 35 | cd .. 36 | 37 | testPattern.exe: 38 | cd testPattern 39 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 40 | cd .. 41 | 42 | testConfig.exe: 43 | cd testConfig 44 | $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak 45 | cd .. 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /bcb5/log4cpp/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = log4cpp.bpf log4cpp.bpr log4cpp.mak 2 | -------------------------------------------------------------------------------- /bcb5/log4cpp/log4cpp.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\src\Appender.cpp"); 2 | USEUNIT("..\..\src\AppenderSkeleton.cpp"); 3 | USEUNIT("..\..\src\BasicConfigurator.cpp"); 4 | USEUNIT("..\..\src\BasicLayout.cpp"); 5 | USEUNIT("..\..\src\Category.cpp"); 6 | USEUNIT("..\..\src\CategoryStream.cpp"); 7 | USEUNIT("..\..\src\Configurator.cpp"); 8 | USEUNIT("..\..\src\DailyRollingFileAppender.cpp"); 9 | USEUNIT("..\..\src\DummyThreads.cpp"); 10 | USEUNIT("..\..\src\FileAppender.cpp"); 11 | USEUNIT("..\..\src\Filter.cpp"); 12 | USEUNIT("..\..\src\FixedContextCategory.cpp"); 13 | USEUNIT("..\..\src\HierarchyMaintainer.cpp"); 14 | USEUNIT("..\..\src\IdsaAppender.cpp"); 15 | USEUNIT("..\..\src\LayoutAppender.cpp"); 16 | USEUNIT("..\..\src\LoggingEvent.cpp"); 17 | USEUNIT("..\..\src\MSThreads.cpp"); 18 | USEUNIT("..\..\src\NDC.cpp"); 19 | USEUNIT("..\..\src\NTEventLogAppender.cpp"); 20 | USEUNIT("..\..\src\OmniThreads.cpp"); 21 | USEUNIT("..\..\src\OstreamAppender.cpp"); 22 | USEUNIT("..\..\src\PatternLayout.cpp"); 23 | USEUNIT("..\..\src\PortabilityImpl.cpp"); 24 | USEUNIT("..\..\src\Priority.cpp"); 25 | USEUNIT("..\..\src\Properties.cpp"); 26 | USEUNIT("..\..\src\PropertyConfigurator.cpp"); 27 | USEUNIT("..\..\src\PropertyConfiguratorImpl.cpp"); 28 | USEUNIT("..\..\src\PThreads.cpp"); 29 | USEUNIT("..\..\src\RemoteSyslogAppender.cpp"); 30 | USEUNIT("..\..\src\RollingFileAppender.cpp"); 31 | USEUNIT("..\..\src\SimpleConfigurator.cpp"); 32 | USEUNIT("..\..\src\SimpleLayout.cpp"); 33 | USEUNIT("..\..\src\StringQueueAppender.cpp"); 34 | USEUNIT("..\..\src\StringUtil.cpp"); 35 | USEUNIT("..\..\src\SyslogAppender.cpp"); 36 | USEUNIT("..\..\src\TimeStamp.cpp"); 37 | USEUNIT("..\..\src\Win32DebugAppender.cpp"); 38 | USEUNIT("..\..\src\AbortAppender.cpp"); 39 | USEUNIT("..\..\src\Localtime.cpp"); 40 | T//--------------------------------------------------------------------------- 41 | //--------------------------------------------------------------------------- 42 | //--------------------------------------------------------------------------- 43 | //--------------------------------------------------------------------------- 44 | //--------------------------------------------------------------------------- 45 | //--------------------------------------------------------------------------- 46 | his file is used by the project manager only and should be treated like the project file 47 | 48 | DllEntryPoint 49 | -------------------------------------------------------------------------------- /bcb5/testCategory/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testCategory.bpf testCategory.bpr testCategory.mak 2 | -------------------------------------------------------------------------------- /bcb5/testCategory/testCategory.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testCategory.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testCategory/testCategory.bpr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | [Version Info] 44 | IncludeVerInfo=0 45 | AutoIncBuild=0 46 | MajorVer=1 47 | MinorVer=0 48 | Release=0 49 | Build=0 50 | Debug=0 51 | PreRelease=0 52 | Special=0 53 | Private=0 54 | DLL=0 55 | Locale=1031 56 | CodePage=1252 57 | 58 | [Version Info Keys] 59 | CompanyName= 60 | FileDescription= 61 | FileVersion=1.0.0.0 62 | InternalName= 63 | LegalCopyright= 64 | LegalTrademarks= 65 | OriginalFilename= 66 | ProductName= 67 | ProductVersion=1.0.0.0 68 | Comments= 69 | 70 | [HistoryLists\hlIncludePath] 71 | Count=1 72 | Item0=..\..\tests;..\..\include;$(BCB)\include 73 | 74 | [HistoryLists\hlLibraryPath] 75 | Count=1 76 | Item0=..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 77 | 78 | [HistoryLists\hlDebugSourcePath] 79 | Count=1 80 | Item0=$(BCB)\source\vcl 81 | 82 | [HistoryLists\hlConditionals] 83 | Count=1 84 | Item0=_DEBUG;LOG4CPP_HAS_DLL 85 | 86 | [HistoryLists\hlIntOutputDir] 87 | Count=1 88 | Item0=. 89 | 90 | [Debugging] 91 | DebugSourceDirs=$(BCB)\source\vcl 92 | 93 | [Parameters] 94 | RunParams= 95 | HostApplication= 96 | RemoteHost= 97 | RemotePath= 98 | RemoteDebug=0 99 | 100 | [Compiler] 101 | ShowInfoMsgs=0 102 | LinkDebugVcl=0 103 | LinkCGLIB=0 104 | 105 | -------------------------------------------------------------------------------- /bcb5/testCategory/testCategory.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECT = testCategory.exe 6 | OBJFILES = testCategory.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG;LOG4CPP_HAS_DLL 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\tests;..\..\include;$(BCB)\include 13 | LIBPATH = ..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | # --------------------------------------------------------------------------- 47 | $(PROJECT): $(OBJFILES) 48 | $(BCB)\BIN\$(LINKER) @&&! 49 | $(LFLAGS) -L$(LIBPATH) + 50 | $(ALLOBJ), + 51 | $(PROJECT),, + 52 | $(ALLLIB), + 53 | , + 54 | $(ALLRES) 55 | ! 56 | 57 | .cpp.obj: 58 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 59 | 60 | .c.obj: 61 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 62 | 63 | -------------------------------------------------------------------------------- /bcb5/testConfig/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testConfig.bpf testConfig.bpr testConfig.mak 2 | -------------------------------------------------------------------------------- /bcb5/testConfig/testConfig.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testConfig.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testConfig/testConfig.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECT = testConfig.exe 6 | OBJFILES = testConfig.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\include;..\..\tests;$(BCB)\include 13 | LIBPATH = ..\..\tests;..\log4cpp;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | # --------------------------------------------------------------------------- 47 | $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) 48 | $(BCB)\BIN\$(LINKER) @&&! 49 | $(LFLAGS) -L$(LIBPATH) + 50 | $(ALLOBJ), + 51 | $(PROJECT),, + 52 | $(ALLLIB), + 53 | $(DEFFILE), + 54 | $(ALLRES) 55 | ! 56 | 57 | .cpp.obj: 58 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 59 | 60 | .c.obj: 61 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 62 | 63 | -------------------------------------------------------------------------------- /bcb5/testFixedContextCategory/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testFixedContextCategory.bpf testFixedContextCategory.bpr testFixedContextCategory.mak 2 | -------------------------------------------------------------------------------- /bcb5/testFixedContextCategory/testFixedContextCategory.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testFixedContextCategory.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testFixedContextCategory/testFixedContextCategory.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | # --------------------------------------------------------------------------- 5 | PROJECT = testFixedContextCategory.exe 6 | OBJFILES = testFixedContextCategory.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG;LOG4CPP_HAS_DLL 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\tests;..\..\include;$(BCB)\include 13 | LIBPATH = ..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | $(PROJECT): $(OBJFILES) 47 | $(BCB)\BIN\$(LINKER) @&&! 48 | $(LFLAGS) -L$(LIBPATH) + 49 | $(ALLOBJ), + 50 | $(PROJECT),, + 51 | $(ALLLIB), + 52 | , + 53 | $(ALLRES) 54 | ! 55 | 56 | .cpp.obj: 57 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 58 | 59 | .c.obj: 60 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 61 | 62 | -------------------------------------------------------------------------------- /bcb5/testNDC/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testNDC.bpf testNDC.bpr testNDC.mak 2 | -------------------------------------------------------------------------------- /bcb5/testNDC/testNDC.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testNDC.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testNDC/testNDC.bpr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | [Version Info] 44 | IncludeVerInfo=0 45 | AutoIncBuild=0 46 | MajorVer=1 47 | MinorVer=0 48 | Release=0 49 | Build=0 50 | Debug=0 51 | PreRelease=0 52 | Special=0 53 | Private=0 54 | DLL=0 55 | Locale=1031 56 | CodePage=1252 57 | 58 | [Version Info Keys] 59 | CompanyName= 60 | FileDescription= 61 | FileVersion=1.0.0.0 62 | InternalName= 63 | LegalCopyright= 64 | LegalTrademarks= 65 | OriginalFilename= 66 | ProductName= 67 | ProductVersion=1.0.0.0 68 | Comments= 69 | 70 | [HistoryLists\hlIncludePath] 71 | Count=1 72 | Item0=..\..\tests;$(BCB)\include;..\..\include 73 | 74 | [HistoryLists\hlLibraryPath] 75 | Count=1 76 | Item0=..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 77 | 78 | [HistoryLists\hlDebugSourcePath] 79 | Count=1 80 | Item0=$(BCB)\source\vcl 81 | 82 | [HistoryLists\hlConditionals] 83 | Count=1 84 | Item0=_DEBUG;LOG4CPP_HAS_DLL 85 | 86 | [HistoryLists\hlIntOutputDir] 87 | Count=1 88 | Item0=. 89 | 90 | [Debugging] 91 | DebugSourceDirs=$(BCB)\source\vcl 92 | 93 | [Parameters] 94 | RunParams= 95 | HostApplication= 96 | RemoteHost= 97 | RemotePath= 98 | RemoteDebug=0 99 | 100 | [Compiler] 101 | ShowInfoMsgs=0 102 | LinkDebugVcl=0 103 | LinkCGLIB=0 104 | 105 | -------------------------------------------------------------------------------- /bcb5/testNDC/testNDC.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECT = testNDC.exe 6 | OBJFILES = testNDC.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG;LOG4CPP_HAS_DLL 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\tests;$(BCB)\include;..\..\include 13 | LIBPATH = ..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | $(PROJECT): $(OBJFILES) 47 | $(BCB)\BIN\$(LINKER) @&&! 48 | $(LFLAGS) -L$(LIBPATH) + 49 | $(ALLOBJ), + 50 | $(PROJECT),, + 51 | $(ALLLIB), + 52 | , + 53 | $(ALLRES) 54 | ! 55 | 56 | .cpp.obj: 57 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 58 | 59 | .c.obj: 60 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 61 | 62 | -------------------------------------------------------------------------------- /bcb5/testPattern/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testPattern.bpf testPattern.bpr testPattern.mak 2 | -------------------------------------------------------------------------------- /bcb5/testPattern/testPattern.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testPattern.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testPattern/testPattern.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECT = testPattern.exe 6 | OBJFILES = testPattern.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG;LOG4CPP_HAS_DLL 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\tests;..\..\include;$(BCB)\include;$(BCB)\include\vcl 13 | LIBPATH = $(BCB)\Projects\Lib;..\..\tests;..\log4cpp;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | # --------------------------------------------------------------------------- 47 | $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) 48 | $(BCB)\BIN\$(LINKER) @&&! 49 | $(LFLAGS) -L$(LIBPATH) + 50 | $(ALLOBJ), + 51 | $(PROJECT),, + 52 | $(ALLLIB), + 53 | $(DEFFILE), + 54 | $(ALLRES) 55 | ! 56 | 57 | .cpp.obj: 58 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 59 | 60 | .c.obj: 61 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 62 | 63 | -------------------------------------------------------------------------------- /bcb5/testmain/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testmain.bpf testmain.bpr testmain.mak 2 | -------------------------------------------------------------------------------- /bcb5/testmain/testmain.bpf: -------------------------------------------------------------------------------- 1 | USEUNIT("..\..\tests\testmain.cpp"); 2 | USELIB("..\log4cpp\log4cpp.lib"); 3 | //--------------------------------------------------------------------------- 4 | This file is used by the project manager only and should be treated like the project file 5 | 6 | main -------------------------------------------------------------------------------- /bcb5/testmain/testmain.bpr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | [Version Info] 44 | IncludeVerInfo=0 45 | AutoIncBuild=0 46 | MajorVer=1 47 | MinorVer=0 48 | Release=0 49 | Build=0 50 | Debug=0 51 | PreRelease=0 52 | Special=0 53 | Private=0 54 | DLL=0 55 | Locale=1031 56 | CodePage=1252 57 | 58 | [Version Info Keys] 59 | CompanyName= 60 | FileDescription= 61 | FileVersion=1.0.0.0 62 | InternalName= 63 | LegalCopyright= 64 | LegalTrademarks= 65 | OriginalFilename= 66 | ProductName= 67 | ProductVersion=1.0.0.0 68 | Comments= 69 | 70 | [HistoryLists\hlIncludePath] 71 | Count=1 72 | Item0=..\..\tests;..\..\include;$(BCB)\include 73 | 74 | [HistoryLists\hlLibraryPath] 75 | Count=1 76 | Item0=..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 77 | 78 | [HistoryLists\hlDebugSourcePath] 79 | Count=1 80 | Item0=$(BCB)\source\vcl 81 | 82 | [HistoryLists\hlConditionals] 83 | Count=1 84 | Item0=_DEBUG;LOG4CPP_HAS_DLL 85 | 86 | [HistoryLists\hlIntOutputDir] 87 | Count=1 88 | Item0=. 89 | 90 | [Debugging] 91 | DebugSourceDirs=$(BCB)\source\vcl 92 | 93 | [Parameters] 94 | RunParams= 95 | HostApplication= 96 | RemoteHost= 97 | RemotePath= 98 | RemoteDebug=0 99 | 100 | [Compiler] 101 | ShowInfoMsgs=0 102 | LinkDebugVcl=0 103 | LinkCGLIB=0 104 | 105 | -------------------------------------------------------------------------------- /bcb5/testmain/testmain.mak: -------------------------------------------------------------------------------- 1 | !if !$d(BCB) 2 | BCB = $(MAKEDIR)\.. 3 | !endif 4 | 5 | PROJECT = testmain.exe 6 | OBJFILES = testmain.obj 7 | LIBFILES = ..\log4cpp\log4cpp.lib 8 | # --------------------------------------------------------------------------- 9 | PATHCPP = .;..\..\tests 10 | USERDEFINES = _DEBUG;LOG4CPP_HAS_DLL 11 | SYSDEFINES = NO_STRICT;_NO_VCL;_RTLDLL 12 | INCLUDEPATH = ..\..\tests;..\..\include;$(BCB)\include 13 | LIBPATH = ..\..\tests;$(BCB)\lib\obj;$(BCB)\lib 14 | WARNINGS= -w-par 15 | # --------------------------------------------------------------------------- 16 | CFLAG1 = -Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM -c 17 | LFLAGS = -I. -D"" -ap -Tpe -x -Gn -v 18 | # --------------------------------------------------------------------------- 19 | ALLOBJ = c0x32.obj $(OBJFILES) 20 | ALLRES = $(RESFILES) 21 | ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib 22 | # --------------------------------------------------------------------------- 23 | 24 | .autodepend 25 | # --------------------------------------------------------------------------- 26 | !if "$(USERDEFINES)" != "" 27 | AUSERDEFINES = -d$(USERDEFINES:;= -d) 28 | !else 29 | AUSERDEFINES = 30 | !endif 31 | 32 | !if !$d(BCC32) 33 | BCC32 = bcc32 34 | !endif 35 | 36 | !if !$d(LINKER) 37 | LINKER = ilink32 38 | !endif 39 | 40 | # --------------------------------------------------------------------------- 41 | !if $d(PATHCPP) 42 | .PATH.CPP = $(PATHCPP) 43 | .PATH.C = $(PATHCPP) 44 | !endif 45 | 46 | $(PROJECT): $(OBJFILES) 47 | $(BCB)\BIN\$(LINKER) @&&! 48 | $(LFLAGS) -L$(LIBPATH) + 49 | $(ALLOBJ), + 50 | $(PROJECT),, + 51 | $(ALLLIB), + 52 | , + 53 | $(ALLRES) 54 | ! 55 | 56 | .cpp.obj: 57 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 58 | 59 | .c.obj: 60 | $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } 61 | 62 | -------------------------------------------------------------------------------- /config/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | -------------------------------------------------------------------------------- /config/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /config/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id$ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /doc/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | Doxyfile 5 | html 6 | man 7 | -------------------------------------------------------------------------------- /doc/Doxyfile.in: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = @PACKAGE_NAME@ 2 | PROJECT_NUMBER = @PACKAGE_VERSION@ 3 | 4 | # General configuration options 5 | #--------------------------------------------------------------------------- 6 | QUIET = YES 7 | WARNINGS = YES 8 | 9 | GENERATE_LATEX = @enable_latex_docs@ 10 | GENERATE_HTML = @enable_html_docs@ 11 | GENERATE_MAN = YES 12 | GENERATE_RTF = NO 13 | 14 | OUTPUT_DIRECTORY = . 15 | HTML_OUTPUT = html/api 16 | HTML_HEADER = 17 | HTML_FOOTER = 18 | LATEX_OUTPUT = latex 19 | MAN_OUTPUT = man 20 | 21 | DISABLE_INDEX = NO 22 | EXTRACT_ALL = YES 23 | EXTRACT_STATIC = YES 24 | EXTRACT_PRIVATE = NO 25 | HIDE_UNDOC_MEMBERS = NO 26 | BRIEF_MEMBER_DESC = YES 27 | REPEAT_BRIEF = YES 28 | JAVADOC_AUTOBRIEF = YES 29 | INHERIT_DOCS = YES 30 | FULL_PATH_NAMES = NO 31 | CLASS_DIAGRAMS = YES 32 | 33 | # Configuration options related to the input files 34 | #--------------------------------------------------------------------------- 35 | INPUT = @top_srcdir@/include @top_srcdir@/src @top_srcdir@/doc/mainPage.txt 36 | FILE_PATTERNS = *.cpp *.hh 37 | EXAMPLE_PATH = 38 | RECURSIVE = YES 39 | INPUT_FILTER = 40 | CASE_SENSE_NAMES = YES 41 | 42 | # Configuration options related to the preprocessor 43 | #--------------------------------------------------------------------------- 44 | ENABLE_PREPROCESSING = YES 45 | MACRO_EXPANSION = YES 46 | SEARCH_INCLUDES = YES 47 | INCLUDE_PATH = 48 | EXPAND_ONLY_PREDEF = NO 49 | PREDEFINED = "WIN32" 50 | 51 | # Configuration options related to external references 52 | #--------------------------------------------------------------------------- 53 | TAGFILES = 54 | GENERATE_TAGFILE = 55 | ALLEXTERNALS = NO 56 | PERL_PATH = /usr/bin/perl 57 | 58 | # Configuration options related to the dot tool 59 | #--------------------------------------------------------------------------- 60 | HAVE_DOT = @enable_dot@ 61 | COLLABORATION_GRAPH = YES 62 | INCLUDE_GRAPH = YES 63 | INCLUDED_BY_GRAPH = YES 64 | GRAPHICAL_HIERARCHY = YES 65 | MAX_DOT_GRAPH_WIDTH = 1024 66 | MAX_DOT_GRAPH_HEIGHT = 1024 67 | GENERATE_LEGEND = YES 68 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = html 2 | 3 | man3dir = $(mandir)/man3 4 | docdir = $(prefix)/doc/@PACKAGE_TARNAME@-@PACKAGE_VERSION@ 5 | 6 | EXTRA_DIST = \ 7 | mainPage.txt 8 | 9 | .PHONY: dox pdf 10 | 11 | all-local: dox #pdf 12 | 13 | dox: html html/api/index.html 14 | html/api/index.html: Doxyfile 15 | @DOXYGEN@ 16 | 17 | pdf: @PACKAGE_TARNAME@.pdf 18 | @PACKAGE@.pdf: 19 | $(MAKE) -C ./latex pdf 20 | ln -s ./latex/refman.ps @PACKAGE_TARNAME@.ps 21 | ln -s ./latex/refman.pdf @PACKAGE_TARNAME@.pdf 22 | 23 | 24 | install-data-local: 25 | $(mkinstalldirs) $(man3dir) 26 | @for i in ./man/man3/log4cpp.3 ./man/man3/log4cpp_*.3; do \ 27 | inst=`basename $$i | sed 's/_/::/g'`; \ 28 | echo "$(INSTALL_DATA) $$i$(man3dir)/$$inst"; \ 29 | $(INSTALL_DATA) $$i $(man3dir)/$$inst; \ 30 | done 31 | $(mkinstalldirs) $(docdir) 32 | cp -r html/. $(docdir) 33 | $(RM) -r -f $(docdir)/CVS \ 34 | $(docdir)/Makefile.am \ 35 | $(docdir)/Makefile.in \ 36 | $(docdir)/Makefile 37 | 38 | uninstall-local: 39 | $(RM) $(man3dir)/log4cpp.3 40 | $(RM) $(man3dir)/log4cpp::*.3 41 | $(RM) -r -f $(docdir) 42 | 43 | clean-local: 44 | $(RM) -r latex 45 | $(RM) -r html/api man @PACKAGE_TARNAME@.ps @PACKAGE_TARNAME@.pdf 46 | -------------------------------------------------------------------------------- /doc/html/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = \ 2 | index.html \ 3 | default.css \ 4 | sflogo.png 5 | -------------------------------------------------------------------------------- /doc/html/default.css: -------------------------------------------------------------------------------- 1 | BODY 2 | { 3 | BACKGROUND-COLOR: white 4 | } 5 | 6 | H2 7 | { 8 | color: white; 9 | background-color: darkBlue; 10 | font-family: arial,helvetica,sanserif; 11 | } 12 | 13 | H3 14 | { 15 | text-decoration: underline; 16 | } 17 | 18 | DT 19 | { 20 | font-weight: bold; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /doc/html/sflogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/doc/html/sflogo.png -------------------------------------------------------------------------------- /doc/mainPage.txt: -------------------------------------------------------------------------------- 1 | /** 2 | @mainpage 3 | This is the Doxygen generated API documentation of Log4cpp. 4 | **/ 5 | -------------------------------------------------------------------------------- /include/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | 5 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = log4cpp 2 | -------------------------------------------------------------------------------- /include/config.h.in~: -------------------------------------------------------------------------------- 1 | /* include/config.h.in. Generated automatically from configure.in by autoheader. */ 2 | 3 | /* Define if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define if you have the header file. */ 7 | #undef HAVE_IO_H 8 | 9 | /* Define if you have the `idsa' library (-lidsa). */ 10 | #undef HAVE_LIBIDSA 11 | 12 | /* define if the compiler implements namespaces */ 13 | #undef HAVE_NAMESPACES 14 | 15 | /* define if the C library has snprintf */ 16 | #undef HAVE_SNPRINTF 17 | 18 | /* define if the compiler has stringstream */ 19 | #undef HAVE_SSTREAM 20 | 21 | /* Define if you have the `syslog' function. */ 22 | #undef HAVE_SYSLOG 23 | 24 | /* Define if you have the header file. */ 25 | #undef HAVE_UNISTD_H 26 | 27 | /* Name of package */ 28 | #undef PACKAGE 29 | 30 | /* Version number of package */ 31 | #undef VERSION 32 | -------------------------------------------------------------------------------- /include/log4cpp/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | stamp-h 5 | stamp-h.in 6 | -------------------------------------------------------------------------------- /include/log4cpp/AbortAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * AbortAppender.hh 3 | * 4 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_ABORTAPPENDER_HH 11 | #define _LOG4CPP_ABORTAPPENDER_HH 12 | 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | /** 19 | * This Appender causes the application to abort() upon the first append() 20 | * call. 21 | * 22 | * @since 0.3.5 23 | **/ 24 | class LOG4CPP_EXPORT AbortAppender : public AppenderSkeleton { 25 | public: 26 | 27 | AbortAppender(const std::string& name); 28 | virtual ~AbortAppender(); 29 | 30 | virtual bool reopen(); 31 | virtual void close(); 32 | 33 | /** 34 | * The AbortAppender does not layout. 35 | * @returns false 36 | **/ 37 | virtual bool requiresLayout() const; 38 | 39 | virtual void setLayout(Layout* layout); 40 | 41 | protected: 42 | virtual void _append(const LoggingEvent& event); 43 | }; 44 | } 45 | 46 | #endif // _LOG4CPP_ABORTAPPENDER_HH 47 | -------------------------------------------------------------------------------- /include/log4cpp/AppendersFactory.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | 9 | #if !defined(h_738a42b1_1502_4483_948a_a69e7bbbee6a) 10 | #define h_738a42b1_1502_4483_948a_a69e7bbbee6a 11 | 12 | #include 13 | #include 14 | #include 15 | #include "Portability.hh" 16 | #include "Appender.hh" 17 | #include "FactoryParams.hh" 18 | 19 | namespace log4cpp 20 | { 21 | class LOG4CPP_EXPORT AppendersFactory 22 | { 23 | public: 24 | typedef FactoryParams params_t; 25 | typedef std::LOG4CPP_UNIQUE_PTR (*create_function_t)(const params_t& params); 26 | 27 | static AppendersFactory& getInstance(); 28 | void registerCreator(const std::string& class_name, create_function_t create_function); 29 | std::LOG4CPP_UNIQUE_PTR create(const std::string& class_name, const params_t& params); 30 | bool registered(const std::string& class_name) const; 31 | 32 | private: 33 | AppendersFactory(){}; 34 | 35 | typedef std::map creators_t; 36 | typedef creators_t::const_iterator const_iterator; 37 | 38 | creators_t creators_; 39 | }; 40 | } 41 | 42 | #endif // h_738a42b1_1502_4483_948a_a69e7bbbee6a 43 | -------------------------------------------------------------------------------- /include/log4cpp/BasicConfigurator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * BasicConfigurator.hh 3 | * 4 | * Copyright 2002, Log4cpp Project. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #ifndef _LOG4CPP_BASICCONFIGURATOR_HH 9 | #define _LOG4CPP_BASICCONFIGURATOR_HH 10 | 11 | #include 12 | 13 | namespace log4cpp { 14 | 15 | /** 16 | This class implements a trivial default configuration for log4cpp: 17 | it adds a FileAppender that logs to stdout and uses a BasicLayout to 18 | the root Category. 19 | @since 0.3.2 20 | **/ 21 | class LOG4CPP_EXPORT BasicConfigurator { 22 | public: 23 | 24 | /** 25 | Performs a minimal configuration of log4cpp. 26 | **/ 27 | static void configure(); 28 | }; 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/log4cpp/BasicLayout.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * BasicLayout.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_BASICLAYOUT_HH 11 | #define _LOG4CPP_BASICLAYOUT_HH 12 | 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | /** 19 | * BasicLayout is a simple fixed format Layout implementation. 20 | **/ 21 | class LOG4CPP_EXPORT BasicLayout : public Layout { 22 | public: 23 | BasicLayout(); 24 | virtual ~BasicLayout(); 25 | 26 | /** 27 | * Formats the LoggingEvent in BasicLayout style:
28 | * "timeStamp priority category ndc: message" 29 | **/ 30 | virtual std::string format(const LoggingEvent& event); 31 | }; 32 | } 33 | 34 | #endif // _LOG4CPP_BASICLAYOUT_HH 35 | -------------------------------------------------------------------------------- /include/log4cpp/BufferingAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_ebd0ee89_622d_4af1_9a9d_d0e057debe86) 9 | #define h_ebd0ee89_622d_4af1_9a9d_d0e057debe86 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace log4cpp 17 | { 18 | class LOG4CPP_EXPORT BufferingAppender : public LayoutAppender 19 | { 20 | public: 21 | BufferingAppender(const std::string name, unsigned long max_size, std::LOG4CPP_UNIQUE_PTR sink, 22 | std::LOG4CPP_UNIQUE_PTR evaluator); 23 | 24 | virtual void close() { sink_->close(); } 25 | 26 | bool getLossy() const { return lossy_; } 27 | void setLossy(bool lossy) { lossy_ = lossy; } 28 | 29 | protected: 30 | virtual void _append(const LoggingEvent& event); 31 | 32 | private: 33 | typedef std::list queue_t; 34 | 35 | queue_t queue_; 36 | unsigned long max_size_; 37 | std::LOG4CPP_UNIQUE_PTR sink_; 38 | std::LOG4CPP_UNIQUE_PTR evaluator_; 39 | bool lossy_; 40 | 41 | void dump(); 42 | }; 43 | } 44 | 45 | #endif // h_ebd0ee89_622d_4af1_9a9d_d0e057debe86 46 | -------------------------------------------------------------------------------- /include/log4cpp/Configurator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Configurator.hh 3 | * 4 | * Copyright 2001, Glen Scott. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #ifndef _LOG4CPP_CONFIGURATOR_HH 9 | #define _LOG4CPP_CONFIGURATOR_HH 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | /** 19 | * Exception class for configuration. 20 | */ 21 | class LOG4CPP_EXPORT ConfigureFailure : public std::runtime_error { 22 | public: 23 | /** 24 | * Constructor. 25 | * @param reason String containing the description of the exception. 26 | */ 27 | ConfigureFailure(const std::string& reason); 28 | }; 29 | } 30 | 31 | #endif // _LOG4CPP_CONFIGURATOR_HH 32 | -------------------------------------------------------------------------------- /include/log4cpp/DailyRollingFileAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * DailyRollingFileAppender.hh 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #ifndef _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH 8 | #define _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace log4cpp { 16 | 17 | /** 18 | DailyRollingFileAppender is a FileAppender that rolls over the logfile once 19 | the next day starts. 20 | @since 1.1.2 21 | **/ 22 | class LOG4CPP_EXPORT DailyRollingFileAppender : public FileAppender { 23 | public: 24 | DailyRollingFileAppender(const std::string& name, 25 | const std::string& fileName, 26 | unsigned int maxDaysToKeep = maxDaysToKeepDefault, 27 | bool append = true, 28 | mode_t mode = 00644); 29 | 30 | virtual void setMaxDaysToKeep(unsigned int maxDaysToKeep); 31 | virtual unsigned int getMaxDaysToKeep() const; 32 | 33 | virtual void rollOver(); 34 | 35 | static unsigned int maxDaysToKeepDefault; 36 | protected: 37 | virtual void _append(const LoggingEvent& event); 38 | 39 | unsigned int _maxDaysToKeep; 40 | // last log's file creation time (or last modification if appender just created) 41 | struct tm _logsTime; 42 | }; 43 | } 44 | 45 | #endif // _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH 46 | -------------------------------------------------------------------------------- /include/log4cpp/Export.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #ifndef _LOG4CPP_EXPORT_HH 9 | #define _LOG4CPP_EXPORT_HH 10 | 11 | #ifdef LOG4CPP_HAS_DLL 12 | # ifdef LOG4CPP_BUILD_DLL 13 | # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) 14 | # define LOG4CPP_EXPORT __declspec(dllexport) 15 | # else 16 | # define LOG4CPP_EXPORT 17 | # endif 18 | # else 19 | # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) 20 | # define LOG4CPP_EXPORT __declspec(dllimport) 21 | # else 22 | # define LOG4CPP_EXPORT 23 | # endif 24 | # endif 25 | #else 26 | # define LOG4CPP_EXPORT 27 | #endif 28 | 29 | #endif // _LOG4CPP_EXPORT_HH 30 | 31 | -------------------------------------------------------------------------------- /include/log4cpp/HierarchyMaintainer.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * HierarchyMaintainer.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_HIERARCHYMAINTAINER_HH 11 | #define _LOG4CPP_HIERARCHYMAINTAINER_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace log4cpp { 21 | 22 | /** 23 | * HierarchyMaintainer is an internal log4cpp class. It is responsible 24 | * for maintaining the hierarchy of Categories. Applications should 25 | * not have to use this class directly. 26 | **/ 27 | class HierarchyMaintainer { 28 | friend class Log4cppCleanup; 29 | 30 | public: 31 | typedef std::map CategoryMap; 32 | typedef void (*shutdown_fun_ptr)(); 33 | 34 | static HierarchyMaintainer& getDefaultMaintainer(); 35 | 36 | HierarchyMaintainer(); 37 | virtual ~HierarchyMaintainer(); 38 | virtual Category* getExistingInstance(const std::string& name); 39 | virtual Category& getInstance(const std::string& name); 40 | virtual std::vector* getCurrentCategories() const; 41 | virtual void shutdown(); 42 | void register_shutdown_handler(shutdown_fun_ptr handler); 43 | virtual void deleteAllCategories(); 44 | 45 | protected: 46 | virtual Category* _getExistingInstance(const std::string& name); 47 | virtual Category& _getInstance(const std::string& name); 48 | CategoryMap _categoryMap; 49 | mutable threading::Mutex _categoryMutex; 50 | 51 | private: 52 | typedef std::vector handlers_t; 53 | 54 | static HierarchyMaintainer* _defaultMaintainer; 55 | handlers_t handlers_; 56 | }; 57 | } 58 | 59 | #endif // _LOG4CPP_HIERARCHYMAINTAINER_HH 60 | -------------------------------------------------------------------------------- /include/log4cpp/IdsaAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * IdsaAppender.hh 3 | * 4 | * Copyright 2000, Marc Welz 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #ifndef _LOG4CPP_IDSAAPPENDER_HH 10 | #define _LOG4CPP_IDSAAPPENDER_HH 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace log4cpp { 19 | 20 | /** 21 | * IdsaAppender is an Appender that sends LoggingEvents to the IDS/A 22 | * logger and reference monitor by Marc Welz. 23 | * See http://jade.cs.uct.ac.za/idsa/ for more information on IDS/A. 24 | **/ 25 | class IdsaAppender : public AppenderSkeleton { 26 | public: 27 | 28 | /** 29 | * Instantiate an IdsaAppender with given name and name. 30 | * Unlike the syslog API, idsa allows multiple connections. 31 | * @param name The name of the Appender 32 | * @param idsaName The service parameter of idsa 33 | **/ 34 | IdsaAppender(const std::string& name, const std::string& idsaName); 35 | virtual ~IdsaAppender(); 36 | 37 | /** 38 | * Calls idsa_open() and idsa_close() 39 | **/ 40 | virtual bool reopen(); 41 | 42 | /** 43 | * Calls idsa_close() 44 | **/ 45 | virtual void close(); 46 | 47 | /** 48 | * The IdsaAppender does its own Layout. 49 | * @returns false 50 | **/ 51 | virtual bool requiresLayout() const; 52 | 53 | virtual void setLayout(Layout* layout); 54 | 55 | protected: 56 | 57 | /** 58 | * Calls idsa_open(). 59 | **/ 60 | virtual void open(); 61 | 62 | /** 63 | * Sends a LoggingEvent to idsa. 64 | * @param event the LoggingEvent to log. 65 | **/ 66 | virtual void _append(const LoggingEvent& event); 67 | 68 | const std::string _idsaName; 69 | 70 | IDSA_CONNECTION *_idsaConnection; 71 | 72 | }; 73 | } 74 | 75 | #endif // _LOG4CPP_IDSAAPPENDER_HH 76 | 77 | -------------------------------------------------------------------------------- /include/log4cpp/Layout.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Layout.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_LAYOUT_HH 11 | #define _LOG4CPP_LAYOUT_HH 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace log4cpp { 18 | 19 | /** 20 | * Extend this abstract class to create your own log layout format. 21 | **/ 22 | class LOG4CPP_EXPORT Layout { 23 | public: 24 | /** 25 | * Destructor for Layout. 26 | **/ 27 | virtual ~Layout() { }; 28 | 29 | /** 30 | * Formats the LoggingEvent data to a string that appenders can log. 31 | * Implement this method to create your own layout format. 32 | * @param event The LoggingEvent. 33 | * @returns an appendable string. 34 | **/ 35 | virtual std::string format(const LoggingEvent& event) = 0; 36 | }; 37 | } 38 | 39 | #endif // _LOG4CPP_LAYOUT_HH 40 | -------------------------------------------------------------------------------- /include/log4cpp/LayoutAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * LayoutAppender.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_LAYOUTAPPENDER_HH 11 | #define _LOG4CPP_LAYOUTAPPENDER_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace log4cpp { 19 | 20 | /** 21 | * LayoutAppender is a common superclass for all Appenders that require 22 | * a Layout. 23 | **/ 24 | class LOG4CPP_EXPORT LayoutAppender : public AppenderSkeleton { 25 | public: 26 | 27 | typedef BasicLayout DefaultLayoutType; 28 | 29 | LayoutAppender(const std::string& name); 30 | virtual ~LayoutAppender(); 31 | 32 | /** 33 | * Check if the appender requires a layout. All LayoutAppenders do, 34 | * therefore this method returns true for all subclasses. 35 | * 36 | * @returns true. 37 | **/ 38 | virtual bool requiresLayout() const; 39 | virtual void setLayout(Layout* layout = NULL); 40 | 41 | protected: 42 | /** 43 | * Return the layout of the appender. 44 | * This method is the Layout accessor for subclasses of LayoutAppender. 45 | * @returns the Layout. 46 | **/ 47 | Layout& _getLayout(); 48 | 49 | private: 50 | Layout* _layout; 51 | }; 52 | } 53 | 54 | #endif // _LOG4CPP_LAYOUTAPPENDER_HH 55 | 56 | -------------------------------------------------------------------------------- /include/log4cpp/LayoutsFactory.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_409ac787_0acf_47ff_ac15_3e9024d40315) 9 | #define h_409ac787_0acf_47ff_ac15_3e9024d40315 10 | 11 | #include 12 | #include 13 | #include 14 | #include "Portability.hh" 15 | #include "Layout.hh" 16 | #include "FactoryParams.hh" 17 | 18 | namespace log4cpp 19 | { 20 | class LOG4CPP_EXPORT LayoutsFactory 21 | { 22 | public: 23 | typedef FactoryParams params_t; 24 | typedef std::LOG4CPP_UNIQUE_PTR (*create_function_t)(const params_t& params); 25 | 26 | static LayoutsFactory& getInstance(); 27 | void registerCreator(const std::string& class_name, create_function_t create_function); 28 | std::LOG4CPP_UNIQUE_PTR create(const std::string& class_name, const params_t& params); 29 | bool registed(const std::string& class_name) const; 30 | 31 | private: 32 | LayoutsFactory(){}; 33 | 34 | typedef std::map creators_t; 35 | typedef creators_t::const_iterator const_iterator; 36 | 37 | creators_t creators_; 38 | }; 39 | } 40 | 41 | 42 | #endif // h_409ac787_0acf_47ff_ac15_3e9024d40315 43 | -------------------------------------------------------------------------------- /include/log4cpp/LevelEvaluator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_3491ecd0_3891_4902_b3ba_15b15d98ae49) 9 | #define h_3491ecd0_3891_4902_b3ba_15b15d98ae49 10 | 11 | #include 12 | 13 | namespace log4cpp 14 | { 15 | class LOG4CPP_EXPORT LevelEvaluator : public TriggeringEventEvaluator 16 | { 17 | public: 18 | LevelEvaluator(Priority::Value level) : level_(level) {} 19 | virtual bool eval(const LoggingEvent& event) const { return event.priority <= level_; } 20 | 21 | private: 22 | Priority::Value level_; 23 | }; 24 | } 25 | 26 | #endif // h_3491ecd0_3891_4902_b3ba_15b15d98ae49 27 | -------------------------------------------------------------------------------- /include/log4cpp/LoggingEvent.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * LoggingEvent.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_LOGGINGEVENT_HH 11 | #define _LOG4CPP_LOGGINGEVENT_HH 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | /** 20 | * The top level namespace for all 'Log for C++' types and classes. 21 | **/ 22 | namespace log4cpp { 23 | 24 | /** 25 | * The internal representation of logging events. When a affirmative 26 | * logging decision is made a LoggingEvent instance is 27 | * created. This instance is passed around the different log4cpp 28 | * components. 29 | * 30 | *

This class is of concern to those wishing to extend log4cpp. 31 | **/ 32 | struct LOG4CPP_EXPORT LoggingEvent { 33 | public: 34 | /** 35 | * Instantiate a LoggingEvent from the supplied parameters. 36 | * 37 | *

Except timeStamp all the other fields of 38 | * LoggingEvent are filled when actually needed. 39 | *

40 | * @param category The category of this event. 41 | * @param message The message of this event. 42 | * @param ndc The nested diagnostic context of this event. 43 | * @param priority The priority of this event. 44 | **/ 45 | LoggingEvent(const std::string& category, const std::string& message, 46 | const std::string& ndc, Priority::Value priority); 47 | 48 | 49 | /** The category name. */ 50 | const std::string categoryName; 51 | 52 | /** The application supplied message of logging event. */ 53 | const std::string message; 54 | 55 | /** The nested diagnostic context (NDC) of logging event. */ 56 | const std::string ndc; 57 | 58 | /** Priority of logging event. */ 59 | Priority::Value priority; 60 | 61 | /** The name of thread in which this logging event was generated, 62 | e.g. the PID. 63 | */ 64 | const std::string threadName; 65 | 66 | /** The number of seconds elapsed since the epoch 67 | (1/1/1970 00:00:00 UTC) until logging event was created. */ 68 | TimeStamp timeStamp; 69 | }; 70 | } 71 | 72 | #endif // _LOG4CPP_LOGGINGEVENT_HH 73 | 74 | -------------------------------------------------------------------------------- /include/log4cpp/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = threading 2 | 3 | liblog4cppincludedir = $(includedir)/log4cpp 4 | liblog4cppinclude_HEADERS = \ 5 | Appender.hh \ 6 | AppenderSkeleton.hh \ 7 | AppendersFactory.hh \ 8 | BufferingAppender.hh \ 9 | FactoryParams.hh \ 10 | LayoutsFactory.hh \ 11 | LevelEvaluator.hh \ 12 | PassThroughLayout.hh \ 13 | TriggeringEventEvaluator.hh \ 14 | TriggeringEventEvaluatorFactory.hh \ 15 | FixedContextCategory.hh \ 16 | LayoutAppender.hh \ 17 | FileAppender.hh \ 18 | DailyRollingFileAppender.hh \ 19 | RollingFileAppender.hh \ 20 | IdsaAppender.hh \ 21 | OstreamAppender.hh \ 22 | StringQueueAppender.hh \ 23 | SyslogAppender.hh \ 24 | RemoteSyslogAppender.hh \ 25 | Layout.hh \ 26 | SimpleLayout.hh \ 27 | BasicLayout.hh \ 28 | PatternLayout.hh \ 29 | Category.hh \ 30 | CategoryStream.hh \ 31 | HierarchyMaintainer.hh \ 32 | Configurator.hh \ 33 | BasicConfigurator.hh \ 34 | SimpleConfigurator.hh \ 35 | PropertyConfigurator.hh \ 36 | LoggingEvent.hh \ 37 | Priority.hh \ 38 | NDC.hh \ 39 | TimeStamp.hh \ 40 | Filter.hh \ 41 | Export.hh \ 42 | Portability.hh \ 43 | Win32DebugAppender.hh \ 44 | NTEventLogAppender.hh \ 45 | AbortAppender.hh \ 46 | Manipulator.hh \ 47 | config.h \ 48 | config-win32.h \ 49 | config-openvms.h \ 50 | config-MinGW32.h \ 51 | convenience.h 52 | 53 | dist-hook: 54 | $(RM) -f $(distdir)/config.h 55 | 56 | distclean-local: 57 | $(RM) config.h 58 | -------------------------------------------------------------------------------- /include/log4cpp/Manipulator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Manipulator.hh 3 | * 4 | * Copyright 2005, Francis ANDRE. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #ifndef _LOG4CPP_MANIPULATOR_HH 10 | #define _LOG4CPP_MANIPULATOR_HH 11 | 12 | #include 13 | #include 14 | namespace log4cpp { 15 | class LOG4CPP_EXPORT width { 16 | private: 17 | unsigned int size; 18 | public: 19 | inline width(unsigned int i) : size(i) {} 20 | friend LOG4CPP_EXPORT std::ostream& operator<< (std::ostream& os, const width& w); 21 | }; 22 | class LOG4CPP_EXPORT tab { 23 | private: 24 | unsigned int size; 25 | public: 26 | inline tab(unsigned int i) : size(i) {} 27 | friend LOG4CPP_EXPORT std::ostream& operator<< (std::ostream& os, const tab& w); 28 | }; 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /include/log4cpp/OstreamAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * OstreamAppender.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_OSTREAMAPPENDER_HH 11 | #define _LOG4CPP_OSTREAMAPPENDER_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace log4cpp { 19 | 20 | /** 21 | * OstreamAppender appends LoggingEvents to ostreams. 22 | **/ 23 | class LOG4CPP_EXPORT OstreamAppender : public LayoutAppender { 24 | public: 25 | OstreamAppender(const std::string& name, std::ostream* stream); 26 | virtual ~OstreamAppender(); 27 | 28 | virtual bool reopen(); 29 | virtual void close(); 30 | 31 | protected: 32 | virtual void _append(const LoggingEvent& event); 33 | 34 | std::ostream* _stream; 35 | }; 36 | } 37 | 38 | #endif // _LOG4CPP_OSTREAMAPPENDER_HH 39 | -------------------------------------------------------------------------------- /include/log4cpp/PassThroughLayout.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_8e4861a3_f607_479c_ac2d_0b2d81b4c36c) 9 | #define h_8e4861a3_f607_479c_ac2d_0b2d81b4c36c 10 | 11 | #include 12 | 13 | namespace log4cpp 14 | { 15 | class PassThroughLayout : public Layout 16 | { 17 | public: 18 | virtual std::string format(const LoggingEvent& event) { return event.message; } 19 | }; 20 | } 21 | 22 | #endif // h_8e4861a3_f607_479c_ac2d_0b2d81b4c36c 23 | -------------------------------------------------------------------------------- /include/log4cpp/Portability.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Portability.hh 3 | * 4 | * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2001, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_PORTABILITY_HH 11 | #define _LOG4CPP_PORTABILITY_HH 12 | 13 | #if defined (_MSC_VER) || defined(__BORLANDC__) 14 | # if defined (LOG4CPP_STLPORT_AND_BOOST_BUILD) 15 | # include 16 | # else 17 | # include 18 | # endif 19 | 20 | #ifdef MSVC_MEMORY_LEAK_CHECK 21 | #define _CRTDBG_MAP_ALLOC 22 | 23 | #include 24 | #include 25 | 26 | #ifdef _DEBUG 27 | #ifndef DBG_NEW 28 | #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) 29 | #define new DBG_NEW 30 | #endif 31 | #endif // _DEBUG 32 | #endif // MSVC_MEMORY_LEAK_CHECK 33 | 34 | #else 35 | #if defined(__OPENVMS__) 36 | # include 37 | #else 38 | # if defined(__MINGW32__) 39 | # include 40 | # else 41 | # include 42 | # endif 43 | #endif 44 | #endif 45 | 46 | #include 47 | 48 | #if defined(_MSC_VER) 49 | # pragma warning( disable : 4786 ) // 255 char debug symbol limit 50 | # pragma warning( disable : 4290 ) // throw specifier not implemented 51 | # pragma warning( disable : 4251 ) // "class XXX should be exported" 52 | #endif 53 | 54 | #ifdef __APPLE__ 55 | # include 56 | #else 57 | # ifndef LOG4CPP_HAVE_SSTREAM 58 | # include 59 | namespace std { 60 | class LOG4CPP_EXPORT ostringstream : public ostrstream { 61 | public: 62 | std::string str(); 63 | }; 64 | }; 65 | # endif // LOG4CPP_HAVE_SSTREAM 66 | #endif // _APPLE_ 67 | 68 | // Support both modern and deprecated compilers, supplying different c++language constructs via macros 69 | #if defined(__cplusplus) && (__cplusplus >= 201103L) 70 | #define LOG4CPP_UNIQUE_PTR unique_ptr 71 | #define LOG4CPP_UNIQUE_PTR_MOVE(ptr) std::move(ptr) 72 | #else 73 | #define LOG4CPP_UNIQUE_PTR auto_ptr 74 | #define LOG4CPP_UNIQUE_PTR_MOVE(ptr) ptr 75 | #endif //__cplusplus 76 | 77 | #if defined(__cplusplus) && (__cplusplus >= 201703L) 78 | #define LOG4CPP_NOTHROW noexcept 79 | #else 80 | #define LOG4CPP_NOTHROW throw() 81 | #endif //__cplusplus 82 | 83 | #endif //_LOG4CPP_PORTABILITY_HH 84 | -------------------------------------------------------------------------------- /include/log4cpp/PropertyConfigurator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * SimpleConfigurator.hh 3 | * 4 | * Copyright 2001, Glen Scott. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #ifndef _LOG4CPP_PROPERTYCONFIGURATOR_HH 9 | #define _LOG4CPP_PROPERTYCONFIGURATOR_HH 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include // configure exceptions 16 | 17 | namespace log4cpp { 18 | 19 | /** 20 | Property configurator will read a config file using the same (or similar) 21 | format to the config file used by log4j. This file is in a standard Java 22 | "properties" file format. 23 |

Example:
24 |

25 |        # a simple test config
26 | 
27 |        log4j.rootCategory=DEBUG, rootAppender
28 |        log4j.category.sub1=A1
29 |        log4j.category.sub2=INFO
30 |        log4j.category.sub1.sub2=ERROR, A2
31 |        
32 |        log4j.appender.rootAppender=org.apache.log4j.ConsoleAppender
33 |        log4j.appender.rootAppender.layout=org.apache.log4j.BasicLayout
34 |        
35 |        log4j.appender.A1=org.apache.log4j.FileAppender
36 |        log4j.appender.A1.fileName=A1.log
37 |        log4j.appender.A1.layout=org.apache.log4j.BasicLayout
38 |        
39 |        log4j.appender.A2=org.apache.log4j.ConsoleAppender
40 |        log4j.appender.A2.layout=org.apache.log4j.PatternLayout
41 |        log4j.appender.A2.layout.ConversionPattern=The message %%m at time %%d%%n
42 |        
43 | 44 | @since 0.3.2 45 | **/ 46 | class LOG4CPP_EXPORT PropertyConfigurator { 47 | public: 48 | /** 49 | * 50 | * @param initFileName 51 | * @exception ConfigureFailure if the method encountered a read or 52 | * syntax error. 53 | */ 54 | static void configure(const std::string& initFileName); 55 | }; 56 | } 57 | 58 | #endif // _LOG4CPP_PROPERTYCONFIGURATOR_HH 59 | -------------------------------------------------------------------------------- /include/log4cpp/RollingFileAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * RollingFileAppender.hh 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #ifndef _LOG4CPP_ROLLINGFILEAPPENDER_HH 8 | #define _LOG4CPP_ROLLINGFILEAPPENDER_HH 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace log4cpp { 16 | 17 | /** 18 | RollingFileAppender is a FileAppender that rolls over the logfile once 19 | it has reached a certain size limit. 20 | @since 0.3.1 21 | **/ 22 | class LOG4CPP_EXPORT RollingFileAppender : public FileAppender { 23 | public: 24 | RollingFileAppender(const std::string& name, 25 | const std::string& fileName, 26 | size_t maxFileSize = 10*1024*1024, 27 | unsigned int maxBackupIndex = 1, 28 | bool append = true, 29 | mode_t mode = 00644); 30 | 31 | virtual void setMaxBackupIndex(unsigned int maxBackups); 32 | virtual unsigned int getMaxBackupIndex() const; 33 | virtual void setMaximumFileSize(size_t maxFileSize); 34 | virtual size_t getMaxFileSize() const; 35 | 36 | virtual void rollOver(); 37 | 38 | protected: 39 | virtual void _append(const LoggingEvent& event); 40 | 41 | unsigned int _maxBackupIndex; 42 | unsigned short int _maxBackupIndexWidth; // keep constant index width by zeroing leading positions 43 | 44 | size_t _maxFileSize; 45 | }; 46 | } 47 | 48 | #endif // _LOG4CPP_ROLLINGFILEAPPENDER_HH 49 | -------------------------------------------------------------------------------- /include/log4cpp/SimpleConfigurator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * SimpleConfigurator.hh 3 | * 4 | * Copyright 2001, Glen Scott. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #ifndef _LOG4CPP_SIMPLECONFIGURATOR_HH 9 | #define _LOG4CPP_SIMPLECONFIGURATOR_HH 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | /** 19 | * This class implements a simple Configurator for log4cpp. 20 | * It is a temporary hack with an undocumented configuration format. 21 | * @deprecated As of version 0.3.2 log4cpp includes a log4j format 22 | * compatible PropertyConfigurator, removing the need for 23 | * SimpleConfigurator. This class will be removed in 0.4.0. 24 | **/ 25 | class LOG4CPP_EXPORT SimpleConfigurator { 26 | public: 27 | 28 | /** 29 | * Configure log4cpp with the configuration in the given file. 30 | * NB. The configuration file format is undocumented and may change 31 | * without notice. 32 | * @since 0.2.6 33 | * @param initFileName name of the configuration file 34 | * @exception ConfigureFailure if the method encountered a read or 35 | * syntax error. 36 | **/ 37 | static void configure(const std::string& initFileName); 38 | 39 | /** 40 | * Configure log4cpp with the configuration in the given file. 41 | * NB. The configuration file format is undocumented and may change 42 | * without notice. 43 | * @since 0.3.1 44 | * @param initFile an input stream to the configuration file 45 | * @exception ConfigureFailure if the method encountered a read or 46 | * syntax error. 47 | **/ 48 | static void configure(std::istream& initFile); 49 | }; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/log4cpp/SimpleLayout.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * SimpleLayout.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_SIMPLELAYOUT_HH 11 | #define _LOG4CPP_SIMPLELAYOUT_HH 12 | 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | /** 19 | * BasicLayout is a simple fixed format Layout implementation. 20 | **/ 21 | class LOG4CPP_EXPORT SimpleLayout : public Layout { 22 | public: 23 | SimpleLayout(); 24 | virtual ~SimpleLayout(); 25 | 26 | /** 27 | * Formats the LoggingEvent in SimpleLayout style:
28 | * "priority - message" 29 | **/ 30 | virtual std::string format(const LoggingEvent& event); 31 | }; 32 | } 33 | 34 | #endif // _LOG4CPP_SIMPLELAYOUT_HH 35 | -------------------------------------------------------------------------------- /include/log4cpp/SmtpAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_2c5af17f_8daf_418f_acb8_5cfce724ec1a) 9 | #define h_2c5af17f_8daf_418f_acb8_5cfce724ec1a 10 | 11 | #if defined(LOG4CPP_HAVE_BOOST) 12 | #include 13 | #if BOOST_VERSION > 103400 14 | 15 | #include "Portability.hh" 16 | #include "LayoutAppender.hh" 17 | 18 | namespace log4cpp 19 | { 20 | class LOG4CPP_EXPORT SmptAppender : public LayoutAppender 21 | { 22 | public: 23 | struct mail_params; 24 | 25 | SmptAppender(const std::string& name, const std::string& host, const std::string& from, 26 | const std::string& to, const std::string& subject); 27 | virtual ~SmptAppender(); 28 | virtual void close() { } 29 | 30 | protected: 31 | virtual void _append(const LoggingEvent& event); 32 | 33 | private: 34 | mail_params * mail_params_; 35 | }; 36 | } 37 | 38 | #endif // BOOST_VERSION >= 103400 39 | #endif // LOG4CPP_HAS_BOOST 40 | #endif // h_2c5af17f_8daf_418f_acb8_5cfce724ec1a 41 | -------------------------------------------------------------------------------- /include/log4cpp/StringQueueAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * StringQueueAppender.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_STRINGQUEUEAPPENDER_HH 11 | #define _LOG4CPP_STRINGQUEUEAPPENDER_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace log4cpp { 19 | 20 | /** 21 | * This class puts log messages in an in-memory queue. Its primary use 22 | * is in test cases, but it may be useful elsewhere as well. 23 | * 24 | * @since 0.2.4 25 | **/ 26 | class LOG4CPP_EXPORT StringQueueAppender : public LayoutAppender { 27 | public: 28 | 29 | StringQueueAppender(const std::string& name); 30 | virtual ~StringQueueAppender(); 31 | 32 | virtual bool reopen(); 33 | virtual void close(); 34 | 35 | /** 36 | * Return the current size of the message queue. 37 | * Shorthand for getQueue().size(). 38 | * @returns the queue size 39 | **/ 40 | virtual size_t queueSize() const; 41 | 42 | /** 43 | * Return the queue to which the Appends adds messages. 44 | * @returns the message queue 45 | **/ 46 | virtual std::queue& getQueue(); 47 | 48 | /** 49 | * Return the queue to which the Appends adds messages. 50 | * @returns the message queue 51 | **/ 52 | virtual const std::queue& getQueue() const; 53 | 54 | /** 55 | * Pop the oldest log message from the front of the queue. 56 | * @returns the oldest log message 57 | **/ 58 | virtual std::string popMessage(); 59 | 60 | protected: 61 | 62 | /** 63 | * Appends the LoggingEvent to the queue. 64 | * @param event the LoggingEvent to layout and append to the queue. 65 | **/ 66 | virtual void _append(const LoggingEvent& event); 67 | 68 | std::queue _queue; 69 | }; 70 | } 71 | 72 | #endif // _LOG4CPP_STRINGQUEUEAPPENDER_HH 73 | -------------------------------------------------------------------------------- /include/log4cpp/SyslogAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * SyslogAppender.hh 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_SYSLOGAPPENDER_HH 11 | #define _LOG4CPP_SYSLOGAPPENDER_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace log4cpp { 21 | 22 | /** 23 | * SyslogAppender sends LoggingEvents to the local syslog system. 24 | **/ 25 | class SyslogAppender : public LayoutAppender { 26 | public: 27 | 28 | /** 29 | * Translates a log4cpp priority to a syslog priority 30 | * @param priority The log4cpp priority. 31 | * @returns the syslog priority. 32 | **/ 33 | static int toSyslogPriority(Priority::Value priority); 34 | 35 | /** 36 | * Instantiate a SyslogAppender with given name and name and facility 37 | * for syslog. Note that the C syslog API is process global, so 38 | * instantion of a second SyslogAppender will 'overwrite' the 39 | * syslog name of the first. 40 | * @param name The name of the Appender 41 | * @param syslogName The ident parameter in the openlog(3) call. 42 | * @param facility The syslog facility to log to. Defaults to LOG_USER. 43 | **/ 44 | SyslogAppender(const std::string& name, const std::string& syslogName, 45 | int facility = LOG_USER); 46 | virtual ~SyslogAppender(); 47 | 48 | /** 49 | * Calls closelog(3) and openlog(3). 50 | **/ 51 | virtual bool reopen(); 52 | 53 | /** 54 | * Calls closelog(3) to close the syslog file descriptor. 55 | **/ 56 | virtual void close(); 57 | 58 | protected: 59 | 60 | /** 61 | * Calls openlog(3). 62 | **/ 63 | virtual void open(); 64 | 65 | /** 66 | * Sends a LoggingEvent to syslog. 67 | * @param event the LoggingEvent to log. 68 | **/ 69 | virtual void _append(const LoggingEvent& event); 70 | 71 | const std::string _syslogName; 72 | int _facility; 73 | }; 74 | } 75 | 76 | #endif // _LOG4CPP_SYSLOGAPPENDER_HH 77 | -------------------------------------------------------------------------------- /include/log4cpp/TimeStamp.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeStamp.hh 3 | * 4 | * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2001, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_TIMESTAMP_HH 11 | #define _LOG4CPP_TIMESTAMP_HH 12 | 13 | #include 14 | 15 | namespace log4cpp { 16 | 17 | /** 18 | * A simple TimeStamp abstraction 19 | **/ 20 | class LOG4CPP_EXPORT TimeStamp { 21 | public: 22 | /** 23 | Constructs a TimeStamp representing 'now'. 24 | **/ 25 | TimeStamp(); 26 | 27 | /** 28 | Constructs a TimeStamp representing the given offset since the 29 | epoch ( 00:00:00 1970/1/1 UTC). 30 | **/ 31 | TimeStamp(unsigned int seconds, unsigned int microSeconds = 0); 32 | 33 | /** 34 | Returns the 'seconds' part of the TimeStamp. 35 | **/ 36 | inline int getSeconds() const { 37 | return _seconds; 38 | }; 39 | 40 | /** 41 | Returns the 'subseconds' part of the TimeStamp in milliseconds, 42 | getMilliSeconds() == getMicroSeconds() / 1000. 43 | **/ 44 | inline int getMilliSeconds() const { 45 | return _microSeconds / 1000; 46 | }; 47 | 48 | /** 49 | Returns the subsecond part of the TimeStamp in microseconds. 50 | The actual precision of this value depends on the platform and 51 | may be in the order of milliseconds rather than microseconds. 52 | **/ 53 | inline int getMicroSeconds() const { 54 | return _microSeconds; 55 | }; 56 | 57 | /** 58 | Returns a TimeStamp representing the time at which the application 59 | started. 60 | **/ 61 | static inline const TimeStamp& getStartTime() { 62 | return _startStamp; 63 | }; 64 | 65 | protected: 66 | static TimeStamp _startStamp; 67 | 68 | int _seconds; 69 | int _microSeconds; 70 | }; 71 | } 72 | 73 | #endif // _LOG4CPP_TIMESTAMP_HH 74 | 75 | -------------------------------------------------------------------------------- /include/log4cpp/TriggeringEventEvaluator.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_fb88639f_85c9_481a_a3a0_f25ae8bac24c) 9 | #define h_fb88639f_85c9_481a_a3a0_f25ae8bac24c 10 | 11 | #include 12 | 13 | namespace log4cpp 14 | { 15 | class LOG4CPP_EXPORT TriggeringEventEvaluator 16 | { 17 | public: 18 | virtual bool eval(const LoggingEvent& event) const = 0; 19 | virtual ~TriggeringEventEvaluator() {} 20 | }; 21 | } 22 | 23 | #endif // h_fb88639f_85c9_481a_a3a0_f25ae8bac24c 24 | -------------------------------------------------------------------------------- /include/log4cpp/TriggeringEventEvaluatorFactory.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #if !defined(h_dd233b8b_5c59_4956_9393_6581c95f9779) 9 | #define h_dd233b8b_5c59_4956_9393_6581c95f9779 10 | 11 | #include 12 | #include 13 | #include 14 | #include "Portability.hh" 15 | #include "TriggeringEventEvaluator.hh" 16 | #include "FactoryParams.hh" 17 | 18 | namespace log4cpp 19 | { 20 | class LOG4CPP_EXPORT TriggeringEventEvaluatorFactory 21 | { 22 | public: 23 | typedef FactoryParams params_t; 24 | typedef std::LOG4CPP_UNIQUE_PTR (*create_function_t)(const params_t& params); 25 | 26 | static TriggeringEventEvaluatorFactory& getInstance(); 27 | void registerCreator(const std::string& class_name, create_function_t create_function); 28 | std::LOG4CPP_UNIQUE_PTR create(const std::string& class_name, const params_t& params); 29 | bool registered(const std::string& class_name) const; 30 | 31 | private: 32 | TriggeringEventEvaluatorFactory(){}; 33 | 34 | typedef std::map creators_t; 35 | typedef creators_t::const_iterator const_iterator; 36 | 37 | creators_t creators_; 38 | }; 39 | } 40 | 41 | #endif // h_dd233b8b_5c59_4956_9393_6581c95f9779 42 | -------------------------------------------------------------------------------- /include/log4cpp/Win32DebugAppender.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Win32DebugAppender.hh 3 | * 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #ifndef _LOG4CPP_WIN32DEBUGAPPENDER_HH 9 | #define _LOG4CPP_WIN32DEBUGAPPENDER_HH 10 | 11 | #ifdef WIN32 // only use this on Win32 12 | 13 | #include 14 | #include "log4cpp/Export.hh" 15 | #include "log4cpp/LayoutAppender.hh" 16 | 17 | namespace log4cpp { 18 | 19 | /** 20 | * Win32DebugAppender simply sends the log message to the default system 21 | * debugger on Win32 systems. This is useful for users of MSVC and Borland 22 | * because the log messages will show up in the debugger window.
23 | * NB: This class is only available on Win32 platforms. 24 | */ 25 | class LOG4CPP_EXPORT Win32DebugAppender : public LayoutAppender { 26 | public: 27 | /** 28 | * Constructor. 29 | * @param name Name used by the base classes only. 30 | */ 31 | Win32DebugAppender(const std::string& name); 32 | /** 33 | * Destructor. 34 | */ 35 | virtual ~Win32DebugAppender(); 36 | 37 | /** 38 | * Close method. This is called by the framework, but there is nothing 39 | * to do for the OutputDebugString API, so it simply returns. 40 | */ 41 | virtual void close(); 42 | 43 | protected: 44 | /** 45 | * Method that does the actual work. In this case, it simply sets up the layout 46 | * and calls the OutputDebugString API. 47 | * @param event Event for which we are logging. 48 | */ 49 | virtual void _append(const LoggingEvent& event); 50 | }; 51 | } 52 | 53 | #else // WIN32 54 | #error NTEventLoggAppender is not available on on Win32 platforms 55 | #endif // WIN32 56 | 57 | #endif // _LOG4CPP_WIN32DEBUGAPPENDER_HH 58 | -------------------------------------------------------------------------------- /include/log4cpp/config-MinGW32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #ifndef _INCLUDE_LOG4CPP_CONFIG_MINGW32_H 9 | #define _INCLUDE_LOG4CPP_CONFIG_MINGW32_H 1 10 | 11 | /* manually edited from include/log4cpp/config.h */ 12 | 13 | /* Define if you have the syslog function. */ 14 | /* #undef LOG4CPP_HAVE_SYSLOG */ 15 | 16 | /* Define if you have the `ftime' function. */ 17 | #ifndef LOG4CPP_HAVE_FTIME 18 | #define LOG4CPP_HAVE_FTIME 1 19 | #endif 20 | 21 | /* Define if you have the `gettimeofday' function. */ 22 | /* #undef LOG4CPP_HAVE_GETTIMEOFDAY */ 23 | 24 | /* define if the compiler has int64_t */ 25 | #ifndef LOG4CPP_HAVE_INT64_T 26 | #define LOG4CPP_HAVE_INT64_T 27 | #define int64_t __int64 28 | 29 | /* define if the compiler has in_addr_t */ 30 | #ifndef LOG4CPP_HAVE_IN_ADDR_T 31 | #define LOG4CPP_HAVE_IN_ADDR_T 32 | 33 | #ifndef u_long 34 | typedef unsigned long u_long; 35 | #endif 36 | 37 | /* u_long is the type of in_addr.s_addr */ 38 | typedef u_long in_addr_t; 39 | 40 | /* u_short is the type of sockaddr_in.sin_port */ 41 | // typedef u_short in_port_t; 42 | 43 | #endif 44 | 45 | #endif 46 | 47 | /* Define if you have the header file. */ 48 | #ifndef LOG4CPP_HAVE_IO_H 49 | #define LOG4CPP_HAVE_IO_H 1 50 | #endif 51 | 52 | /* Define if you have the header file. */ 53 | /* #undef LOG4CPP_HAVE_UNISTD_H */ 54 | 55 | /* Define if you have the idsa library (-lidsa). */ 56 | /* #undef LOG4CPP_HAVE_LIBIDSA */ 57 | 58 | /* Define if you have the `strcasecmp' function. */ 59 | /* #undef LOG4CPP_HAVE_STRCASECMP */ 60 | 61 | /* Name of package */ 62 | #ifndef LOG4CPP_PACKAGE 63 | #define LOG4CPP_PACKAGE "log4cpp" 64 | #endif 65 | 66 | /* Version number of package */ 67 | #ifndef LOG4CPP_VERSION 68 | #define LOG4CPP_VERSION "1.0" 69 | #endif 70 | 71 | /* define if the compiler implements namespaces */ 72 | #ifndef LOG4CPP_HAVE_NAMESPACES 73 | #define LOG4CPP_HAVE_NAMESPACES 1 74 | #endif 75 | 76 | /* define if the compiler has stringstream */ 77 | #ifndef LOG4CPP_HAVE_SSTREAM 78 | #define LOG4CPP_HAVE_SSTREAM 1 79 | #endif 80 | 81 | #define LOG4CPP_HAS_WCHAR_T 0 82 | 83 | /* define if the C library has snprintf */ 84 | #ifndef LOG4CPP_HAVE_SNPRINTF 85 | #define LOG4CPP_HAVE_SNPRINTF 1 86 | #endif 87 | 88 | //#define LOG4CPP_HAVE_LOCALTIME_R 0 89 | 90 | /* define to get around problems with ERROR in windows.h */ 91 | #ifndef LOG4CPP_FIX_ERROR_COLLISION 92 | #define LOG4CPP_FIX_ERROR_COLLISION 1 93 | #endif 94 | 95 | /* use threads */ 96 | #ifndef LOG4CPP_HAVE_THREADING 97 | #define LOG4CPP_HAVE_THREADING 98 | # if defined(LOG4CPP_STLPORT_AND_BOOST_BUILD) 99 | # define LOG4CPP_USE_BOOSTTHREADS 100 | # else 101 | # define LOG4CPP_USE_MSTHREADS 102 | # endif 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /include/log4cpp/config-openvms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 3 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 4 | * 5 | * See the COPYING file for the terms of usage and distribution. 6 | */ 7 | 8 | #ifndef _INCLUDE_LOG4CPP_CONFIG_OPENVMS_H 9 | #define _INCLUDE_LOG4CPP_CONFIG_OPENVMS_H 1 10 | 11 | /* include/log4cpp/config.h. Generated automatically at end of configure. */ 12 | /* include/config.h. Generated automatically by configure. */ 13 | /* include/config.h.in. Generated automatically from configure.in by autoheader. */ 14 | 15 | /* Define if you have the header file. */ 16 | #ifndef LOG4CPP_HAVE_DLFCN_H 17 | #define LOG4CPP_HAVE_DLFCN_H 1 18 | #endif 19 | 20 | /* Define if you have the `ftime' function. */ 21 | #ifndef LOG4CPP_HAVE_FTIME 22 | #define LOG4CPP_HAVE_FTIME 1 23 | #endif 24 | 25 | /* Define if you have the `gettimeofday' function. */ 26 | #ifndef LOG4CPP_HAVE_GETTIMEOFDAY 27 | #define LOG4CPP_HAVE_GETTIMEOFDAY 1 28 | #endif 29 | 30 | /* define if the compiler has int64_t */ 31 | #ifndef LOG4CPP_HAVE_INT64_T 32 | #define LOG4CPP_HAVE_INT64_T 33 | #include 34 | #endif 35 | 36 | /* Define if you have the header file. */ 37 | /* #undef LOG4CPP_HAVE_IO_H */ 38 | 39 | /* Define if you have the `idsa' library (-lidsa). */ 40 | /* #undef LOG4CPP_HAVE_LIBIDSA */ 41 | 42 | /* define if the compiler implements namespaces */ 43 | #ifndef LOG4CPP_HAVE_NAMESPACES 44 | #define LOG4CPP_HAVE_NAMESPACES 45 | #endif 46 | 47 | /* define if the C library has snprintf */ 48 | /* #undef LOG4CPP_HAVE_SNPRINTF */ 49 | 50 | /* define if the compiler has stringstream */ 51 | #ifndef LOG4CPP_HAVE_SSTREAM 52 | #define LOG4CPP_HAVE_SSTREAM 53 | #endif 54 | 55 | /* Define if you have the `syslog' function. */ 56 | /* #undef LOG4CPP_HAVE_SYSLOG */ 57 | 58 | /* Define if you have the header file. */ 59 | #ifndef LOG4CPP_HAVE_UNISTD_H 60 | #define LOG4CPP_HAVE_UNISTD_H 1 61 | #endif 62 | 63 | /* Name of package */ 64 | #ifndef LOG4CPP_PACKAGE 65 | #define LOG4CPP_PACKAGE "log4cpp" 66 | #endif 67 | 68 | /* Version number of package */ 69 | #ifndef LOG4CPP_VERSION 70 | #define LOG4CPP_VERSION "1.0" 71 | #endif 72 | 73 | /* _INCLUDE_LOG4CPP_CONFIG_OPENVMS_H */ 74 | #endif 75 | -------------------------------------------------------------------------------- /include/log4cpp/config-win32.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/include/log4cpp/config-win32.h -------------------------------------------------------------------------------- /include/log4cpp/threading/BoostThreads.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * BoostThreads.hh 3 | * 4 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_THREADING_BOOSTTHREADS_HH 11 | #define _LOG4CPP_THREADING_BOOSTTHREADS_HH 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace log4cpp { 21 | namespace threading { 22 | static std::string getThreadId() { 23 | char buffer[14]; 24 | // Boost.Threads stores the thread ID but doesn't expose it 25 | sprintf(buffer, "not available"); 26 | return std::string(buffer); 27 | }; 28 | 29 | typedef boost::mutex Mutex; 30 | typedef boost::mutex::scoped_lock ScopedLock; 31 | 32 | template class ThreadLocalDataHolder { 33 | public: 34 | inline T* get() const { 35 | return _localData.get(); 36 | }; 37 | 38 | inline T* operator->() const { return _localData.get(); }; 39 | inline T& operator*() const { return *_localData.get(); }; 40 | 41 | inline T* release() { 42 | return _localData.release(); 43 | }; 44 | 45 | inline void reset(T* p = NULL) { 46 | _localData.reset(p); 47 | }; 48 | 49 | private: 50 | boost::thread_specific_ptr _localData; 51 | }; 52 | 53 | } 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /include/log4cpp/threading/DummyThreads.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * DummyThreads.hh 3 | * 4 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_THREADING_DUMMYTHREADS_HH 11 | #define _LOG4CPP_THREADING_DUMMYTHREADS_HH 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace log4cpp { 18 | namespace threading { 19 | std::string getThreadId(); 20 | 21 | /** 22 | Dummy type 'int' for Mutex. Yes, this adds a bit of overhead in 23 | the for of extra memory, but unfortunately 'void' is illegal. 24 | **/ 25 | typedef int Mutex; 26 | 27 | /** 28 | Dummy type 'int' defintion of ScopedLock; 29 | **/ 30 | typedef int ScopedLock; 31 | 32 | template class ThreadLocalDataHolder { 33 | public: 34 | typedef T data_type; 35 | 36 | inline ThreadLocalDataHolder() {}; 37 | inline ~ThreadLocalDataHolder() { 38 | if (_data) 39 | delete _data; 40 | }; 41 | 42 | inline T* get() const { 43 | return _data; 44 | }; 45 | 46 | inline T* operator->() const { return get(); }; 47 | inline T& operator*() const { return *get(); }; 48 | 49 | inline T* release() { 50 | T* result = _data; 51 | _data = NULL; 52 | 53 | return result; 54 | }; 55 | 56 | inline void reset(T* p = NULL) { 57 | if (_data) 58 | delete _data; 59 | _data = p; 60 | }; 61 | 62 | private: 63 | T* _data; 64 | }; 65 | } 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /include/log4cpp/threading/Makefile.am: -------------------------------------------------------------------------------- 1 | liblog4cppincludedir = $(includedir)/log4cpp/threading 2 | liblog4cppinclude_HEADERS = \ 3 | BoostThreads.hh \ 4 | DummyThreads.hh \ 5 | OmniThreads.hh \ 6 | PThreads.hh \ 7 | MSThreads.hh \ 8 | Threading.hh 9 | -------------------------------------------------------------------------------- /include/log4cpp/threading/Threading.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Threading.hh 3 | * 4 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifndef _LOG4CPP_THREADING_THREADING_HH 11 | #define _LOG4CPP_THREADING_THREADING_HH 12 | 13 | #include 14 | 15 | #ifdef LOG4CPP_HAVE_THREADING 16 | 17 | #ifdef LOG4CPP_USE_OMNITHREADS 18 | #include 19 | #endif 20 | 21 | #ifdef LOG4CPP_USE_BOOSTTHREADS 22 | #include 23 | #endif 24 | 25 | #ifdef LOG4CPP_USE_MSTHREADS 26 | #include 27 | #endif 28 | 29 | #ifdef LOG4CPP_USE_PTHREADS 30 | #include 31 | #endif 32 | 33 | #else /* LOG4CPP_HAVE_THREADING */ 34 | #include 35 | #endif /* LOG4CPP_HAVE_THREADING */ 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /jamfile: -------------------------------------------------------------------------------- 1 | project log4cpp ; 2 | 3 | alias sockets : : gcc ; 4 | lib sockets : : ws2_32 gcc NT ; 5 | lib sockets : : ws2_32.lib msvc ; 6 | lib sockets : : ws2_32.lib borland ; 7 | 8 | lib registry : : Advapi32.lib msvc ; 9 | lib registry : : Advapi32.lib borland ; 10 | alias registry : : gcc ; 11 | 12 | lib log4cpp : [ glob src/*.cpp ] 13 | sockets 14 | registry 15 | : 16 | include 17 | debug:_DEBUG 18 | msvc:WIN32 19 | borland:WIN32 20 | shared:LOG4CPP_HAS_DLL 21 | shared:LOG4CPP_BUILD_DLL 22 | : 23 | : 24 | include 25 | shared:LOG4CPP_HAS_DLL 26 | ; 27 | -------------------------------------------------------------------------------- /log4cpp-1.1.5rc1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/log4cpp-1.1.5rc1.tar.gz -------------------------------------------------------------------------------- /log4cpp.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE@ 7 | Description: C++ library for flexible logging, modeled after Log4j 8 | Version: @VERSION@ 9 | Libs: -L${libdir} @log4cpp_libs@ 10 | Cflags: -I${includedir} @log4cpp_cflags@ 11 | -------------------------------------------------------------------------------- /m4/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | 4 | -------------------------------------------------------------------------------- /m4/AC_CXX_HAVE_SSTREAM.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_CXX_HAVE_SSTREAM 2 | dnl 3 | dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. 4 | dnl 5 | dnl @author Ben Stanley 6 | dnl @version $Id$ 7 | dnl 8 | AC_DEFUN([AC_CXX_HAVE_SSTREAM], 9 | [AC_CACHE_CHECK(whether the compiler has stringstream, 10 | ac_cv_cxx_have_sstream, 11 | [AC_REQUIRE([AC_CXX_NAMESPACES]) 12 | AC_LANG_PUSH(C++) 13 | AC_TRY_COMPILE([#include 14 | #ifdef HAVE_NAMESPACES 15 | using namespace std; 16 | #endif],[stringstream message; message << "Hello"; return 0;], 17 | ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no) 18 | AC_LANG_POP(C++) 19 | ]) 20 | if test "$ac_cv_cxx_have_sstream" = yes; then 21 | AC_DEFINE(HAVE_SSTREAM,,[define if the compiler has stringstream]) 22 | fi 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/AC_CXX_NAMESPACES.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_CXX_NAMESPACES 2 | dnl 3 | dnl If the compiler can prevent names clashes using namespaces, define 4 | dnl HAVE_NAMESPACES. 5 | dnl 6 | dnl @version $Id$ 7 | dnl @author Luc Maisonobe 8 | dnl 9 | AC_DEFUN([AC_CXX_NAMESPACES], 10 | [AC_CACHE_CHECK(whether the compiler implements namespaces, 11 | ac_cv_cxx_namespaces, 12 | [AC_LANG_PUSH(C++) 13 | AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], 14 | [using namespace Outer::Inner; return i;], 15 | ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) 16 | AC_LANG_POP(C++) 17 | ]) 18 | if test "$ac_cv_cxx_namespaces" = yes; then 19 | AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) 20 | fi 21 | ]) 22 | -------------------------------------------------------------------------------- /m4/AC_C_INT64_T.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_C_INT64_T 2 | dnl 3 | dnl Provides a test for the existance of the int64_t type and 4 | dnl defines HAVE_INT64_T if it is found. Adapted from AC_C_LONG_LONG by 5 | dnl Caolan McNamara 6 | dnl 7 | dnl @version $Id$ 8 | dnl @author Bastiaan Bakker 9 | dnl 10 | AC_DEFUN([AC_C_INT64_T], 11 | [AC_CACHE_CHECK(for int64_t, ac_cv_c_int64_t, 12 | [AC_TRY_COMPILE([#include ],[int64_t i;], ac_cv_c_int64_t=yes, ac_cv_c_int64_t=no) 13 | ]) 14 | if test $ac_cv_c_int64_t = yes; then 15 | AC_DEFINE(HAVE_INT64_T,,[define if the compiler has int64_t]) 16 | AC_DEFINE(HAVE_STDINT_H,,[define if you have the header file.]) 17 | fi 18 | ]) 19 | 20 | -------------------------------------------------------------------------------- /m4/AC_FUNC_SNPRINTF.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_FUNC_SNPRINTF 2 | dnl 3 | dnl Provides a test for a working snprintf function. 4 | dnl unlike the original AC_FUNC_SNPRINTF test this one will also 5 | dnl accept snprintf implementations which return -1 if the string does 6 | dnl not fit in the buffer, e.g. snprintf on Solaris and glibc <= 2.0.6. 7 | dnl defines HAVE_SNPRINTF if it is found, and 8 | dnl sets ac_cv_func_snprintf to yes, otherwise to no. 9 | dnl 10 | dnl @version $Id$ 11 | dnl @author Caolan McNamara 12 | dnl 13 | AC_DEFUN([AC_FUNC_SNPRINTF], 14 | [AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf, 15 | [AC_TRY_RUN([#include 16 | int main () { int l = snprintf(NULL,0,"%d",100); return !((3 <= l) || (-1 == l)); } 17 | ], ac_cv_func_snprintf=yes, ac_cv_func_snprintf=no, 18 | ac_cv_func_snprintf=no)]) 19 | if test $ac_cv_func_snprintf = yes; then 20 | AC_DEFINE(HAVE_SNPRINTF,,[define if the C library has snprintf]) 21 | fi 22 | ]) 23 | -------------------------------------------------------------------------------- /m4/BB_CHECK_OMNITHREADS.m4: -------------------------------------------------------------------------------- 1 | dnl@synposis BB_CHECK_OMNITHREADS.m4 2 | dnl 3 | AC_DEFUN([BB_CHECK_OMNITHREADS],[ 4 | AC_REQUIRE([AC_PROG_CC])dnl 5 | AC_REQUIRE([AC_PROG_CXX])dnl 6 | AC_REQUIRE([AC_PROG_CPP])dnl 7 | AC_REQUIRE([AC_PROG_CXXCPP])dnl 8 | 9 | 10 | AC_ARG_WITH(omnithreads, [ --with-omnithreads include omnithreads support], [OMNIDIR=${with_omnithreads}], [OMNIDIR=no]) 11 | 12 | if test "x$OMNIDIR" = "xyes"; then 13 | OMNIDIR=/usr 14 | fi 15 | 16 | if test "x$OMNIDIR" = "x"; then 17 | OMNIDIR=no 18 | fi 19 | 20 | if test "x$OMNIDIR" != "xno"; then 21 | case $host_cpu in 22 | sparc*) 23 | OMNIDEFINES=-D__sparc__ 24 | ;; 25 | i386) 26 | OMNIDEFINES=-D__x86__ 27 | ;; 28 | i486) 29 | OMNIDEFINES=-D__x86__ 30 | ;; 31 | i586) 32 | OMNIDEFINES=-D__x86__ 33 | ;; 34 | i686) 35 | OMNIDEFINES=-D__x86__ 36 | ;; 37 | *) 38 | AC_MSG_ERROR([unknown CPU: $host_cpu]) 39 | ;; 40 | esac 41 | 42 | case $host_os in 43 | solaris*) 44 | OMNIDEFINES="$OMNIDEFINES -D__sunos__ -D__OSVERSION__=5" 45 | ;; 46 | linux*) 47 | OMNIDEFINES="$OMNIDEFINES -D__linux__ -D__OSVERSION__=2" 48 | ;; 49 | *) 50 | AC_MSG_ERROR([unknown OS: $host_os]) 51 | ;; 52 | esac 53 | 54 | CPPFLAGS="$CPPFLAGS -D_PTHREADS -D_REENTRANT -D_THREAD_SAFE" 55 | CFLAGS="$CFLAGS $OMNIDEFINES -I$OMNIDIR/include" 56 | CXXFLAGS="$CXXCFLAGS $OMNIDEFINES -I$OMNIDIR/include" 57 | dnl AC_CHECK_HEADERS([omnithread.h]) 58 | 59 | AC_LANG_PUSH(C++) 60 | 61 | LIBS="$LIBS -L$OMNIDIR/lib -lomnithread" 62 | AC_CACHE_CHECK([for omnithreads library], 63 | bb_cv_check_omnithreads, 64 | AC_TRY_LINK( 65 | #include 66 | ,omni_mutex my_mutex, 67 | bb_cv_check_omnithreads=yes,bb_cv_check_omnithreads=no) 68 | ) 69 | if test "x$bb_cv_check_omnithreads" = "xno"; then 70 | AC_MSG_ERROR([omnithreads not found]) 71 | fi 72 | 73 | AC_DEFINE(HAVE_THREADING,,[define if threading is enabled]) 74 | AC_DEFINE(USE_OMNITHREADS,,[define if omnithread library is available]) 75 | 76 | AC_LANG_POP(C++) 77 | fi 78 | ]) 79 | -------------------------------------------------------------------------------- /m4/BB_CHECK_PTHREADS.m4: -------------------------------------------------------------------------------- 1 | dnl@synposis BB_CHECK_PTHREADS.m4 2 | dnl 3 | AC_DEFUN([BB_CHECK_PTHREADS],[ 4 | AC_REQUIRE([AC_PROG_CC])dnl 5 | AC_REQUIRE([AC_PROG_CXX])dnl 6 | AC_REQUIRE([AC_PROG_CPP])dnl 7 | AC_REQUIRE([AC_PROG_CXXCPP])dnl 8 | 9 | 10 | AC_ARG_WITH(pthreads, [ --with-pthreads include pthreads support], 11 | AC_SEARCH_LIBS(pthread_key_create,pthread, 12 | [AC_DEFINE(HAVE_THREADING,,[define if threading is enabled]) 13 | AC_DEFINE(USE_PTHREADS,,[define if pthread library is available]) 14 | AC_DEFINE(_PTHREADS,,[define for STL if pthread library is used])], 15 | AC_MSG_ERROR([pthreads not found]))) 16 | 17 | ]) 18 | -------------------------------------------------------------------------------- /m4/BB_ENABLE_DOXYGEN.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([BB_ENABLE_DOXYGEN], 2 | [ 3 | AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)]) 4 | AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)]) 5 | AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes]) 6 | AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX documentation generation with doxygen (no)], [], [ enable_latex_docs=no]) 7 | if test "x$enable_doxygen" = xno; then 8 | enable_doc=no 9 | else 10 | AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) 11 | if test x$DOXYGEN = x; then 12 | if test "x$enable_doxygen" = xyes; then 13 | AC_MSG_ERROR([could not find doxygen]) 14 | fi 15 | enable_doc=no 16 | else 17 | enable_doc=yes 18 | AC_PATH_PROG(DOT, dot, , $PATH) 19 | fi 20 | fi 21 | AM_CONDITIONAL(DOC, test x$enable_doc = xyes) 22 | 23 | if test x$DOT = x; then 24 | if test "x$enable_dot" = xyes; then 25 | AC_MSG_ERROR([could not find dot]) 26 | fi 27 | enable_dot=no 28 | else 29 | enable_dot=yes 30 | fi 31 | AC_SUBST(enable_dot) 32 | AC_SUBST(enable_html_docs) 33 | AC_SUBST(enable_latex_docs) 34 | ]) 35 | -------------------------------------------------------------------------------- /m4/BB_ENABLE_REMOTE_SYSLOG.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([BB_ENABLE_REMOTE_SYSLOG], 2 | [ 3 | AC_ARG_ENABLE(remote-syslog, [ --disable-remote-syslog disables remote syslog appender], [], [ enable_remote_syslog=yes]) 4 | 5 | # for RemoteSyslogAppender 6 | if test "x$enable_remote_syslog" = xyes; then 7 | AC_CHECK_LIB(socket,socket, LIBS="-lsocket $LIBS",,) 8 | AC_CHECK_LIB(nsl,gethostbyname, LIBS="-lnsl $LIBS",,) 9 | else 10 | AC_DEFINE(DISABLE_REMOTE_SYSLOG,1,[define if RemoteSyslogAppender is disabled]) 11 | fi 12 | 13 | AM_CONDITIONAL([DISABLE_REMOTE_SYSLOG], [test "x$enable_remote_syslog" != xyes]) 14 | ]) 15 | -------------------------------------------------------------------------------- /m4/BB_ENABLE_SMTP.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([BB_ENABLE_SMTP], 2 | [ 3 | AC_ARG_ENABLE(smtp, [ --disable-smtp disables SMTP appender], [], [ enable_smtp=yes]) 4 | 5 | # for SmtpAppender 6 | if test "x$enable_smtp" != xyes; then 7 | AC_DEFINE(DISABLE_SMTP,1,[define if SmtpAppender is disabled]) 8 | fi 9 | 10 | AM_CONDITIONAL([DISABLE_SMTP], [test "x$enable_smtp" != xyes]) 11 | ]) 12 | -------------------------------------------------------------------------------- /m4/PETI_PEDANTIC_GCC.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis PETI_PEDANTIC_GCC 2 | dnl 3 | dnl For development purposes, it is desirable to have autoconf 4 | dnl automatically enable warnings when compiling C or C++ sources. In 5 | dnl case the underlying compiler is a gcc, the appropriate flags are 6 | dnl "-Wall -pedantic". This macro will add them to $CFLAGS and 7 | dnl $CXXFLAGS if $CC is found to be a gcc. 8 | dnl 9 | dnl @author Peter Simons 10 | dnl original version: peti_pedantic_gcc.m4,v 1.4 2000/12/31 10:18:09 simons 11 | dnl @version $Id$ 12 | 13 | AC_DEFUN([PETI_PEDANTIC_GCC], 14 | [ 15 | if test "$GCC" = yes; then 16 | if test "$host" = x86-pc-nto-qnx; then 17 | CFLAGS="$CXXFLAGS -Wno-unused -O0" 18 | CXXFLAGS="$CXXFLAGS -Wno-unused -DLOG4CPP_MISSING_INT64_OSTREAM_OP -O0" 19 | else 20 | case `$CXX --version` in 21 | *2.97*) CFLAGS="$CFLAGS -Wall -Wno-unused -pedantic -D_ISOC99_SOURCE" 22 | CXXFLAGS="$CXXFLAGS -Wall -Wno-unused -pedantic -D_ISOC99_SOURCE" 23 | ;; 24 | *2.96*) CFLAGS="$CFLAGS -Wall -Wno-unused" 25 | CXXFLAGS="$CXXFLAGS -Wall -Wno-unused" 26 | ;; 27 | *) CFLAGS="$CFLAGS -Wall -Wno-unused -pedantic" 28 | CXXFLAGS="$CXXFLAGS -Wall -Wno-unused -pedantic" 29 | ;; 30 | esac 31 | fi 32 | fi 33 | ]) 34 | -------------------------------------------------------------------------------- /msvc10/.cvsignore: -------------------------------------------------------------------------------- 1 | *.ncb 2 | -------------------------------------------------------------------------------- /msvc10/NTEventLogCategories.mc: -------------------------------------------------------------------------------- 1 | MessageId=0x1 2 | Language=English 3 | Fatal 4 | . 5 | MessageId=0x2 6 | Language=English 7 | Alert 8 | . 9 | MessageId=0x3 10 | Language=English 11 | Critical 12 | . 13 | MessageId=0x4 14 | Language=English 15 | Error 16 | . 17 | MessageId=0x5 18 | Language=English 19 | Warning 20 | . 21 | MessageId=0x6 22 | Language=English 23 | Notice 24 | . 25 | MessageId=0x7 26 | Language=English 27 | Info 28 | . 29 | MessageId=0x8 30 | Language=English 31 | Debug 32 | . 33 | MessageId=0x9 34 | Language=English 35 | NotSet 36 | . 37 | MessageId=0x1000 38 | Language=English 39 | %1 40 | . 41 | -------------------------------------------------------------------------------- /msvc10/log4cpp/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/log4cppLIB/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/log4cpp_stlport_boost/readme.txt: -------------------------------------------------------------------------------- 1 | This folder holds the project file for making a version of log4cpp that uses boost 1.28.0 2 | and STLport 4.5.3. 3 | 4 | Compiling: 5 | --------- 6 | This is a full list of the dependencies, in the order they should be included: 7 | 8 | 1. STLport 4.5.3 9 | 2. Microsoft Platform SDK, "Core" SDK. Tested with the 11/2001 and 10/2002 versions. 10 | 3. boost 1.28.0 11 | 12 | All dependencies must be in the include and lib paths of MSVC. This can either be done 13 | globally, or in the project file. 14 | 15 | Currently, the project file looks for the dependencies starting in a directory at the 16 | same level as that holding the log4cpp package. So if you have log4cpp in 17 | c:\packages\log4cpp, you would need to put the dependencies also in c:\packages. 18 | 19 | Running: 20 | ------- 21 | The boost library adds the run-time dependency of boost_threadmon.dll. This dll 22 | must be in the executable path when using the boost version of log4cpp. 23 | 24 | Running tests: 25 | ------------- 26 | Note the version of log4cpp that is a dependency of the test you are running! 27 | Currently, most of the tests are dependent on the regular dll version of log4cpp. 28 | 29 | 30 | David Resnick 31 | MobileSpear Inc. 32 | dresnick@mobilespear.con -------------------------------------------------------------------------------- /msvc10/testCategory/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testDLL/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testDailyRollingFileAppender/nesteddir/.gitignore: -------------------------------------------------------------------------------- 1 | *.log.* 2 | -------------------------------------------------------------------------------- /msvc10/testDailyRollingFileAppender/testConfig.log4cpp.dailyroll.nt.properties: -------------------------------------------------------------------------------- 1 | # a DailyRollingFileAppender test config 2 | 3 | log4j.rootCategory=DEBUG, rootAppender 4 | log4j.category.sub1=,DAILY, NCDAILY 5 | 6 | log4j.appender.rootAppender=org.apache.log4j.ConsoleAppender 7 | log4j.appender.rootAppender.layout=org.apache.log4j.BasicLayout 8 | 9 | log4cpp.appender.DAILY=DailyRollingFileAppender 10 | log4cpp.appender.DAILY.fileName=dailyrolling.log 11 | log4cpp.appender.DAILY.maxDaysKeep=1 12 | log4cpp.appender.DAILY.layout=PatternLayout 13 | log4cpp.appender.DAILY.layout.ConversionPattern=%d [%p] The message %m at time %d{%H:%M}%n 14 | 15 | log4cpp.appender.NCDAILY=DailyRollingFileAppender 16 | log4cpp.appender.NCDAILY.fileName=nesteddir\dailyrolling.log 17 | log4cpp.appender.NCDAILY.maxDaysKeep=1 18 | log4cpp.appender.NCDAILY.layout=PatternLayout 19 | log4cpp.appender.NCDAILY.layout.ConversionPattern=%d [%p] The message %m at time %d{%H:%M}%n 20 | -------------------------------------------------------------------------------- /msvc10/testDailyRollingFileAppender/testDailyRollingFileAppender.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /msvc10/testMain/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testNDC/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testNTEventLog/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testPattern/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testPropConfig/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc10/testRollingFileAppender/testRollingFileAppender.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /msvc6/.gitattributes: -------------------------------------------------------------------------------- 1 | #Decl are files that will always have CRLF line endings on checkout. 2 | *.dsp text eol=crlf 3 | -------------------------------------------------------------------------------- /msvc6/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = log4cpp log4cppDLL testCategory testDLL testMain testNDC testNTEventLog testPattern 2 | 3 | EXTRA_DIST = msvc6.dsw NTEventLogCategories.mc 4 | 5 | -------------------------------------------------------------------------------- /msvc6/NTEventLogCategories.mc: -------------------------------------------------------------------------------- 1 | MessageId=0x1 2 | Language=English 3 | Fatal 4 | . 5 | MessageId=0x2 6 | Language=English 7 | Alert 8 | . 9 | MessageId=0x3 10 | Language=English 11 | Critical 12 | . 13 | MessageId=0x4 14 | Language=English 15 | Error 16 | . 17 | MessageId=0x5 18 | Language=English 19 | Warning 20 | . 21 | MessageId=0x6 22 | Language=English 23 | Notice 24 | . 25 | MessageId=0x7 26 | Language=English 27 | Info 28 | . 29 | MessageId=0x8 30 | Language=English 31 | Debug 32 | . 33 | MessageId=0x9 34 | Language=English 35 | NotSet 36 | . 37 | MessageId=0x1000 38 | Language=English 39 | %1 40 | . 41 | -------------------------------------------------------------------------------- /msvc6/log4cpp/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = log4cpp.dsp 2 | -------------------------------------------------------------------------------- /msvc6/log4cppDLL/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = log4cppDLL.dsp log4cppDLL.rc 2 | 3 | -------------------------------------------------------------------------------- /msvc6/log4cppDLL/log4cppDLL.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/log4cppDLL/log4cppDLL.rc -------------------------------------------------------------------------------- /msvc6/log4cppDLL_stlport_boost/log4cppDLL_stlport_boost.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/log4cppDLL_stlport_boost/log4cppDLL_stlport_boost.rc -------------------------------------------------------------------------------- /msvc6/log4cppDLL_stlport_boost/readme.txt: -------------------------------------------------------------------------------- 1 | This folder holds the project file for making a version of log4cpp that uses boost 1.28.0 2 | and STLport 4.5.3. 3 | 4 | Compiling: 5 | --------- 6 | This is a full list of the dependencies, in the order they should be included: 7 | 8 | 1. STLport 4.5.3 9 | 2. Microsoft Platform SDK, "Core" SDK. Tested with the 11/2001 and 10/2002 versions. 10 | 3. boost 1.28.0 11 | 12 | All dependencies must be in the include and lib paths of MSVC. This can either be done 13 | globally, or in the project file. 14 | 15 | Currently, the project file looks for the dependencies starting in a directory at the 16 | same level as that holding the log4cpp package. So if you have log4cpp in 17 | c:\packages\log4cpp, you would need to put the dependencies also in c:\packages. 18 | 19 | Running: 20 | ------- 21 | The boost library adds the run-time dependency of boost_threadmon.dll. This dll 22 | must be in the executable path when using the boost version of log4cpp. 23 | 24 | Running tests: 25 | ------------- 26 | Note the version of log4cpp that is a dependency of the test you are running! 27 | Currently, most of the tests are dependent on the regular dll version of log4cpp. 28 | 29 | 30 | David Resnick 31 | MobileSpear Inc. 32 | dresnick@mobilespear.con -------------------------------------------------------------------------------- /msvc6/msvc6.dsw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/msvc6.dsw -------------------------------------------------------------------------------- /msvc6/testCategory/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testCategory.dsp 2 | -------------------------------------------------------------------------------- /msvc6/testCategory/testCategory.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testCategory/testCategory.dsp -------------------------------------------------------------------------------- /msvc6/testDLL/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testDLL.dsp 2 | 3 | -------------------------------------------------------------------------------- /msvc6/testDLL/testDLL.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testDLL/testDLL.dsp -------------------------------------------------------------------------------- /msvc6/testMain/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testMain.dsp 2 | 3 | -------------------------------------------------------------------------------- /msvc6/testMain/testMain.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testMain/testMain.dsp -------------------------------------------------------------------------------- /msvc6/testNDC/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testNDC.dsp 2 | -------------------------------------------------------------------------------- /msvc6/testNDC/testNDC.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testNDC/testNDC.dsp -------------------------------------------------------------------------------- /msvc6/testNTEventLog/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testNTEventLog.dsp 2 | 3 | 4 | -------------------------------------------------------------------------------- /msvc6/testNTEventLog/testNTEventLog.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testNTEventLog/testNTEventLog.dsp -------------------------------------------------------------------------------- /msvc6/testPattern/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testPattern.dsp 2 | 3 | 4 | -------------------------------------------------------------------------------- /msvc6/testPattern/testPattern.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahnshy/log4cpp/d0594857d7361d4a3f2ddd0892e65520e0cf5dfb/msvc6/testPattern/testPattern.dsp -------------------------------------------------------------------------------- /msvc7/.cvsignore: -------------------------------------------------------------------------------- 1 | *.ncb 2 | -------------------------------------------------------------------------------- /msvc7/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = log4cpp log4cppDLL testCategory testDLL testMain testNDC testNTEventLog testPattern 2 | 3 | EXTRA_DIST = msvc6.dsw NTEventLogCategories.mc 4 | 5 | -------------------------------------------------------------------------------- /msvc7/NTEventLogCategories.mc: -------------------------------------------------------------------------------- 1 | MessageId=0x1 2 | Language=English 3 | Fatal 4 | . 5 | MessageId=0x2 6 | Language=English 7 | Alert 8 | . 9 | MessageId=0x3 10 | Language=English 11 | Critical 12 | . 13 | MessageId=0x4 14 | Language=English 15 | Error 16 | . 17 | MessageId=0x5 18 | Language=English 19 | Warning 20 | . 21 | MessageId=0x6 22 | Language=English 23 | Notice 24 | . 25 | MessageId=0x7 26 | Language=English 27 | Info 28 | . 29 | MessageId=0x8 30 | Language=English 31 | Debug 32 | . 33 | MessageId=0x9 34 | Language=English 35 | NotSet 36 | . 37 | MessageId=0x1000 38 | Language=English 39 | %1 40 | . 41 | -------------------------------------------------------------------------------- /msvc7/log4cpp/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/log4cppLIB/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/log4cppLIB/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = log4cpp.dsp 2 | -------------------------------------------------------------------------------- /msvc7/log4cpp_stlport_boost/readme.txt: -------------------------------------------------------------------------------- 1 | This folder holds the project file for making a version of log4cpp that uses boost 1.28.0 2 | and STLport 4.5.3. 3 | 4 | Compiling: 5 | --------- 6 | This is a full list of the dependencies, in the order they should be included: 7 | 8 | 1. STLport 4.5.3 9 | 2. Microsoft Platform SDK, "Core" SDK. Tested with the 11/2001 and 10/2002 versions. 10 | 3. boost 1.28.0 11 | 12 | All dependencies must be in the include and lib paths of MSVC. This can either be done 13 | globally, or in the project file. 14 | 15 | Currently, the project file looks for the dependencies starting in a directory at the 16 | same level as that holding the log4cpp package. So if you have log4cpp in 17 | c:\packages\log4cpp, you would need to put the dependencies also in c:\packages. 18 | 19 | Running: 20 | ------- 21 | The boost library adds the run-time dependency of boost_threadmon.dll. This dll 22 | must be in the executable path when using the boost version of log4cpp. 23 | 24 | Running tests: 25 | ------------- 26 | Note the version of log4cpp that is a dependency of the test you are running! 27 | Currently, most of the tests are dependent on the regular dll version of log4cpp. 28 | 29 | 30 | David Resnick 31 | MobileSpear Inc. 32 | dresnick@mobilespear.con -------------------------------------------------------------------------------- /msvc7/testCategory/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testCategory/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testCategory.dsp 2 | -------------------------------------------------------------------------------- /msvc7/testDLL/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testDLL/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testDLL.dsp 2 | 3 | -------------------------------------------------------------------------------- /msvc7/testMain/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testMain/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testMain.dsp 2 | 3 | -------------------------------------------------------------------------------- /msvc7/testNDC/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testNDC/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testNDC.dsp 2 | -------------------------------------------------------------------------------- /msvc7/testNTEventLog/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testNTEventLog/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testNTEventLog.dsp 2 | 3 | 4 | -------------------------------------------------------------------------------- /msvc7/testPattern/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /msvc7/testPattern/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = testPattern.dsp 2 | 3 | 4 | -------------------------------------------------------------------------------- /msvc7/testPropConfig/.cvsignore: -------------------------------------------------------------------------------- 1 | Debug 2 | Release 3 | -------------------------------------------------------------------------------- /openvms/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | .libs 5 | .deps 6 | liblog4cpp.la 7 | *.lo -------------------------------------------------------------------------------- /src/AbortAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AbortAppender.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace log4cpp { 17 | 18 | AbortAppender::AbortAppender(const std::string& name) : 19 | AppenderSkeleton(name) { 20 | } 21 | 22 | AbortAppender::~AbortAppender() { 23 | close(); 24 | } 25 | 26 | void AbortAppender::close() { 27 | // empty 28 | } 29 | 30 | void AbortAppender::_append(const LoggingEvent& event) { 31 | std::abort(); 32 | } 33 | 34 | bool AbortAppender::reopen() { 35 | return true; 36 | } 37 | 38 | bool AbortAppender::requiresLayout() const { 39 | return false; 40 | } 41 | 42 | void AbortAppender::setLayout(Layout* layout) { 43 | return; 44 | } 45 | 46 | std::LOG4CPP_UNIQUE_PTR create_abort_appender(const FactoryParams& params) 47 | { 48 | std::string name; 49 | params.get_for("abort appender").required("name", name); 50 | return std::LOG4CPP_UNIQUE_PTR(new AbortAppender(name)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/AppenderSkeleton.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AppenderSkeleton.cpp 3 | * 4 | * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2001, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | 13 | namespace log4cpp { 14 | 15 | AppenderSkeleton::AppenderSkeleton(const std::string& name) : 16 | Appender(name), 17 | _threshold(Priority::NOTSET), 18 | _filter(NULL) { 19 | } 20 | 21 | AppenderSkeleton::~AppenderSkeleton() { 22 | if (_filter) 23 | delete _filter; 24 | } 25 | 26 | bool AppenderSkeleton::reopen() { 27 | return true; 28 | } 29 | 30 | void AppenderSkeleton::doAppend(const LoggingEvent& event) { 31 | if ((Priority::NOTSET == _threshold) || (event.priority <= _threshold)) { 32 | if (!_filter || (_filter->decide(event) != Filter::DENY)) { 33 | _append(event); 34 | } 35 | } 36 | } 37 | 38 | void AppenderSkeleton::setThreshold(Priority::Value priority) { 39 | _threshold = priority; 40 | } 41 | 42 | Priority::Value AppenderSkeleton::getThreshold() { 43 | return _threshold; 44 | } 45 | 46 | void AppenderSkeleton::setFilter(Filter* filter) { 47 | if (_filter != filter) { 48 | if (_filter) 49 | delete _filter; 50 | 51 | _filter = filter; 52 | } 53 | } 54 | 55 | Filter* AppenderSkeleton::getFilter() { 56 | return _filter; 57 | } 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/BasicConfigurator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BasicConfigurator.cpp 3 | * 4 | * Copyright 2002, Log4cpp Project. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #include "PortabilityImpl.hh" 9 | 10 | #ifdef LOG4CPP_HAVE_IO_H 11 | # include 12 | #endif 13 | #ifdef LOG4CPP_HAVE_UNISTD_H 14 | # include 15 | #endif 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace log4cpp { 24 | 25 | void BasicConfigurator::configure() { 26 | Category& root = Category::getRoot(); 27 | root.setPriority(Priority::INFO); 28 | root.removeAllAppenders(); 29 | root.addAppender(new FileAppender("_", ::dup(fileno(stdout)))); 30 | } 31 | 32 | } 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/BasicLayout.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * BasicLayout.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef LOG4CPP_HAVE_SSTREAM 17 | #include 18 | #endif 19 | 20 | namespace log4cpp { 21 | 22 | BasicLayout::BasicLayout() { 23 | } 24 | 25 | BasicLayout::~BasicLayout() { 26 | } 27 | 28 | std::string BasicLayout::format(const LoggingEvent& event) { 29 | std::ostringstream message; 30 | 31 | const std::string& priorityName = Priority::getPriorityName(event.priority); 32 | message << event.timeStamp.getSeconds() << " " << priorityName << " " 33 | << event.categoryName << " " << event.ndc << ": " 34 | << event.message << std::endl; 35 | 36 | return message.str(); 37 | } 38 | 39 | std::LOG4CPP_UNIQUE_PTR create_basic_layout(const FactoryParams& params) 40 | { 41 | return std::LOG4CPP_UNIQUE_PTR(new BasicLayout); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/BufferingAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include "PortabilityImpl.hh" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace log4cpp 14 | { 15 | BufferingAppender::BufferingAppender(const std::string name, unsigned long max_size, 16 | std::LOG4CPP_UNIQUE_PTR sink, std::LOG4CPP_UNIQUE_PTR evaluator) 17 | :LayoutAppender(name), max_size_(max_size), sink_(LOG4CPP_UNIQUE_PTR_MOVE(sink)), evaluator_(LOG4CPP_UNIQUE_PTR_MOVE(evaluator)), lossy_(false) 18 | { 19 | max_size_ = (max)(1UL, max_size_); 20 | } 21 | 22 | void BufferingAppender::_append(const LoggingEvent& event) 23 | { 24 | if (queue_.size() == max_size_) 25 | if (lossy_) 26 | queue_.pop_back(); 27 | else 28 | dump(); 29 | 30 | queue_.push_front(event); 31 | 32 | if (evaluator_->eval(event)) 33 | { 34 | dump(); 35 | queue_.clear(); 36 | } 37 | } 38 | 39 | static const std::string EMPTY; 40 | 41 | void BufferingAppender::dump() 42 | { 43 | Layout& layout = _getLayout(); 44 | std::ostringstream s; 45 | // Solaris 10 CC can't work with const_reverse_iterator 46 | for(queue_t::reverse_iterator i = queue_.rbegin(), last = queue_.rend(); i != last; ++i) 47 | s << layout.format(*i); 48 | 49 | LoggingEvent event(EMPTY, s.str(), EMPTY, Priority::NOTSET); 50 | sink_->doAppend(event); 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/Configurator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Configurator.cpp 3 | * 4 | * Copyright 2001, Glen Scott. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #include "PortabilityImpl.hh" 9 | #include 10 | 11 | namespace log4cpp { 12 | 13 | ConfigureFailure::ConfigureFailure(const std::string& reason) : 14 | std::runtime_error(reason) { 15 | } 16 | } 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/DllMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DllMain.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #ifdef LOG4CPP_SUPPLY_DLLMAIN 11 | 12 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 13 | #include 14 | 15 | BOOL APIENTRY DllMain( HANDLE hModule, 16 | DWORD ul_reason_for_call, 17 | LPVOID lpReserved 18 | ) 19 | { 20 | switch (ul_reason_for_call) 21 | { 22 | case DLL_PROCESS_ATTACH: 23 | case DLL_THREAD_ATTACH: 24 | case DLL_THREAD_DETACH: 25 | case DLL_PROCESS_DETACH: 26 | break; 27 | } 28 | return TRUE; 29 | } 30 | 31 | #endif // LOG4CPP_NEED_DLLMAIN 32 | -------------------------------------------------------------------------------- /src/DummyThreads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | 9 | #ifndef LOG4CPP_HAVE_THREADING 10 | 11 | namespace log4cpp { 12 | namespace threading { 13 | 14 | std::string getThreadId() { 15 | // more useful would be to return the PID. 16 | return std::string("thread1"); 17 | } 18 | 19 | } 20 | } 21 | 22 | #endif // LOG4CPP_HAVE_THREADING 23 | -------------------------------------------------------------------------------- /src/FactoryParams.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | namespace log4cpp 11 | { 12 | const std::string& FactoryParams::operator[](const std::string& v) const 13 | { 14 | const_iterator i = storage_.find(v); 15 | if (i != storage_.end()) 16 | return i->second; 17 | 18 | throw std::invalid_argument("There is no parameter '" + v + "'"); 19 | } 20 | 21 | FactoryParams::const_iterator FactoryParams::find(const std::string& v) const 22 | { 23 | return storage_.find(v); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/Filter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Filter.cpp 3 | * 4 | * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2001, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | 13 | namespace log4cpp { 14 | 15 | Filter::Filter() : 16 | _chainedFilter(NULL) { 17 | } 18 | 19 | Filter::~Filter() { 20 | if (_chainedFilter) 21 | delete _chainedFilter; 22 | } 23 | 24 | void Filter::setChainedFilter(Filter* filter) { 25 | if (filter != _chainedFilter) { 26 | if (_chainedFilter) 27 | delete _chainedFilter; 28 | 29 | _chainedFilter = filter; 30 | } 31 | } 32 | 33 | Filter* Filter::getChainedFilter() { 34 | return _chainedFilter; 35 | } 36 | 37 | Filter* Filter::getEndOfChain() { 38 | Filter* end = this; 39 | while(end->getChainedFilter()) { 40 | end = end->getChainedFilter(); 41 | } 42 | return end; 43 | } 44 | 45 | void Filter::appendChainedFilter(Filter* filter) { 46 | Filter* end = getEndOfChain(); 47 | end->setChainedFilter(filter); 48 | } 49 | 50 | Filter::Decision Filter::decide(const LoggingEvent& event) { 51 | Filter::Decision decision = _decide(event); 52 | 53 | if ((Filter::NEUTRAL == decision) && getChainedFilter()) { 54 | decision = getChainedFilter()->decide(event); 55 | } 56 | 57 | return decision; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/IdsaAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IdsaAppender.cpp 3 | * 4 | * Copyright 2000, Marc Welz 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #include "PortabilityImpl.hh" 10 | 11 | #ifdef LOG4CPP_HAVE_LIBIDSA 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | namespace log4cpp { 22 | 23 | IdsaAppender::IdsaAppender(const std::string& name, 24 | const std::string& idsaName) : 25 | AppenderSkeleton(name), 26 | _idsaName(idsaName) 27 | { 28 | _idsaConnection=NULL; 29 | open(); 30 | } 31 | 32 | IdsaAppender::~IdsaAppender() { 33 | close(); 34 | } 35 | 36 | void IdsaAppender::open() { 37 | _idsaConnection=idsa_open((char *)_idsaName.c_str(), NULL, 38 | IDSA_F_FAILOPEN); 39 | } 40 | 41 | void IdsaAppender::close() { 42 | idsa_close(_idsaConnection); 43 | _idsaConnection=NULL; 44 | } 45 | 46 | void IdsaAppender::_append(const LoggingEvent& event) { 47 | IDSA_EVENT *idsaEvent; 48 | 49 | idsaEvent = idsa_event(_idsaConnection); 50 | 51 | if (idsaEvent){ 52 | 53 | idsa_name(idsaEvent,(char *)event.categoryName.c_str()); 54 | idsa_scheme(idsaEvent,"log4cpp"); 55 | 56 | idsa_add_integer(idsaEvent, "priority", event.priority); 57 | idsa_add_string(idsaEvent, "ndc", (char *)event.ndc.c_str()); 58 | idsa_add_string(idsaEvent, "message", 59 | (char*)event.message.c_str()); 60 | 61 | idsa_log(_idsaConnection,idsaEvent); 62 | // idsa_log does its own deallocation */ 63 | } 64 | } 65 | 66 | bool IdsaAppender::reopen() { 67 | close(); 68 | open(); 69 | return true; 70 | } 71 | 72 | bool IdsaAppender::requiresLayout() const { 73 | return false; 74 | } 75 | 76 | void IdsaAppender::setLayout(Layout* layout) { 77 | return; 78 | } 79 | 80 | std::LOG4CPP_UNIQUE_PTR create_idsa_appender(const FactoryParams& params) 81 | { 82 | std::string name, idsa_name; 83 | params.get_for("idsa appender").required("name", name)("idsa_name", idsa_name); 84 | 85 | return std::LOG4CPP_UNIQUE_PTR(new IdsaAppender(name, idsa_name)); 86 | } 87 | } 88 | 89 | #endif // LOG4CPP_HAVE_LIBIDSA 90 | -------------------------------------------------------------------------------- /src/LayoutAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayoutAppender.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | 13 | namespace log4cpp { 14 | 15 | LayoutAppender::LayoutAppender(const std::string& name) : 16 | AppenderSkeleton(name), 17 | _layout(new DefaultLayoutType()) { 18 | } 19 | 20 | LayoutAppender::~LayoutAppender() { 21 | delete _layout; 22 | } 23 | 24 | bool LayoutAppender::requiresLayout() const { 25 | return true; 26 | } 27 | 28 | void LayoutAppender::setLayout(Layout* layout) { 29 | if (layout != _layout) { 30 | Layout *oldLayout = _layout; 31 | _layout = (layout == NULL) ? new DefaultLayoutType() : layout; 32 | delete oldLayout; 33 | } 34 | } 35 | 36 | Layout& LayoutAppender::_getLayout() { 37 | return *_layout; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/LayoutsFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | namespace log4cpp 11 | { 12 | static LayoutsFactory* layouts_factory_ = 0;\ 13 | 14 | std::LOG4CPP_UNIQUE_PTR create_simple_layout(const FactoryParams& params); 15 | std::LOG4CPP_UNIQUE_PTR create_basic_layout(const FactoryParams& params); 16 | std::LOG4CPP_UNIQUE_PTR create_pattern_layout(const FactoryParams& params); 17 | std::LOG4CPP_UNIQUE_PTR create_pattern_layout(const FactoryParams& params); 18 | std::LOG4CPP_UNIQUE_PTR create_pass_through_layout(const FactoryParams& params); 19 | 20 | LayoutsFactory& LayoutsFactory::getInstance() 21 | { 22 | if (!layouts_factory_) 23 | { 24 | std::LOG4CPP_UNIQUE_PTR lf(new LayoutsFactory); 25 | lf->registerCreator("simple", &create_simple_layout); 26 | lf->registerCreator("basic", &create_basic_layout); 27 | lf->registerCreator("pattern", &create_pattern_layout); 28 | lf->registerCreator("pass through", &create_pass_through_layout); 29 | layouts_factory_ = lf.release(); 30 | } 31 | 32 | return *layouts_factory_; 33 | } 34 | 35 | void LayoutsFactory::registerCreator(const std::string& class_name, create_function_t create_function) 36 | { 37 | const_iterator i = creators_.find(class_name); 38 | if (i != creators_.end()) 39 | throw std::invalid_argument("Layout creator for type name '" + class_name + "' allready registered"); 40 | 41 | creators_[class_name] = create_function; 42 | } 43 | 44 | std::LOG4CPP_UNIQUE_PTR LayoutsFactory::create(const std::string& class_name, const params_t& params) 45 | { 46 | const_iterator i = creators_.find(class_name); 47 | if (i == creators_.end()) 48 | throw std::invalid_argument("There is no layout with type name '" + class_name + "'"); 49 | 50 | return (*i->second)(params); 51 | } 52 | 53 | bool LayoutsFactory::registed(const std::string& class_name) const 54 | { 55 | return creators_.find(class_name) != creators_.end(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/LevelEvaluator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace log4cpp 12 | { 13 | std::LOG4CPP_UNIQUE_PTR create_level_evaluator(const FactoryParams& params) 14 | { 15 | std::string level; 16 | params.get_for("level evaluator").required("level", level); 17 | 18 | return std::LOG4CPP_UNIQUE_PTR(new LevelEvaluator(Priority::getPriorityValue(level))); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/Localtime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include "Localtime.hh" 9 | #include 10 | #include 11 | 12 | namespace log4cpp 13 | { 14 | 15 | #if defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R) 16 | void localtime(const ::time_t* time, ::tm* t) 17 | { 18 | localtime_s(t, time); 19 | } 20 | #endif 21 | 22 | #if !defined(_MSC_VER) && defined(LOG4CPP_HAVE_LOCALTIME_R) 23 | void localtime(const ::time_t* time, ::tm* t) 24 | { 25 | localtime_r(time, t); 26 | } 27 | #endif 28 | 29 | #if !defined(LOG4CPP_HAVE_LOCALTIME_R) 30 | void localtime(const ::time_t* time, ::tm* t) 31 | { 32 | ::tm* tmp = ::localtime(time); 33 | memcpy(t, tmp, sizeof(::tm)); 34 | } 35 | #endif 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/Localtime.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #ifndef _LOG4CPP_LOCALTIME_HH 8 | #define _LOG4CPP_LOCALTIME_HH 9 | 10 | #include 11 | 12 | namespace log4cpp 13 | { 14 | void localtime(const ::time_t* time, ::tm* t); 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/LoggingEvent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LoggingEvent.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | #include 13 | 14 | namespace log4cpp { 15 | 16 | LoggingEvent::LoggingEvent(const std::string& categoryName, 17 | const std::string& message, 18 | const std::string& ndc, 19 | Priority::Value priority) : 20 | categoryName(categoryName), 21 | message(message), 22 | ndc(ndc), 23 | priority(priority), 24 | threadName(threading::getThreadId()) { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MSThreads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #if defined(LOG4CPP_HAVE_THREADING) && defined(LOG4CPP_USE_MSTHREADS) 11 | 12 | namespace log4cpp { 13 | namespace threading { 14 | 15 | std::string getThreadId() { 16 | char buffer[16]; 17 | sprintf(buffer, "%lu", GetCurrentThreadId()); 18 | return std::string(buffer); 19 | }; 20 | } 21 | } 22 | 23 | #endif // LOG4CPP_HAVE_THREADING && LOG4CPP_USE_MSTHREADS 24 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = liblog4cpp.la 2 | 3 | INCLUDES = -I$(top_srcdir)/include 4 | 5 | noinst_HEADERS = snprintf.c Localtime.hh 6 | 7 | liblog4cpp_la_SOURCES = \ 8 | Appender.cpp \ 9 | AppenderSkeleton.cpp \ 10 | AppendersFactory.cpp \ 11 | BufferingAppender.cpp \ 12 | FactoryParams.cpp \ 13 | LayoutsFactory.cpp \ 14 | LevelEvaluator.cpp \ 15 | Localtime.cpp \ 16 | PassThroughLayout.cpp \ 17 | TriggeringEventEvaluatorFactory.cpp \ 18 | LayoutAppender.cpp \ 19 | FileAppender.cpp \ 20 | DailyRollingFileAppender.cpp \ 21 | RollingFileAppender.cpp \ 22 | FixedContextCategory.cpp \ 23 | IdsaAppender.cpp \ 24 | OstreamAppender.cpp \ 25 | StringQueueAppender.cpp \ 26 | SyslogAppender.cpp \ 27 | SimpleLayout.cpp \ 28 | BasicLayout.cpp \ 29 | PatternLayout.cpp \ 30 | Category.cpp \ 31 | CategoryStream.cpp \ 32 | HierarchyMaintainer.cpp \ 33 | Configurator.cpp \ 34 | BasicConfigurator.cpp \ 35 | SimpleConfigurator.cpp \ 36 | PropertyConfigurator.cpp \ 37 | PropertyConfiguratorImpl.hh \ 38 | PropertyConfiguratorImpl.cpp \ 39 | LoggingEvent.cpp \ 40 | Priority.cpp \ 41 | NDC.cpp \ 42 | Filter.cpp \ 43 | TimeStamp.cpp \ 44 | StringUtil.hh \ 45 | StringUtil.cpp \ 46 | Properties.hh \ 47 | Properties.cpp \ 48 | Win32DebugAppender.cpp \ 49 | NTEventLogAppender.cpp \ 50 | DllMain.cpp \ 51 | DummyThreads.cpp \ 52 | MSThreads.cpp \ 53 | OmniThreads.cpp \ 54 | PThreads.cpp \ 55 | PortabilityImpl.hh \ 56 | PortabilityImpl.cpp \ 57 | AbortAppender.cpp 58 | 59 | if !DISABLE_REMOTE_SYSLOG 60 | liblog4cpp_la_SOURCES += RemoteSyslogAppender.cpp 61 | endif 62 | 63 | if !DISABLE_SMTP 64 | liblog4cpp_la_SOURCES += SmtpAppender.cpp 65 | endif 66 | 67 | liblog4cpp_la_LDFLAGS = -version-info @LT_VERSION@ 68 | -------------------------------------------------------------------------------- /src/Manipulator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | using namespace std; 9 | namespace log4cpp { 10 | ostream& operator<< (ostream& os, const width& w) { 11 | if (os.good()) { 12 | os.width(w.size); 13 | } 14 | return os; 15 | } 16 | ostream& operator<< (ostream& os, const tab& t) { 17 | if (os.good()) { 18 | for(size_t no = 0; no < t.size; no++) os.put(os.widen('\t')); 19 | } 20 | return os; 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/OmniThreads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | 9 | #if defined(LOG4CPP_HAVE_THREADING) && defined(LOG4CPP_USE_OMNITHREADS) 10 | 11 | namespace log4cpp { 12 | namespace threading { 13 | 14 | std::string getThreadId() { 15 | char buffer[16]; 16 | sprintf(buffer, "%d", ::omni_thread::self()->id()); 17 | return std::string(buffer); 18 | }; 19 | } 20 | } 21 | 22 | #endif // LOG4CPP_HAVE_THREADING && LOG4CPP_USE_ONMITHREADS 23 | -------------------------------------------------------------------------------- /src/OstreamAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * OstreamAppender.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #ifdef LOG4CPP_HAVE_UNISTD_H 12 | # include 13 | #endif 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace log4cpp { 20 | 21 | OstreamAppender::OstreamAppender(const std::string& name, std::ostream* stream) : 22 | LayoutAppender(name), 23 | _stream(stream) { 24 | } 25 | 26 | OstreamAppender::~OstreamAppender() { 27 | close(); 28 | } 29 | 30 | void OstreamAppender::close() { 31 | // empty 32 | } 33 | 34 | void OstreamAppender::_append(const LoggingEvent& event) { 35 | (*_stream) << _getLayout().format(event); 36 | if (!_stream->good()) { 37 | // XXX help! help! 38 | } 39 | } 40 | 41 | bool OstreamAppender::reopen() { 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/PThreads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #if defined(LOG4CPP_HAVE_THREADING) && defined(LOG4CPP_USE_PTHREADS) 11 | 12 | namespace log4cpp { 13 | namespace threading { 14 | 15 | std::string getThreadId() { 16 | char buffer[4*sizeof(long)]; 17 | int bufsize = sizeof(buffer)/sizeof(buffer[0]); 18 | int n = ::snprintf(buffer, bufsize, "%lu", pthread_self()); // thread id unsigned 19 | if (n >= bufsize) { 20 | // escape to heap allocation 21 | char *buff_alloc; 22 | int size = ::asprintf(&buff_alloc, "%lu", pthread_self()); // thread id unsigned 23 | if (size < 0) { 24 | throw std::bad_alloc(); 25 | } 26 | std::string res(buff_alloc); 27 | free(buff_alloc); 28 | return res; 29 | } 30 | return std::string(buffer); 31 | } 32 | 33 | } 34 | } 35 | 36 | #endif // LOG4CPP_HAVE_THREADING && LOG4CPP_USE_PTHREADS 37 | -------------------------------------------------------------------------------- /src/PassThroughLayout.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace log4cpp 12 | { 13 | std::LOG4CPP_UNIQUE_PTR create_pass_through_layout(const FactoryParams& params) 14 | { 15 | return std::LOG4CPP_UNIQUE_PTR(new PassThroughLayout); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/PortabilityImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * PortabilityImpl.cpp 3 | * 4 | * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2002, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | /* 11 | This file contains various portability functions 12 | */ 13 | 14 | #include "PortabilityImpl.hh" 15 | 16 | #ifndef LOG4CPP_HAVE_SSTREAM 17 | 18 | namespace std { 19 | std::string ostringstream::str() { 20 | (*this) << '\0'; 21 | std::string msg(ostrstream::str()); 22 | ostrstream::freeze(false); //unfreeze stream 23 | return msg; 24 | } 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/PortabilityImpl.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * PortabilityImpl.hh 3 | * 4 | * Copyright 2002, Log4cpp Project. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #ifndef _LOG4CPP_PORTABILITYIMPL_HH 10 | #define _LOG4CPP_PORTABILITYIMPL_HH 11 | 12 | #include 13 | 14 | #ifdef LOG4CPP_CSTDLIB_NOT_IN_STD 15 | #include 16 | namespace std { 17 | static inline char *getenv(const char *name) { return ::getenv(name); }; 18 | static inline int atoi(const char *nptr) { return ::atoi(nptr); }; 19 | static inline unsigned long int 20 | strtoul(const char *nptr, char **endptr, int base) { 21 | return ::strtol(nptr, endptr, base); 22 | }; 23 | static inline void abort(void) { ::abort(); }; 24 | 25 | } 26 | #endif 27 | 28 | #ifdef LOG4CPP_CSTRING_NOT_IN_STD 29 | #include 30 | namespace std { 31 | static inline void *memmove(void *dest, const void *src, size_t n) { 32 | return ::memmove(dest, src, n); 33 | }; 34 | } 35 | #endif 36 | 37 | #ifdef LOG4CPP_CTIME_NOT_IN_STD 38 | #include 39 | namespace std { 40 | static inline size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr ) { 41 | return ::strftime(strDest,maxsize,format,timeptr); 42 | } 43 | static inline struct tm *localtime( const time_t *timer ) { return ::localtime(timer); } 44 | using ::clock; 45 | using ::tm; 46 | using ::time_t; 47 | } 48 | #endif 49 | 50 | #ifdef LOG4CPP_CMATH_NOT_IN_STD 51 | #include 52 | namespace std { 53 | static inline int abs(int i) { return ::abs(i); } 54 | } 55 | #endif 56 | 57 | namespace log4cpp 58 | { 59 | template const T& min(const T& a, const T& b) 60 | { 61 | return a < b ? a : b; 62 | } 63 | 64 | template const T& max(const T& a, const T& b) 65 | { 66 | return a > b ? a : b; 67 | } 68 | } 69 | 70 | #endif // _LOG4CPP_PORTABILITYIMPL_HH 71 | -------------------------------------------------------------------------------- /src/Priority.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Priority.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | #include 13 | 14 | namespace log4cpp { 15 | 16 | namespace { 17 | const std::string *names() { 18 | static const std::string priority_names[10] = { 19 | "FATAL", 20 | "ALERT", 21 | "CRIT", 22 | "ERROR", 23 | "WARN", 24 | "NOTICE", 25 | "INFO", 26 | "DEBUG", 27 | "NOTSET", 28 | "UNKNOWN" 29 | }; 30 | return priority_names; 31 | } 32 | } 33 | 34 | const int log4cpp::Priority::MESSAGE_SIZE = 8; 35 | 36 | 37 | const std::string& Priority::getPriorityName(int priority) LOG4CPP_NOTHROW { 38 | 39 | priority++; 40 | priority /= 100; 41 | return names()[((priority < 0) || (priority > 8)) ? 8 : priority]; 42 | } 43 | 44 | Priority::Value Priority::getPriorityValue(const std::string& priorityName) { 45 | Priority::Value value = -1; 46 | 47 | for (unsigned int i = 0; i < 10; i++) { 48 | if (priorityName == names()[i]) { 49 | value = i * 100; 50 | break; 51 | } 52 | } 53 | 54 | if (value == -1) { 55 | if (priorityName == "EMERG") { 56 | value = 0; 57 | } else { 58 | char* endPointer; 59 | value = std::strtoul(priorityName.c_str(), &endPointer, 10); 60 | if (*endPointer != 0) { 61 | throw std::invalid_argument( 62 | std::string("unknown priority name: '") + priorityName + "'" 63 | ); 64 | } 65 | } 66 | } 67 | 68 | return value; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Properties.hh: -------------------------------------------------------------------------------- 1 | /* 2 | * Properties.hh 3 | * 4 | * Copyright 2002, Log4cpp Project. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #ifndef _LOG4CPP_PROPERTIES_HH 10 | #define _LOG4CPP_PROPERTIES_HH 11 | 12 | #include "PortabilityImpl.hh" 13 | #include 14 | #include 15 | #include 16 | 17 | namespace log4cpp { 18 | 19 | class Properties : public std::map { 20 | public: 21 | Properties(); 22 | virtual ~Properties(); 23 | 24 | virtual void load(std::istream& in); 25 | virtual void save(std::ostream& out); 26 | 27 | virtual int getInt(const std::string& property, int defaultValue); 28 | virtual bool getBool(const std::string& property, bool defaultValue); 29 | virtual std::string getString(const std::string& property, 30 | const char* defaultValue); 31 | 32 | protected: 33 | virtual void _substituteVariables(std::string& value); 34 | }; 35 | } 36 | 37 | #endif // _LOG4CPP_PROPERTIES_HH 38 | 39 | -------------------------------------------------------------------------------- /src/PropertyConfigurator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * PropertyConfigurator.cpp 3 | * 4 | * Copyright 2001, Glen Scott. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #include "PortabilityImpl.hh" 9 | #include 10 | #include "PropertyConfiguratorImpl.hh" 11 | 12 | namespace log4cpp { 13 | 14 | void PropertyConfigurator::configure(const std::string& initFileName) { 15 | static PropertyConfiguratorImpl configurator; 16 | 17 | configurator.doConfigure(initFileName); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/SimpleLayout.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimpleLayout.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | #include 13 | #include 14 | #ifdef LOG4CPP_HAVE_SSTREAM 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | 21 | namespace log4cpp { 22 | 23 | SimpleLayout::SimpleLayout() { 24 | } 25 | 26 | SimpleLayout::~SimpleLayout() { 27 | } 28 | 29 | std::string SimpleLayout::format(const LoggingEvent& event) { 30 | std::ostringstream message; 31 | 32 | const std::string& priorityName = Priority::getPriorityName(event.priority); 33 | message.width(Priority::MESSAGE_SIZE);message.setf(std::ios::left); 34 | message << priorityName << ": " << event.message << std::endl; 35 | return message.str(); 36 | } 37 | 38 | std::LOG4CPP_UNIQUE_PTR create_simple_layout(const FactoryParams& params) 39 | { 40 | return std::LOG4CPP_UNIQUE_PTR(new SimpleLayout); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/StringQueueAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * StringQueueAppender.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #include 12 | 13 | namespace log4cpp { 14 | 15 | StringQueueAppender::StringQueueAppender(const std::string& name) : 16 | LayoutAppender(name) { 17 | } 18 | 19 | StringQueueAppender::~StringQueueAppender() { 20 | close(); 21 | } 22 | 23 | void StringQueueAppender::close() { 24 | // empty 25 | } 26 | 27 | void StringQueueAppender::_append(const LoggingEvent& event) { 28 | _queue.push(_getLayout().format(event)); 29 | } 30 | 31 | bool StringQueueAppender::reopen() { 32 | return true; 33 | } 34 | 35 | std::queue& StringQueueAppender::getQueue() { 36 | return _queue; 37 | } 38 | 39 | const std::queue& StringQueueAppender::getQueue() const { 40 | return _queue; 41 | } 42 | 43 | size_t StringQueueAppender::queueSize() const { 44 | return getQueue().size(); 45 | } 46 | 47 | std::string StringQueueAppender::popMessage() { 48 | std::string message; 49 | 50 | if (!_queue.empty()) { 51 | message = _queue.front(); 52 | _queue.pop(); 53 | } 54 | 55 | return message; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/StringUtil.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * StringUtil.cpp 3 | * 4 | * Copyright 2002, Log4cpp Project. All rights reserved. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | #include "StringUtil.hh" 9 | #include 10 | #include 11 | 12 | #if defined(_MSC_VER) 13 | #define VSNPRINTF _vsnprintf 14 | #else 15 | #ifdef LOG4CPP_HAVE_SNPRINTF 16 | #define VSNPRINTF vsnprintf 17 | #else 18 | /* use alternative snprintf() from http://www.ijs.si/software/snprintf/ */ 19 | 20 | #define HAVE_SNPRINTF 21 | #define PREFER_PORTABLE_SNPRINTF 22 | 23 | #include 24 | #include 25 | 26 | extern "C" { 27 | #include "snprintf.c" 28 | } 29 | 30 | #define VSNPRINTF portable_vsnprintf 31 | 32 | #endif // LOG4CPP_HAVE_SNPRINTF 33 | #endif // _MSC_VER 34 | 35 | namespace log4cpp { 36 | 37 | std::string StringUtil::vform(const char* format, va_list args) { 38 | size_t size = 1024; 39 | char* buffer = new char[size]; 40 | 41 | while (1) { 42 | va_list args_copy; 43 | 44 | #if defined(_MSC_VER) || defined(__BORLANDC__) || !(defined(__cplusplus) && (__cplusplus >= 201103L)) 45 | args_copy = args; 46 | #else 47 | va_copy(args_copy, args); 48 | #endif 49 | 50 | int n = VSNPRINTF(buffer, size, format, args_copy); 51 | 52 | va_end(args_copy); 53 | 54 | // If that worked, return a string. 55 | if ((n > -1) && (static_cast(n) < size)) { 56 | std::string s(buffer); 57 | delete [] buffer; 58 | return s; 59 | } 60 | 61 | // Else try again with more space. 62 | size = (n > -1) ? 63 | n + 1 : // ISO/IEC 9899:1999 64 | size * 2; // twice the old size 65 | 66 | delete [] buffer; 67 | buffer = new char[size]; 68 | } 69 | } 70 | 71 | std::string StringUtil::trim(const std::string& s) { 72 | static const char* whiteSpace = " \t\r\n"; 73 | 74 | // test for null string 75 | if(s.empty()) 76 | return s; 77 | 78 | // find first non-space character 79 | std::string::size_type b = s.find_first_not_of(whiteSpace); 80 | if(b == std::string::npos) // No non-spaces 81 | return ""; 82 | 83 | // find last non-space character 84 | std::string::size_type e = s.find_last_not_of(whiteSpace); 85 | 86 | // return the remaining characters 87 | return std::string(s, b, e - b + 1); 88 | } 89 | 90 | unsigned int StringUtil::split(std::vector& v, 91 | const std::string& s, 92 | char delimiter, unsigned int maxSegments) { 93 | v.clear(); 94 | std::back_insert_iterator > it(v); 95 | return split(it, s, delimiter, maxSegments); 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/SyslogAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SyslogAppender.cpp 3 | * 4 | * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2000, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include "PortabilityImpl.hh" 11 | #if LOG4CPP_HAVE_SYSLOG 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | namespace log4cpp { 22 | 23 | int SyslogAppender::toSyslogPriority(Priority::Value priority) { 24 | static int priorities[8] = { LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, 25 | LOG_WARNING, LOG_NOTICE, LOG_INFO, 26 | LOG_DEBUG }; 27 | int result; 28 | 29 | priority++; 30 | priority /= 100; 31 | 32 | if (priority < 0) { 33 | result = LOG_EMERG; 34 | } else if (priority > 7) { 35 | result = LOG_DEBUG; 36 | } else { 37 | result = priorities[priority]; 38 | } 39 | 40 | return result; 41 | } 42 | 43 | 44 | SyslogAppender::SyslogAppender(const std::string& name, 45 | const std::string& syslogName, 46 | int facility) : 47 | LayoutAppender(name), 48 | _syslogName(syslogName), 49 | _facility(facility) 50 | { 51 | open(); 52 | } 53 | 54 | SyslogAppender::~SyslogAppender() { 55 | close(); 56 | } 57 | 58 | void SyslogAppender::open() { 59 | openlog(_syslogName.c_str(), 0, _facility); 60 | } 61 | 62 | void SyslogAppender::close() { 63 | ::closelog(); 64 | } 65 | 66 | void SyslogAppender::_append(const LoggingEvent& event) { 67 | std::string message(_getLayout().format(event)); 68 | int priority = toSyslogPriority(event.priority); 69 | ::syslog(priority | _facility, "%s", message.c_str()); 70 | } 71 | 72 | bool SyslogAppender::reopen() { 73 | close(); 74 | open(); 75 | return true; 76 | } 77 | 78 | std::LOG4CPP_UNIQUE_PTR create_syslog_appender(const FactoryParams& params) 79 | { 80 | std::string name, syslog_name; 81 | int facility = 0; 82 | params.get_for("syslog appender").required("name", name)("syslog_name", syslog_name) 83 | .optional("facility", facility); 84 | return std::LOG4CPP_UNIQUE_PTR(new SyslogAppender(name, syslog_name, facility)); 85 | } 86 | } 87 | 88 | #endif // LOG4CPP_HAVE_SYSLOG 89 | -------------------------------------------------------------------------------- /src/TimeStamp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeStamp.cpp 3 | * 4 | * Copyright 2001, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 5 | * Copyright 2001, Bastiaan Bakker. All rights reserved. 6 | * 7 | * See the COPYING file for the terms of usage and distribution. 8 | */ 9 | 10 | #include 11 | 12 | #include 13 | 14 | #ifdef LOG4CPP_HAVE_GETTIMEOFDAY 15 | #include 16 | #else 17 | #ifdef LOG4CPP_HAVE_FTIME 18 | #include 19 | #else 20 | #include 21 | #endif 22 | #endif 23 | 24 | namespace log4cpp { 25 | 26 | LOG4CPP_EXPORT TimeStamp TimeStamp::_startStamp; 27 | 28 | TimeStamp::TimeStamp() { 29 | #ifdef LOG4CPP_HAVE_GETTIMEOFDAY 30 | struct timeval tv; 31 | ::gettimeofday(&tv, NULL); 32 | _seconds = tv.tv_sec; 33 | _microSeconds = tv.tv_usec; 34 | #else 35 | #ifdef LOG4CPP_HAVE_FTIME 36 | struct timeb tb; 37 | ::ftime(&tb); 38 | _seconds = tb.time; 39 | _microSeconds = 1000 * tb.millitm; 40 | #else 41 | _seconds = ::time(NULL); 42 | _microSeconds = 0; 43 | #endif 44 | #endif 45 | } 46 | 47 | TimeStamp::TimeStamp(unsigned int seconds, unsigned int microSeconds) : 48 | _seconds(seconds), 49 | _microSeconds(microSeconds) { 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/TriggeringEventEvaluatorFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002, Log4cpp Project. All rights reserved. 3 | * 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | namespace log4cpp 11 | { 12 | static TriggeringEventEvaluatorFactory* evaluators_factory_ = 0; 13 | std::LOG4CPP_UNIQUE_PTR create_level_evaluator(const FactoryParams& params); 14 | 15 | TriggeringEventEvaluatorFactory& TriggeringEventEvaluatorFactory::getInstance() 16 | { 17 | if (!evaluators_factory_) 18 | { 19 | std::LOG4CPP_UNIQUE_PTR af(new TriggeringEventEvaluatorFactory); 20 | af->registerCreator("level", &create_level_evaluator); 21 | evaluators_factory_ = af.release(); 22 | } 23 | 24 | return *evaluators_factory_; 25 | } 26 | 27 | void TriggeringEventEvaluatorFactory::registerCreator(const std::string& class_name, create_function_t create_function) 28 | { 29 | const_iterator i = creators_.find(class_name); 30 | if (i != creators_.end()) 31 | throw std::invalid_argument("Creator for Triggering event evaluator with type name '" + class_name + "' allready registered"); 32 | 33 | creators_[class_name] = create_function; 34 | } 35 | 36 | std::LOG4CPP_UNIQUE_PTR TriggeringEventEvaluatorFactory::create(const std::string& class_name, const params_t& params) 37 | { 38 | const_iterator i = creators_.find(class_name); 39 | if (i == creators_.end()) 40 | throw std::invalid_argument("There is no triggering event evaluator with type name '" + class_name + "'"); 41 | 42 | return (*i->second)(params); 43 | } 44 | 45 | bool TriggeringEventEvaluatorFactory::registered(const std::string& class_name) const 46 | { 47 | return creators_.end() != creators_.find(class_name); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/Win32DebugAppender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Win32DebugAppender.cpp 3 | * 4 | * Copyright 2002, the Log4cpp project. 5 | * 6 | * See the COPYING file for the terms of usage and distribution. 7 | */ 8 | 9 | #ifdef WIN32 // only available on Win32 10 | 11 | #include "PortabilityImpl.hh" 12 | #ifdef LOG4CPP_HAVE_IO_H 13 | # include 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include "log4cpp/Category.hh" 21 | #include "log4cpp/Win32DebugAppender.hh" 22 | #include 23 | #include 24 | 25 | namespace log4cpp { 26 | 27 | Win32DebugAppender::Win32DebugAppender(const std::string& name) : 28 | LayoutAppender(name) { 29 | } 30 | 31 | Win32DebugAppender::~Win32DebugAppender() { 32 | close(); 33 | } 34 | 35 | void Win32DebugAppender::close() { 36 | } 37 | 38 | void Win32DebugAppender::_append(const LoggingEvent& event) { 39 | std::string message(_getLayout().format(event)); 40 | ::OutputDebugString(message.c_str()); 41 | } 42 | 43 | std::LOG4CPP_UNIQUE_PTR create_win32_debug_appender(const FactoryParams& params) 44 | { 45 | std::string name; 46 | params.get_for("win32 debug appender").required("name", name); 47 | 48 | return std::LOG4CPP_UNIQUE_PTR(new Win32DebugAppender(name)); 49 | } 50 | } 51 | 52 | #endif // WIN32 53 | -------------------------------------------------------------------------------- /tests/.cvsignore: -------------------------------------------------------------------------------- 1 | .cvsignore 2 | Makefile 3 | Makefile.in 4 | .deps 5 | .libs 6 | testmain 7 | testNDC 8 | testbench 9 | testCategory 10 | bin 11 | *.log 12 | *.log.* 13 | -------------------------------------------------------------------------------- /tests/Clock.cpp: -------------------------------------------------------------------------------- 1 | static const char rcsid[] = "$Id$"; 2 | 3 | /* 4 | * See the COPYING file for the terms of usage and distribution. 5 | */ 6 | 7 | #include 8 | #include // for struct timeval 9 | #ifdef __osf__ 10 | # include // for __RPCC() 11 | #elif __linux__ && __i386__ 12 | # define rdtscl(low) \ 13 | __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx") 14 | #endif 15 | #include 16 | 17 | #include "Clock.hh" 18 | 19 | namespace 20 | { 21 | const usec_t UsecPerSec = INT64_CONSTANT(1000000); 22 | } 23 | 24 | bool Clock::UsingCPU = std::getenv("CLOCK_USE_CPU") ? true : false; 25 | 26 | // ----------------------------------------------------------------------------- 27 | usec_t Clock::time(void) 28 | { 29 | if (UsingCPU) { 30 | static bool warn = true; 31 | 32 | if (warn) { 33 | std::cout << "Using CPU clock." << std::endl; 34 | warn = false; 35 | } 36 | 37 | #ifdef __osf__ 38 | return (usec_t) __RPCC(); 39 | #elif __linux__ && __i386__ 40 | { 41 | unsigned long tsc; 42 | 43 | rdtscl(tsc); 44 | return (usec_t) tsc; 45 | } 46 | #else 47 | { 48 | std::cerr << "CPU clock not implemented for this architecture" << std::endl; 49 | UsingCPU = false; 50 | return Clock::time(); 51 | } 52 | #endif 53 | } else { 54 | struct timeval tv; 55 | 56 | gettimeofday(&tv, NULL); 57 | return (usec_t) (tv.tv_sec * UsecPerSec + tv.tv_usec); 58 | } 59 | } 60 | 61 | // ----------------------------------------------------------------------------- 62 | Clock::Clock(void) 63 | : _start(0), 64 | _elapsed(0), 65 | _active(false) 66 | { 67 | start(); 68 | } 69 | 70 | // ----------------------------------------------------------------------------- 71 | Clock::~Clock(void) 72 | { 73 | ; 74 | } 75 | 76 | // ----------------------------------------------------------------------------- 77 | usec_t Clock::elapsed(void) const 78 | { 79 | if (!active()) 80 | return _elapsed; 81 | 82 | return time() - _start; 83 | } 84 | 85 | 86 | // ----------------------------------------------------------------------------- 87 | usec_t Clock::start(void) 88 | { 89 | _active = true; 90 | 91 | return _start = time(); 92 | } 93 | 94 | // ----------------------------------------------------------------------------- 95 | usec_t Clock::stop(void) 96 | { 97 | _elapsed = elapsed(); 98 | _active = false; 99 | 100 | return _elapsed; 101 | } 102 | 103 | -------------------------------------------------------------------------------- /tests/Clock.hh: -------------------------------------------------------------------------------- 1 | /* $Id$ 2 | * 3 | * See the COPYING file for the terms of usage and distribution. 4 | */ 5 | 6 | #ifndef __CLOCK_H 7 | #define __CLOCK_H 8 | 9 | #include 10 | 11 | #ifdef LOG4CPP_HAVE_STDINT_H 12 | #include 13 | #endif // LOG4CPP_HAVE_STDINT_H 14 | 15 | #ifdef __osf__ 16 | typedef long usec_t; /* number of microseconds since 1970/01/01 */ 17 | # define INT64_CONSTANT(val) (val##L) 18 | #else 19 | typedef int64_t usec_t; 20 | # define INT64_CONSTANT(val) (val##LL) 21 | #endif 22 | 23 | class Clock 24 | { 25 | public: 26 | static bool UsingCPU; 27 | static usec_t time(void); 28 | 29 | Clock(void); 30 | ~Clock(void); 31 | 32 | bool active(void) const { return _active; } 33 | usec_t elapsed(void) const; 34 | usec_t start(void); 35 | usec_t reset(void) { return start(); } 36 | usec_t stop(void); 37 | 38 | private: 39 | usec_t _start; 40 | usec_t _elapsed; 41 | bool _active; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | TESTS = testCategory testFixedContextCategory testNDC testPattern \ 2 | testErrorCollision testPriority testFilter testProperties \ 3 | testConfig testPropertyConfig testRollingFileAppender testDailyRollingFileAppender 4 | 5 | check_PROGRAMS = $(TESTS) 6 | check_DATA = log4cpp.init log4cpp.properties testProperties.properties \ 7 | testConfig.log4cpp.properties 8 | 9 | EXTRA_DIST = log4cpp.init log4cpp.properties testProperties.properties \ 10 | testConfig.log4cpp.properties \ 11 | testNTEventLog.cpp 12 | 13 | noinst_PROGRAMS = testmain testbench 14 | 15 | INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src 16 | 17 | testmain_SOURCES = testmain.cpp 18 | testmain_LDADD = $(top_builddir)/src/liblog4cpp.la 19 | 20 | testCategory_SOURCES = testCategory.cpp 21 | testCategory_LDADD = $(top_builddir)/src/liblog4cpp.la 22 | 23 | testFixedContextCategory_SOURCES = testFixedContextCategory.cpp 24 | testFixedContextCategory_LDADD = $(top_builddir)/src/liblog4cpp.la 25 | 26 | testNDC_SOURCES = testNDC.cpp 27 | testNDC_LDADD = $(top_builddir)/src/liblog4cpp.la 28 | 29 | testPattern_SOURCES = testPattern.cpp 30 | testPattern_LDADD = $(top_builddir)/src/liblog4cpp.la 31 | 32 | testPriority_SOURCES = testPriority.cpp 33 | testPriority_LDADD = $(top_builddir)/src/liblog4cpp.la 34 | 35 | testConfig_SOURCES = testConfig.cpp 36 | testConfig_LDADD = $(top_builddir)/src/liblog4cpp.la 37 | 38 | testPropertyConfig_SOURCES = testPropertyConfig.cpp 39 | testPropertyConfig_LDADD = $(top_builddir)/src/liblog4cpp.la 40 | 41 | testFilter_SOURCES = testFilter.cpp 42 | testFilter_LDADD = $(top_builddir)/src/liblog4cpp.la 43 | 44 | testProperties_SOURCES = testProperties.cpp 45 | testProperties_LDADD = $(top_builddir)/src/liblog4cpp.la 46 | 47 | testbench_SOURCES = Clock.cpp Clock.hh testbench.cpp 48 | testbench_LDADD = $(top_builddir)/src/liblog4cpp.la 49 | 50 | testErrorCollision_SOURCES = testErrorCollision.cpp 51 | testErrorCollision_LDADD = $(top_builddir)/src/liblog4cpp.la 52 | 53 | testRollingFileAppender_SOURCES = testRollingFileAppender.cpp 54 | testRollingFileAppender_LDADD = $(top_builddir)/src/liblog4cpp.la 55 | 56 | testDailyRollingFileAppender_SOURCES = testDailyRollingFileAppender.cpp 57 | testDailyRollingFileAppender_LDADD = $(top_builddir)/src/liblog4cpp.la 58 | 59 | distclean-local: 60 | $(RM) -f *.log 61 | -------------------------------------------------------------------------------- /tests/NDCTest.hh: -------------------------------------------------------------------------------- 1 | #ifndef _NDCTEST_HH 2 | #define _NDCTEST_HH 3 | 4 | #include 5 | #include "cppunit/TestCaller.h" 6 | #include "cppunit/TestCase.h" 7 | #include "cppunit/TestSuite.h" 8 | #include 9 | 10 | template class NDCTest : public CppUnit::TestCase { 11 | protected: 12 | NDCCLASS* _nDC; 13 | 14 | public: 15 | NDCTest() { 16 | } 17 | 18 | NDCTest(std::string name) : CppUnit::TestCase(name) { 19 | } 20 | 21 | virtual void registerTests(CppUnit::TestSuite* suite) { 22 | suite->addTest(new CppUnit::TestCaller("testEmpty", 23 | &NDCTest::testEmpty)); 24 | suite->addTest(new CppUnit::TestCaller("testPush", 25 | &NDCTest::testPush)); 26 | suite->addTest(new CppUnit::TestCaller("testPush2", 27 | &NDCTest::testPush2)); 28 | suite->addTest(new CppUnit::TestCaller("testPop", 29 | &NDCTest::testPop)); 30 | suite->addTest(new CppUnit::TestCaller("testClear", 31 | &NDCTest::testClear)); 32 | } 33 | 34 | int countTestCases() const { 35 | return 5; 36 | } 37 | 38 | void setUp() { 39 | _nDC = new NDCCLASS(); 40 | } 41 | 42 | void tearDown() { 43 | delete _nDC; 44 | } 45 | 46 | void testEmpty() { 47 | assert(_nDC->_get() == ""); 48 | assert(_nDC->_getDepth() == 0); 49 | } 50 | 51 | void testPush() { 52 | _nDC->_push("push context 1"); 53 | assert(_nDC->_get() == "push context 1"); 54 | assert(_nDC->_getDepth() == 1); 55 | 56 | } 57 | 58 | void testPush2() { 59 | _nDC->_push("push context 1"); 60 | _nDC->_push("push context 2"); 61 | assert(_nDC->_get() == "push context 1 push context 2"); 62 | assert(_nDC->_getDepth() == 2); 63 | 64 | } 65 | 66 | void testPop() { 67 | _nDC->_push("push context 1"); 68 | _nDC->_push("push context 2"); 69 | _nDC->_pop(); 70 | assert(_nDC->_get() == "push context 1"); 71 | assert(_nDC->_getDepth() == 1); 72 | } 73 | 74 | void testClear() { 75 | _nDC->_push("push context 1"); 76 | _nDC->_push("push context 2"); 77 | _nDC->_clear(); 78 | assert(_nDC->_get() == ""); 79 | assert(_nDC->_getDepth() == 0); 80 | } 81 | }; 82 | 83 | #endif // _NDCTEST_HH 84 | -------------------------------------------------------------------------------- /tests/jamfile: -------------------------------------------------------------------------------- 1 | project log4cpp/tests : requirements ..//log4cpp ; 2 | 3 | import testing ; 4 | 5 | test-suite log4cpp : 6 | [ run testCategory.cpp ] 7 | [ run testFixedContextCategory.cpp ] 8 | [ run testNDC.cpp ] 9 | [ run testDLL.cpp ] 10 | [ run testPattern.cpp ] 11 | [ run testErrorCollision.cpp ] 12 | [ run testPriority.cpp ] 13 | [ run testFilter.cpp ] 14 | [ run testProperties.cpp ../src/Properties.cpp ../src/StringUtil.cpp : : : ../src ] 15 | [ run testConfig.cpp ] 16 | [ run testPropertyConfig.cpp ] 17 | [ run testmain.cpp ] 18 | [ run testPropConfig.cpp ] 19 | [ run test_convenience.cpp ] 20 | [ run testRollingFileAppender.cpp ] 21 | [ run testDailyRollingFileAppender.cpp ] 22 | ; 23 | -------------------------------------------------------------------------------- /tests/log4cpp.init: -------------------------------------------------------------------------------- 1 | # a simple test config 2 | # 3 | appender root basic console 4 | priority root DEBUG 5 | appender sub1 basic file sub1.log 6 | #appender sub1 basic syslog log4cpptest 7 | priority sub1.sub2 ERROR 8 | appender sub1.sub2 pattern console The message %m at time %d%n 9 | -------------------------------------------------------------------------------- /tests/log4cpp.nt.property: -------------------------------------------------------------------------------- 1 | # property configurator test file 2 | 3 | log4cpp.rootCategory=DEBUG, rootAppender 4 | log4cpp.category.sub1=DEBUG, A1, A2, stderrAppender, stdoutAppender 5 | log4cpp.category.sub1.sub2=DEBUG, A3 6 | 7 | log4cpp.appender.rootAppender=ConsoleAppender 8 | log4cpp.appender.rootAppender.layout=BasicLayout 9 | 10 | log4cpp.appender.A1=FileAppender 11 | log4cpp.appender.A1.fileName=A1.log 12 | log4cpp.appender.A1.layout=PatternLayout 13 | log4cpp.appender.A1.layout.ConversionPattern=The message %m at time %d, thread %t%n 14 | 15 | log4cpp.appender.A2=FileAppender 16 | log4cpp.appender.A2.threshold=WARN 17 | log4cpp.appender.A2.fileName=A2.log 18 | log4cpp.appender.A2.layout=PatternLayout 19 | log4cpp.appender.A2.layout.ConversionPattern=The message %m at time %d, thread %t%n 20 | 21 | log4cpp.appender.A3=RollingFileAppender 22 | log4cpp.appender.A3.fileName=A3.log 23 | log4cpp.appender.A3.maxFileSize=80 24 | log4cpp.appender.A3.maxBackupIndex=2 25 | log4cpp.appender.A3.layout=PatternLayout 26 | log4cpp.appender.A3.layout.ConversionPattern=The message %m at time %d{%H:%M:%S,%l}%n 27 | 28 | log4cpp.appender.stderrAppender=ConsoleAppender 29 | log4cpp.appender.stderrAppender.layout=PatternLayout 30 | log4cpp.appender.stderrAppender.layout.ConversionPattern=stderr: %m%n 31 | log4cpp.appender.stderrAppender.target=stdErr 32 | log4cpp.appender.stderrAppender.threshold=ERROR 33 | 34 | log4cpp.appender.stdoutAppender=ConsoleAppender 35 | log4cpp.appender.stdoutAppender.layout=PatternLayout 36 | log4cpp.appender.stdoutAppender.layout.ConversionPattern=stdout: %m%n 37 | log4cpp.appender.stdoutAppender.target=StdOut 38 | log4cpp.appender.stdoutAppender.threshold=ERROR 39 | 40 | log4cpp.category.subNT=INFO, subNT 41 | log4cpp.appender.subNT=NTEventLogAppender 42 | log4cpp.appender.subNT.source=log4cpp-test 43 | -------------------------------------------------------------------------------- /tests/log4cpp.properties: -------------------------------------------------------------------------------- 1 | # Set root category priority to DEBUG and its only appender to A1. 2 | log4j.rootCategory=ERROR, A4 3 | 4 | # categories for Board Control 5 | log4j.category.BoardControl=INFO, A4 6 | log4j.category.BoardControl.additivity=false 7 | 8 | # A1 is set to be a ConsoleAppender. 9 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 10 | log4j.appender.A1.layout=org.apache.log4j.BasicLayout 11 | 12 | log4j.appender.A2=org.apache.log4j.RemoteSyslogAppender 13 | log4j.appender.A2.syslogName=log4cppApp 14 | log4j.appender.A2.syslogHost=localhost 15 | log4j.appender.A2.facility=-1 16 | log4j.appender.A2.portNumber=-1 17 | log4j.appender.A2.layout=org.apache.log4j.BasicLayout 18 | 19 | log4cpp.appender.A3=org.apache.log4j.Win32DebugAppender 20 | log4cpp.appender.A3.layout=org.apache.log4j.BasicLayout 21 | 22 | appender.A4=org.apache.log4j.FileAppender 23 | appender.A4.fileName=smas2.log 24 | appender.A4.layout=org.apache.log4j.BasicLayout 25 | 26 | -------------------------------------------------------------------------------- /tests/log4cpp.property: -------------------------------------------------------------------------------- 1 | # property configurator test file 2 | 3 | log4cpp.rootCategory=,EBUG, rootAppender 4 | log4cpp.category.sub1=DEBUG, A1, A2, stderrAppender, stdoutAppender 5 | log4cpp.category.sub1.sub2=DEBUG, A3 6 | 7 | log4cpp.appender.rootAppender=ConsoleAppender 8 | log4cpp.appender.rootAppender.layout=BasicLayout 9 | 10 | log4cpp.appender.A1=FileAppender 11 | log4cpp.appender.A1.fileName=A1.log 12 | log4cpp.appender.A1.layout=PatternLayout 13 | log4cpp.appender.A1.layout.ConversionPattern=The message %m at time %d, thread %t%n 14 | 15 | log4cpp.appender.A2=FileAppender 16 | log4cpp.appender.A2.threshold=WARN 17 | log4cpp.appender.A2.fileName=A2.log 18 | log4cpp.appender.A2.layout=PatternLayout 19 | log4cpp.appender.A2.layout.ConversionPattern=The message %m at time %d, thread %t%n 20 | 21 | log4cpp.appender.A3=RollingFileAppender 22 | log4cpp.appender.A3.fileName=A3.log 23 | log4cpp.appender.A3.maxFileSize=80 24 | log4cpp.appender.A3.maxBackupIndex=1 25 | log4cpp.appender.A3.layout=PatternLayout 26 | log4cpp.appender.A3.layout.ConversionPattern=The message %m at time %d{%H:%M}%n 27 | 28 | log4cpp.appender.stderrAppender=ConsoleAppender 29 | log4cpp.appender.stderrAppender.layout=PatternLayout 30 | log4cpp.appender.stderrAppender.layout.ConversionPattern=stderr: %m%n 31 | log4cpp.appender.stderrAppender.target=stdErr 32 | log4cpp.appender.stderrAppender.threshold=ERROR 33 | 34 | log4cpp.appender.stdoutAppender=ConsoleAppender 35 | log4cpp.appender.stdoutAppender.layout=PatternLayout 36 | log4cpp.appender.stdoutAppender.layout.ConversionPattern=stdout: %m%n 37 | log4cpp.appender.stdoutAppender.target=StdOut 38 | log4cpp.appender.stdoutAppender.threshold=ERROR 39 | -------------------------------------------------------------------------------- /tests/nesteddir/.gitignore: -------------------------------------------------------------------------------- 1 | *.log.* 2 | -------------------------------------------------------------------------------- /tests/testConfig.cpp: -------------------------------------------------------------------------------- 1 | // testConfig.cpp : Derived from testPattern.cpp. 2 | // 3 | 4 | #include 5 | 6 | #ifdef WIN32 7 | #include 8 | #endif 9 | #ifdef LOG4CPP_HAVE_UNISTD_H 10 | #include 11 | #endif 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | double calcPi() 28 | { 29 | double denominator = 3.0; 30 | double retVal = 4.0; 31 | long i; 32 | for (i = 0; i < 50000000l; i++) 33 | { 34 | retVal = retVal - (4.0 / denominator); 35 | denominator += 2.0; 36 | retVal = retVal + (4.0 /denominator); 37 | denominator += 2.0; 38 | } 39 | return retVal; 40 | } 41 | 42 | int main(int argc, char* argv[]) 43 | { 44 | try { 45 | /* looking for the init file in $srcdir is a requirement of 46 | automake's distcheck target. 47 | */ 48 | char* srcdir = getenv("srcdir"); 49 | std::string initFileName; 50 | if (srcdir == NULL) { 51 | initFileName = "./log4cpp.init"; 52 | } 53 | else { 54 | initFileName = std::string(srcdir) + "/log4cpp.init"; 55 | } 56 | log4cpp::SimpleConfigurator::configure(initFileName); 57 | } catch(log4cpp::ConfigureFailure& f) { 58 | std::cout << "Configure Problem " << f.what() << std::endl; 59 | return -1; 60 | } 61 | 62 | log4cpp::Category& root = log4cpp::Category::getRoot(); 63 | 64 | log4cpp::Category& sub1 = 65 | log4cpp::Category::getInstance(std::string("sub1")); 66 | 67 | log4cpp::Category& sub2 = 68 | log4cpp::Category::getInstance(std::string("sub1.sub2")); 69 | 70 | root.error("root error"); 71 | root.warn("root warn"); 72 | sub1.error("sub1 error"); 73 | sub1.warn("sub1 warn"); 74 | 75 | calcPi(); 76 | 77 | sub2.error("sub2 error"); 78 | sub2.warn("sub2 warn"); 79 | 80 | root.error("root error"); 81 | root.warn("root warn"); 82 | sub1.error("sub1 error"); 83 | sub1.warn("sub1 warn"); 84 | 85 | #ifdef WIN32 86 | Sleep(3000); 87 | #else 88 | sleep(3); 89 | #endif 90 | 91 | sub2.error("sub2 error"); 92 | sub2.warn("sub2 warn"); 93 | sub2.error("%s %s %d", "test", "vform", 123); 94 | sub2.warnStream() << "streamed warn"; 95 | 96 | sub2 << log4cpp::Priority::WARN << "warn2.." << "..warn3..value=" << 0 97 | << log4cpp::eol << "..warn4"; 98 | 99 | log4cpp::Category::shutdown(); 100 | 101 | return 0; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /tests/testConfig.log4cpp.dailyroll.properties: -------------------------------------------------------------------------------- 1 | # a DailyRollingFileAppender test config 2 | 3 | log4j.rootCategory=DEBUG, rootAppender 4 | log4j.category.sub1=,DAILY, NCDAILY 5 | 6 | log4j.appender.rootAppender=org.apache.log4j.ConsoleAppender 7 | log4j.appender.rootAppender.layout=org.apache.log4j.BasicLayout 8 | 9 | log4cpp.appender.DAILY=DailyRollingFileAppender 10 | log4cpp.appender.DAILY.fileName=dailyrolling.log 11 | log4cpp.appender.DAILY.maxDaysKeep=1 12 | log4cpp.appender.DAILY.layout=PatternLayout 13 | log4cpp.appender.DAILY.layout.ConversionPattern=%d [%p] The message %m at time %d{%H:%M}%n 14 | 15 | log4cpp.appender.NCDAILY=DailyRollingFileAppender 16 | log4cpp.appender.NCDAILY.fileName=nesteddir/dailyrolling.log 17 | log4cpp.appender.NCDAILY.maxDaysKeep=1 18 | log4cpp.appender.NCDAILY.layout=PatternLayout 19 | log4cpp.appender.NCDAILY.layout.ConversionPattern=%d [%p] The message %m at time %d{%H:%M}%n 20 | -------------------------------------------------------------------------------- /tests/testErrorCollision.cpp: -------------------------------------------------------------------------------- 1 | #define ERROR 666 2 | #define LOG4CPP_FIX_ERROR_COLLISION 1 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char** argv) { 8 | assert(ERROR == 666); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /tests/testFilter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | class TestFilter : public log4cpp::Filter { 5 | public: 6 | TestFilter() {}; 7 | virtual ~TestFilter() {}; 8 | 9 | protected: 10 | virtual log4cpp::Filter::Decision _decide(const log4cpp::LoggingEvent& event) { 11 | log4cpp::Filter::Decision decision = log4cpp::Filter::NEUTRAL; 12 | 13 | if (event.categoryName == "deny") 14 | decision = log4cpp::Filter::DENY; 15 | 16 | if (event.categoryName == "accept") 17 | decision = log4cpp::Filter::ACCEPT; 18 | 19 | return decision; 20 | }; 21 | }; 22 | 23 | 24 | class TestFilter2 : public log4cpp::Filter { 25 | public: 26 | TestFilter2() {}; 27 | virtual ~TestFilter2() {}; 28 | 29 | protected: 30 | virtual log4cpp::Filter::Decision _decide(const log4cpp::LoggingEvent& event) { 31 | log4cpp::Filter::Decision decision = log4cpp::Filter::NEUTRAL; 32 | 33 | if (event.ndc == "test") 34 | decision = log4cpp::Filter::DENY; 35 | 36 | return decision; 37 | }; 38 | }; 39 | 40 | int main(int argc, char** argv) { 41 | TestFilter filter; 42 | 43 | bool resultsOK = true; 44 | 45 | std::cout << "decision 1 (should be 1): " << filter.decide(log4cpp::LoggingEvent("accept", "bla", "ndc", log4cpp::Priority::INFO)) << std::endl; 46 | 47 | std::cout << "decision 2 (should be -1): " << filter.decide(log4cpp::LoggingEvent("deny", "bla", "ndc", log4cpp::Priority::INFO)) << std::endl; 48 | 49 | std::cout << "decision 3 (should be 0): " << filter.decide(log4cpp::LoggingEvent("neither", "bla", "ndc", log4cpp::Priority::INFO)) << std::endl; 50 | 51 | std::cout << "decision 4 (should be 0): " << filter.decide(log4cpp::LoggingEvent("neither", "bla", "test", log4cpp::Priority::INFO)) << std::endl; 52 | 53 | filter.setChainedFilter(new TestFilter2()); 54 | 55 | std::cout << "decision 5 (should be 0): " << filter.decide(log4cpp::LoggingEvent("neither", "bla", "ndc", log4cpp::Priority::INFO)) << std::endl; 56 | 57 | std::cout << "decision 6 (should be -1): " << filter.decide(log4cpp::LoggingEvent("neither", "bla", "test", log4cpp::Priority::INFO)) << std::endl; 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /tests/testFixedContextCategory.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "log4cpp/FixedContextCategory.hh" 4 | #include "log4cpp/Appender.hh" 5 | #include "log4cpp/OstreamAppender.hh" 6 | #include "log4cpp/Layout.hh" 7 | #include "log4cpp/BasicLayout.hh" 8 | #include "log4cpp/Priority.hh" 9 | #include "log4cpp/NDC.hh" 10 | 11 | int main(int argc, char** argv) { 12 | log4cpp::Appender* appender = 13 | new log4cpp::OstreamAppender("default", &std::cout); 14 | 15 | log4cpp::Layout* layout = new log4cpp::BasicLayout(); 16 | appender->setLayout(layout); 17 | 18 | log4cpp::Category& root = log4cpp::Category::getRoot(); 19 | root.addAppender(appender); 20 | root.setPriority(log4cpp::Priority::ERROR); 21 | 22 | log4cpp::FixedContextCategory sub1(std::string("sub1"), std::string("context1")); 23 | 24 | log4cpp::FixedContextCategory sub1_2(std::string("sub1"), std::string("context1_2")); 25 | 26 | log4cpp::FixedContextCategory sub2(std::string("sub1.sub2"), std::string("context2")); 27 | 28 | std::cout << " root priority = " << root.getPriority() << std::endl; 29 | std::cout << " sub1 priority = " << sub1.getPriority() << std::endl; 30 | std::cout << " sub2 priority = " << sub2.getPriority() << std::endl; 31 | 32 | root.error("root error"); 33 | root.warn("root warn"); 34 | sub1.error("sub1 error"); 35 | sub1.warn("sub1 warn"); 36 | sub1_2.error("sub1 error"); 37 | sub1_2.warn("sub1 warn"); 38 | sub2.error("sub2 error"); 39 | sub2.warn("sub2 warn"); 40 | 41 | log4cpp::Category::getInstance(std::string("sub1")). 42 | setPriority(log4cpp::Priority::INFO); 43 | 44 | std::cout << " root priority = " << root.getPriority() << std::endl; 45 | std::cout << " sub1 priority = " << sub1.getPriority() << std::endl; 46 | std::cout << " sub2 priority = " << sub2.getPriority() << std::endl; 47 | 48 | std::cout << "priority info" << std::endl; 49 | root.error("root error"); 50 | root.warn("root warn"); 51 | sub1.error("sub1 error"); 52 | sub1.warn("sub1 warn"); 53 | sub2.error("sub2 error"); 54 | sub2.warn("sub2 warn"); 55 | sub2.error("%s %s %d", "test", "vform", 123); 56 | sub2.warnStream() << "streamed warn"; 57 | 58 | sub2 << log4cpp::Priority::WARN << "warn2.." << "..warn3..value=" << 0 59 | << log4cpp::eol << "..warn4"; 60 | 61 | log4cpp::Category::shutdown(); 62 | 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /tests/testNDC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "log4cpp/NDC.hh" 3 | 4 | using namespace log4cpp; 5 | 6 | int main(int argc, char** argv) { 7 | std::cout << "1. empty NDC: " << NDC::get() << std::endl; 8 | 9 | NDC::push("context1"); 10 | std::cout << "2. push context1: " << NDC::get() << std::endl; 11 | 12 | NDC::push("context2"); 13 | std::cout << "3. push context2: " << NDC::get() << std::endl; 14 | NDC::push("context3"); 15 | std::cout << "4. push context3: " << NDC::get() << std::endl; 16 | std::cout << "5. get depth: " << NDC::getDepth() << std::endl; 17 | 18 | std::cout << "6. pop: " << NDC::pop() << std::endl; 19 | 20 | NDC::clear(); 21 | std::cout << "7. clear: " << NDC::get() << std::endl; 22 | 23 | return 0; 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/testNDCMain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "cppunit/TestRegistry.h" 3 | #include "cppunit/TextTestResult.h" 4 | #include "cppunit/Test.h" 5 | #include "cppunit/TestSuite.h" 6 | #include "log4cpp/NDC.hh" 7 | #include "NDCTest.hh" 8 | 9 | int main(int argc, char** argv) { 10 | NDCTest nDCTest("NDCTest"); 11 | 12 | CppUnit::TextTestResult result; 13 | CppUnit::TestSuite suite; 14 | 15 | nDCTest.registerTests(&suite); 16 | 17 | std::vector tests = CppUnit::TestRegistry::getRegistry().getAllTests(); 18 | for(std::vector::iterator i = tests.begin(); i != tests.end(); i++) { 19 | (*i)->run(&result); 20 | } 21 | 22 | cout << result; 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /tests/testNTEventLog.cpp: -------------------------------------------------------------------------------- 1 | // testNTEventLog.cpp : Derived from testPattern.cpp. 2 | // 3 | 4 | #include "log4cpp/Portability.hh" 5 | 6 | #ifdef WIN32 7 | #include 8 | #endif 9 | #ifdef LOG4CPP_HAVE_UNISTD_H 10 | #include 11 | #endif 12 | 13 | #include 14 | 15 | #include "log4cpp/Category.hh" 16 | #include "log4cpp/Appender.hh" 17 | #include "log4cpp/NTEventLogAppender.hh" 18 | #include "log4cpp/Priority.hh" 19 | 20 | int main(int argc, char* argv[]) 21 | { 22 | log4cpp::Appender* appender = 23 | new log4cpp::NTEventLogAppender("default", "testNTEventLog"); 24 | 25 | log4cpp::Category& sub1 = 26 | log4cpp::Category::getInstance(std::string("sub1")); 27 | sub1.addAppender(appender); 28 | sub1.setPriority(log4cpp::Priority::DEBUG); 29 | 30 | sub1.emerg("sub1 emerg"); 31 | sub1.fatal("sub1 fatal"); 32 | sub1.alert("sub1 alert"); 33 | sub1.crit("sub1 crit"); 34 | sub1.error("sub1 error"); 35 | sub1.warn("sub1 warn"); 36 | sub1.notice("sub1 notice"); 37 | sub1.info("sub1 info"); 38 | sub1.debug("sub1 debug"); 39 | sub1.log(log4cpp::Priority::NOTSET, "sub1 notset"); 40 | sub1.log(log4cpp::Priority::ERROR, "sub1 error"); 41 | 42 | log4cpp::Category::shutdown(); 43 | 44 | return 0; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /tests/testPattern.cpp: -------------------------------------------------------------------------------- 1 | // testLog4CPP.cpp : Derived from testCategory.cpp 2 | // 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | void test(std::string pattern, log4cpp::PatternLayout* layout, log4cpp::Category& cat) 12 | { 13 | try { 14 | layout->setConversionPattern(pattern); 15 | cat.error("message"); 16 | } catch(log4cpp::ConfigureFailure& f) { 17 | std::cerr << "configure failure: " << f.what() << std::endl; 18 | } 19 | } 20 | 21 | int main(int argc, char* argv[]) 22 | { 23 | log4cpp::BasicConfigurator::configure(); 24 | log4cpp::PatternLayout* layout = new log4cpp::PatternLayout(); 25 | log4cpp::Category::getRoot().getAppender()->setLayout(layout); 26 | 27 | log4cpp::Category& cat = log4cpp::Category::getInstance("cat1"); 28 | 29 | log4cpp::NDC::push("ndc1"); 30 | 31 | test("%% %r %c:%d (%R / %r) [%p] %x %m %% (%u) %n", layout, cat); 32 | 33 | // test format specifiers 34 | test(">%10m<%n", layout, cat); 35 | test(">%-10m<%n", layout, cat); 36 | test(">%3.5m<%n", layout, cat); 37 | test(">%.5m<%n", layout, cat); 38 | 39 | // category test 40 | test(">%c{2}<%n", layout, log4cpp::Category::getInstance("c1.c2.c3.c4")); 41 | 42 | // test date format 43 | test("%d{%d %b %Y %H:%M:%S.%l} %m %n", layout, cat); 44 | test("%d{%d %b %Y %H:%M:%S.%l", layout, cat); 45 | test("%d%n", layout, cat); 46 | 47 | test("%m %d%n", layout, cat); 48 | int i; 49 | for (i = 0; i < 10; i++) { 50 | cat.error("%d message", i); 51 | } 52 | test("%m %d{%H:%M:%S.%l %d %b %Y}%n", layout, cat); 53 | for (i = 0; i < 10; i++) { 54 | cat.error("%d message", i); 55 | } 56 | 57 | // test bug #688715 58 | test("%.10m", layout, cat); 59 | 60 | log4cpp::Category::shutdown(); 61 | 62 | return 0; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /tests/testPriority.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "log4cpp/Priority.hh" 3 | 4 | using namespace log4cpp; 5 | 6 | int main(int argc, char** argv) { 7 | 8 | std::cout << "priority debug(700): " << Priority::getPriorityName(700) << std::endl; 9 | std::cout << "priority debug(700): " << Priority::getPriorityValue("DEBUG") << std::endl; 10 | std::cout << "priority debug(700): " << Priority::getPriorityValue("700") << std::endl; 11 | try { 12 | std::cout << "priority debug(700): " << Priority::getPriorityValue("700arghh") << std::endl; 13 | } catch(std::invalid_argument& e) { 14 | std::cout << "caught " << e.what() << std::endl; 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /tests/testPropConfig.cpp: -------------------------------------------------------------------------------- 1 | // testConfig.cpp : Derived from testPattern.cpp. 2 | // 3 | 4 | #include 5 | 6 | #ifdef WIN32 7 | #include 8 | #endif 9 | #ifdef LOG4CPP_HAVE_UNISTD_H 10 | #include 11 | #endif 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | void testPropConfigRead() { 23 | std::string initFileName; 24 | #if defined(WIN32) 25 | initFileName = "./log4cpp.nt.property"; 26 | #else 27 | initFileName = "./log4cpp.property"; 28 | #endif 29 | log4cpp::PropertyConfigurator::configure(initFileName); 30 | 31 | log4cpp::Category& root = log4cpp::Category::getRoot(); 32 | 33 | log4cpp::Category& sub1 = 34 | log4cpp::Category::getInstance(std::string("sub1")); 35 | 36 | log4cpp::Category& sub2 = 37 | log4cpp::Category::getInstance(std::string("sub1.sub2")); 38 | 39 | root.error("root error"); 40 | root.warn("root warn"); 41 | sub1.error("sub1 error"); 42 | sub1.warn("sub1 warn"); 43 | // the following 2 should only be in A1, not A2 44 | sub1.info("sub1 info"); 45 | sub1.debug("sub1 debug"); 46 | 47 | // do a few so that the log rolls over 48 | sub2.warn("sub2 warn 1"); 49 | sub2.warn("sub2 warn 2"); 50 | sub2.warn("sub2 warn 3"); 51 | sub2.warn("sub2 warn 4"); 52 | sub2.warn("sub2 warn 5"); 53 | sub2.warn("sub2 warn 6"); 54 | sub2.warn("sub2 warn 7"); 55 | 56 | #if defined(WIN32) 57 | log4cpp::Category& nt = 58 | log4cpp::Category::getInstance(std::string("subNT")); 59 | nt.error("subNT error"); 60 | nt.warn("subNT warn"); 61 | nt.debug("subNT debug"); 62 | #endif 63 | 64 | log4cpp::Category::shutdownForced(); 65 | // log4cpp::Category::shutdown(); 66 | } 67 | 68 | int main(int argc, char* argv[]) 69 | { 70 | // _CRTDBG_MAP_ALLOC is for detecting memory leaks on Windows 71 | #ifdef _CRTDBG_MAP_ALLOC 72 | _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); 73 | #endif 74 | 75 | try { 76 | // test single properties read 77 | testPropConfigRead(); 78 | 79 | // test few more instantiations and shutdowns by shutdownForced() 80 | for (int i=0; i < 2; ++i) { 81 | testPropConfigRead(); 82 | } 83 | } catch(log4cpp::ConfigureFailure& f) { 84 | std::cout << "Configure Problem " << f.what() << std::endl; 85 | return -1; 86 | } 87 | 88 | #ifdef _CRTDBG_MAP_ALLOC 89 | //_CrtDumpMemoryLeaks(); // would give detected leaks, since statically allocated objects were not freed yet 90 | #endif 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /tests/testProperties.cpp: -------------------------------------------------------------------------------- 1 | #include "Properties.hh" 2 | #include 3 | #include 4 | 5 | int main(int argc, char** argv) { 6 | log4cpp::Properties properties; 7 | std::string inFile = (argc > 1) ? argv[1] : "log4cpp.properties"; 8 | std::ifstream in(inFile.c_str()); 9 | 10 | properties.load(in); 11 | properties.save(std::cout); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /tests/testProperties.properties: -------------------------------------------------------------------------------- 1 | # Set root category priority to DEBUG and its only appender to A1. 2 | log4j.rootCategory=ERROR, A4 3 | 4 | # categories for Board Control 5 | log4j.category.BoardControl=INFO, A4 6 | log4j.category.BoardControl.additivity=false 7 | 8 | # A1 is set to be a ConsoleAppender. 9 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 10 | log4j.appender.A1.layout=org.apache.log4j.BasicLayout 11 | 12 | log4j.appender.A2=org.apache.log4j.RemoteSyslogAppender 13 | log4j.appender.A2.syslogName=log4cppApp 14 | log4j.appender.A2.syslogHost=localhost 15 | log4j.appender.A2.facility=-1 16 | log4j.appender.A2.portNumber=-1 17 | log4j.appender.A2.layout=org.apache.log4j.BasicLayout 18 | 19 | log4cpp.appender.A3=org.apache.log4j.Win32DebugAppender 20 | log4cpp.appender.A3.layout=org.apache.log4j.BasicLayout 21 | 22 | appender.A4=org.apache.log4j.FileAppender 23 | appender.A4.fileName=smas2.log 24 | appender.A4.layout=org.apache.log4j.BasicLayout 25 | 26 | test.subst.1=> ${HOME} < 27 | test.subst.2=> ${HOME} 1 ${HOME} 2 ${HOME} < 28 | test.subst.3=> ${appender.A4} < 29 | test.subst.4=> ${DOESNTEXIST} < 30 | test.subst.5=> ${ no closing tag < 31 | test.subst.6=> ${${} < 32 | -------------------------------------------------------------------------------- /tests/testRollingFileAppender.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace log4cpp; 9 | using namespace std; 10 | static const char* const test_message = "message"; 11 | 12 | bool remove_impl(const char* filename) 13 | { 14 | int res = remove(filename); 15 | 16 | if (res != 0 && errno != ENOENT) 17 | cout << "Can't remove file '" << filename << "'.\n"; 18 | 19 | return res == 0 || (res != 0 && errno == ENOENT); 20 | } 21 | 22 | bool remove_files() 23 | { 24 | if (!remove_impl("rolling_file.log")) 25 | return false; 26 | if (!remove_impl("rolling_file.log.1")) 27 | return false; 28 | if (!remove_impl("rolling_file.log.2")) 29 | return false; 30 | 31 | return true; 32 | } 33 | 34 | bool setup() 35 | { 36 | if (!remove_files()) 37 | return false; 38 | 39 | Category& root = Category::getRoot(); 40 | root.addAppender(new RollingFileAppender("rolling-appender", "rolling_file.log", 40, 3)); 41 | root.setPriority(Priority::DEBUG); 42 | 43 | return true; 44 | } 45 | 46 | void make_log_files() 47 | { 48 | Category::getRoot().debugStream() << test_message << 1; 49 | Category::getRoot().debugStream() << test_message << 2; 50 | Category::getRoot().debugStream() << test_message << 3; 51 | Category::getRoot().debugStream() << test_message << 4; 52 | Category::getRoot().debugStream() << test_message << 5; 53 | } 54 | 55 | bool exists(const char* filename) 56 | { 57 | FILE* f = fopen(filename, "r"); 58 | if (f == NULL) 59 | { 60 | cout << "File '" << filename << "' doesn't exists.\n"; 61 | return false; 62 | } 63 | 64 | fclose(f); 65 | 66 | return true; 67 | } 68 | 69 | bool check_log_files() 70 | { 71 | bool result = exists("rolling_file.log") && 72 | exists("rolling_file.log.1") && 73 | exists("rolling_file.log.2"); 74 | 75 | Category::shutdown(); 76 | return result && remove_files(); 77 | } 78 | 79 | int main() 80 | { 81 | if (!setup()) 82 | { 83 | cout << "Setup has failed. Check for permissions on files 'rolling_file.log*'.\n"; 84 | return -1; 85 | } 86 | 87 | make_log_files(); 88 | 89 | if (check_log_files()) 90 | return 0; 91 | else 92 | return -1; 93 | } -------------------------------------------------------------------------------- /tests/test_convenience.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | LOG4CPP_LOGGER("c_test"); 4 | LOG4CPP_LOGGER_N(named_logger, "n_logger"); 5 | 6 | int main() 7 | { 8 | LOG4CPP_EMERG(logger, "emerg"); 9 | LOG4CPP_FATAL(logger, "fatal"); 10 | LOG4CPP_ALERT(logger, "alert"); 11 | LOG4CPP_CRIT(logger, "crit"); 12 | LOG4CPP_ERROR(logger, "error"); 13 | LOG4CPP_WARN(logger, "warn"); 14 | LOG4CPP_NOTICE(logger, "notice"); 15 | LOG4CPP_INFO(logger, "info"); 16 | LOG4CPP_DEBUG(logger, "debug"); 17 | 18 | LOG4CPP_INFO(named_logger, "this is named logger"); 19 | 20 | LOG4CPP_EMERG_S(logger) << "emerg"; 21 | LOG4CPP_FATAL_S(logger) << "fatal"; 22 | LOG4CPP_ALERT_S(logger) << "alert"; 23 | LOG4CPP_CRIT_S(logger) << "crit"; 24 | LOG4CPP_ERROR_S(logger) << "error"; 25 | LOG4CPP_WARN_S(logger) << "warn"; 26 | LOG4CPP_NOTICE_S(logger) << "notice"; 27 | LOG4CPP_INFO_S(logger) << "info"; 28 | LOG4CPP_DEBUG_S(logger) << "debug"; 29 | 30 | 31 | LOG4CPP_EMERG_SD() << "emerg"; 32 | LOG4CPP_FATAL_SD() << "fatal"; 33 | LOG4CPP_ALERT_SD() << "alert"; 34 | LOG4CPP_CRIT_SD() << "crit"; 35 | LOG4CPP_ERROR_SD() << "error"; 36 | LOG4CPP_WARN_SD() << "warn"; 37 | LOG4CPP_NOTICE_SD() << "notice"; 38 | LOG4CPP_INFO_SD() << "info"; 39 | LOG4CPP_DEBUG_SD() << "debug"; 40 | 41 | return 0; 42 | } --------------------------------------------------------------------------------