LOGCXX-500: I wasn't sure about the conflict merging before after merging "master" and simply did it again.
# Conflicts: # pom.xml # src/main/cpp/appenderskeleton.cpp # src/main/cpp/asyncappender.cpp # src/main/cpp/fileappender.cpp # src/main/cpp/gzcompressaction.cpp # src/main/cpp/locationinfo.cpp # src/main/cpp/logger.cpp # src/main/cpp/loggingevent.cpp # src/main/cpp/mutex.cpp # src/main/cpp/objectoutputstream.cpp # src/main/cpp/odbcappender.cpp # src/main/cpp/rollingfileappender.cpp # src/main/cpp/smtpappender.cpp # src/main/cpp/socket.cpp # src/main/cpp/socketappender.cpp # src/main/cpp/socketappenderskeleton.cpp # src/main/cpp/threadcxx.cpp # src/main/cpp/writerappender.cpp # src/main/cpp/zipcompressaction.cpp # src/main/include/log4cxx/appenderskeleton.h # src/main/include/log4cxx/asyncappender.h # src/main/include/log4cxx/helpers/messagebuffer.h # src/main/include/log4cxx/helpers/objectoutputstream.h # src/main/include/log4cxx/helpers/objectptr.h # src/main/include/log4cxx/helpers/thread.h # src/main/include/log4cxx/net/socketappender.h # src/main/include/log4cxx/net/telnetappender.h # src/main/include/log4cxx/rolling/timebasedrollingpolicy.h Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/7dabde01 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/7dabde01 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/7dabde01 Branch: refs/heads/master Commit: 7dabde01eba3fb2efb56aa0a9b6a2101bda921f5 Parents: 88fd716 2fe5572 Author: Thorsten Schöning <[email protected]> Authored: Mon Aug 20 08:43:51 2018 +0200 Committer: Thorsten Schöning <[email protected]> Committed: Mon Aug 20 08:43:51 2018 +0200 ---------------------------------------------------------------------- .gitignore | 29 + INSTALL | 119 - KEYS | 149 +- Makefile.am | 12 +- autogen.sh | 4 +- build.xml | 3347 ++++--- configure.ac | 493 + configure.in | 491 - doap_log4cxx.rdf | 50 +- find_apr.m4 | 202 - find_apu.m4 | 211 - liblog4cxx.pc.in | 1 + pom.xml | 640 +- release_perform.sh | 97 + release_prepare.sh | 242 + release_purge.sh | 79 + src/Makefile.am | 3 +- src/ant/apr-build.xml | 1173 ++- src/ant/apr-util-build.xml | 960 +- src/ant/common.xml | 371 +- src/ant/esmtp-build.xml | 251 +- src/ant/find-apr-util.xml | 488 +- src/ant/find-apr.xml | 489 +- src/ant/find-libesmtp.xml | 484 +- src/assembly/source.xml | 178 +- src/changes/changes.xml | 802 +- src/changes/changes.xslt | 225 - src/examples/cpp/Makefile.am | 5 +- src/examples/cpp/console.cpp | 7 + src/m4/Makefile.am | 23 + src/m4/find_apr.m4 | 202 + src/m4/find_apu.m4 | 211 + src/main/cpp/Makefile.am | 8 +- src/main/cpp/andfilter.cpp | 67 + src/main/cpp/aprinitializer.cpp | 58 +- src/main/cpp/asyncappender.cpp | 10 +- src/main/cpp/bytearrayinputstream.cpp | 0 src/main/cpp/cacheddateformat.cpp | 42 +- src/main/cpp/charsetdecoder.cpp | 4 +- src/main/cpp/charsetencoder.cpp | 10 +- src/main/cpp/condition.cpp | 0 src/main/cpp/consoleappender.cpp | 18 +- src/main/cpp/dailyrollingfileappender.cpp | 14 +- src/main/cpp/date.cpp | 5 +- src/main/cpp/defaultconfigurator.cpp | 0 src/main/cpp/domconfigurator.cpp | 93 +- src/main/cpp/fileappender.cpp | 6 +- src/main/cpp/filewatchdog.cpp | 14 +- src/main/cpp/fixedwindowrollingpolicy.cpp | 117 +- src/main/cpp/gzcompressaction.cpp | 10 +- src/main/cpp/hierarchy.cpp | 12 +- src/main/cpp/inputstreamreader.cpp | 3 + src/main/cpp/level.cpp | 43 +- src/main/cpp/levelrangefilter.cpp | 2 +- src/main/cpp/locationinfo.cpp | 46 +- src/main/cpp/logger.cpp | 11 +- src/main/cpp/loggermatchfilter.cpp | 75 + src/main/cpp/loggingevent.cpp | 4 +- src/main/cpp/loglog.cpp | 95 +- src/main/cpp/logstream.cpp | 40 +- src/main/cpp/mutex.cpp | 11 +- src/main/cpp/ndc.cpp | 4 +- src/main/cpp/nteventlogappender.cpp | 5 +- src/main/cpp/objectoutputstream.cpp | 305 +- src/main/cpp/objectptr.cpp | 0 src/main/cpp/obsoleterollingfileappender.cpp | 24 +- src/main/cpp/odbcappender.cpp | 49 +- src/main/cpp/outputstream.cpp | 11 + src/main/cpp/outputstreamwriter.cpp | 10 + src/main/cpp/pool.cpp | 0 src/main/cpp/properties.cpp | 77 +- src/main/cpp/propertiespatternconverter.cpp | 2 + src/main/cpp/propertyconfigurator.cpp | 52 +- src/main/cpp/rollingfileappender.cpp | 335 +- src/main/cpp/simpledateformat.cpp | 30 +- src/main/cpp/smtpappender.cpp | 26 +- src/main/cpp/socket.cpp | 12 +- src/main/cpp/socketappender.cpp | 111 +- src/main/cpp/socketappenderskeleton.cpp | 31 +- src/main/cpp/sockethubappender.cpp | 1 + src/main/cpp/socketoutputstream.cpp | 3 + src/main/cpp/stringhelper.cpp | 10 + src/main/cpp/synchronized.cpp | 12 + src/main/cpp/syslogappender.cpp | 29 +- src/main/cpp/syslogwriter.cpp | 8 +- src/main/cpp/systemoutwriter.cpp | 1 - src/main/cpp/telnetappender.cpp | 8 +- src/main/cpp/threadcxx.cpp | 213 +- src/main/cpp/threadspecificdata.cpp | 3 +- src/main/cpp/timebasedrollingpolicy.cpp | 196 +- src/main/cpp/transcoder.cpp | 8 +- src/main/cpp/writer.cpp | 7 + src/main/cpp/writerappender.cpp | 11 +- src/main/cpp/zipcompressaction.cpp | 116 +- src/main/include/log4cxx/Makefile.am | 36 +- src/main/include/log4cxx/appenderskeleton.h | 22 +- src/main/include/log4cxx/asyncappender.h | 2 + src/main/include/log4cxx/config/Makefile.am | 4 +- src/main/include/log4cxx/consoleappender.h | 1 - src/main/include/log4cxx/db/Makefile.am | 4 +- src/main/include/log4cxx/db/odbcappender.h | 4 + src/main/include/log4cxx/defaultconfigurator.h | 0 src/main/include/log4cxx/filter/Makefile.am | 13 +- src/main/include/log4cxx/filter/andfilter.h | 1 + src/main/include/log4cxx/filter/denyallfilter.h | 4 +- .../include/log4cxx/filter/levelmatchfilter.h | 2 +- .../include/log4cxx/filter/loggermatchfilter.h | 104 + src/main/include/log4cxx/helpers/Makefile.am | 74 +- .../include/log4cxx/helpers/aprinitializer.h | 26 +- .../log4cxx/helpers/bytearrayinputstream.h | 2 +- .../log4cxx/helpers/bytearrayoutputstream.h | 3 +- src/main/include/log4cxx/helpers/condition.h | 0 .../include/log4cxx/helpers/fileoutputstream.h | 3 + src/main/include/log4cxx/helpers/mutex.h | 0 src/main/include/log4cxx/helpers/object.h | 6 +- .../log4cxx/helpers/objectoutputstream.h | 137 +- src/main/include/log4cxx/helpers/objectptr.h | 15 +- src/main/include/log4cxx/helpers/outputstream.h | 7 + .../log4cxx/helpers/outputstreamwriter.h | 4 + src/main/include/log4cxx/helpers/pool.h | 0 .../log4cxx/helpers/relativetimedateformat.h | 2 +- .../include/log4cxx/helpers/simpledateformat.h | 9 +- .../log4cxx/helpers/socketoutputstream.h | 2 +- src/main/include/log4cxx/helpers/synchronized.h | 5 + src/main/include/log4cxx/helpers/syslogwriter.h | 4 +- src/main/include/log4cxx/helpers/thread.h | 98 +- src/main/include/log4cxx/helpers/writer.h | 4 + src/main/include/log4cxx/level.h | 38 +- src/main/include/log4cxx/log4cxx.hw | 20 +- src/main/include/log4cxx/logger.h | 80 +- src/main/include/log4cxx/logstring.h | 2 +- src/main/include/log4cxx/mdc.h | 5 - src/main/include/log4cxx/net/Makefile.am | 10 +- src/main/include/log4cxx/net/socketappender.h | 220 +- .../log4cxx/net/socketappenderskeleton.h | 2 +- .../include/log4cxx/net/sockethubappender.h | 3 +- src/main/include/log4cxx/net/syslogappender.h | 1 + src/main/include/log4cxx/net/telnetappender.h | 6 +- .../include/log4cxx/net/xmlsocketappender.h | 2 +- src/main/include/log4cxx/nt/Makefile.am | 5 +- src/main/include/log4cxx/pattern/Makefile.am | 27 +- .../log4cxx/pattern/classnamepatternconverter.h | 2 + .../log4cxx/pattern/datepatternconverter.h | 5 + .../pattern/filelocationpatternconverter.h | 2 + .../pattern/fulllocationpatternconverter.h | 2 + .../log4cxx/pattern/levelpatternconverter.h | 2 + .../pattern/linelocationpatternconverter.h | 2 + .../pattern/lineseparatorpatternconverter.h | 2 + .../log4cxx/pattern/literalpatternconverter.h | 2 + .../log4cxx/pattern/loggerpatternconverter.h | 2 + .../log4cxx/pattern/messagepatternconverter.h | 2 + .../pattern/methodlocationpatternconverter.h | 2 + .../log4cxx/pattern/ndcpatternconverter.h | 2 + .../include/log4cxx/pattern/patternconverter.h | 8 +- .../pattern/propertiespatternconverter.h | 3 + .../pattern/relativetimepatternconverter.h | 3 + .../log4cxx/pattern/threadpatternconverter.h | 2 + .../throwableinformationpatternconverter.h | 3 + src/main/include/log4cxx/patternlayout.h | 746 +- src/main/include/log4cxx/private/Makefile.am | 7 +- src/main/include/log4cxx/propertyconfigurator.h | 2 + src/main/include/log4cxx/rolling/Makefile.am | 18 +- .../log4cxx/rolling/fixedwindowrollingpolicy.h | 42 +- .../log4cxx/rolling/rollingfileappender.h | 0 .../rolling/rollingfileappenderskeleton.h | 23 + .../include/log4cxx/rolling/rollingpolicy.h | 60 +- .../include/log4cxx/rolling/rollingpolicybase.h | 7 +- .../log4cxx/rolling/sizebasedtriggeringpolicy.h | 0 .../log4cxx/rolling/timebasedrollingpolicy.h | 128 +- .../include/log4cxx/rolling/triggeringpolicy.h | 0 src/main/include/log4cxx/spi/Makefile.am | 16 +- src/main/include/log4cxx/spi/errorhandler.h | 5 + .../include/log4cxx/spi/location/Makefile.am | 4 +- .../include/log4cxx/spi/location/locationinfo.h | 32 +- src/main/include/log4cxx/spi/loggingevent.h | 11 +- src/main/include/log4cxx/varia/Makefile.am | 4 +- .../log4cxx/varia/fallbackerrorhandler.h | 6 +- src/main/include/log4cxx/writerappender.h | 3 + src/main/include/log4cxx/xml/Makefile.am | 5 +- src/main/include/log4cxx/xml/domconfigurator.h | 3 +- src/main/resources/log4cxx.rc | 16 +- src/site/apt/building/ant.apt | 244 +- src/site/apt/building/autotools.apt | 33 +- src/site/apt/building/maven.apt | 67 +- src/site/apt/building/vstudio.apt | 24 +- src/site/apt/building/xcode.apt | 30 +- src/site/apt/community/issue-tracking.apt | 48 + src/site/apt/download.apt | 44 - src/site/apt/download.apt.vm | 58 + src/site/apt/index.apt | 45 + src/site/doxy/DTDs/xhtml-lat1.ent | 196 + src/site/doxy/DTDs/xhtml-special.ent | 80 + src/site/doxy/DTDs/xhtml-symbol.ent | 237 + src/site/doxy/DTDs/xhtml1-transitional.dtd | 1201 +++ src/site/doxy/Doxyfile.in | 2506 +++-- src/site/doxy/Makefile.am | 11 +- src/site/doxy/license_notice_footer.txt | 2 +- src/site/doxy/mainpage.dox | 22 - src/site/doxy/mainpage.dox.xsl | 72 + src/site/resources/.htaccess | 33 - src/site/resources/css/bootstrap.css | 5893 +++++++++++ src/site/resources/css/bootstrap.min.css | 9 + src/site/resources/css/site.css | 99 +- src/site/resources/images/collapsed.gif | Bin 0 -> 53 bytes src/site/resources/images/expanded.gif | Bin 0 -> 52 bytes src/site/resources/images/logos/logo.png | Bin 0 -> 275 bytes src/site/resources/images/logos/ls-logo.jpg | Bin 0 -> 41915 bytes .../resources/images/logos/maven-feather.png | Bin 0 -> 3330 bytes src/site/resources/images/ls-logo.jpg | Bin 32725 -> 0 bytes src/site/resources/js/bootstrap.js | 2027 ++++ src/site/resources/js/bootstrap.min.js | 6 + src/site/resources/js/jquery.js | 9266 ++++++++++++++++++ src/site/resources/js/jquery.min.js | 4 + src/site/resources/js/prettify.js | 1477 +++ src/site/resources/js/prettify.min.js | 41 + src/site/resources/js/site.js | 113 + src/site/site.vm | 518 + src/site/site.xml | 170 +- src/site/xdoc/building/index.xml | 187 + src/site/xdoc/index.xml | 936 -- src/site/xdoc/stylesheets/project.xml | 43 - src/site/xdoc/stylesheets/site.css | 156 - src/site/xdoc/stylesheets/site.vsl | 357 - src/site/xdoc/usage.xml | 1062 ++ src/test/cpp/Makefile.am | 258 +- src/test/cpp/abts.h | 10 +- src/test/cpp/consoleappendertestcase.cpp | 14 +- src/test/cpp/decodingtest.cpp | 151 + src/test/cpp/encodingtest.cpp | 71 +- src/test/cpp/filetestcase.cpp | 0 src/test/cpp/filter/andfiltertest.cpp | 179 + src/test/cpp/filter/denyallfiltertest.cpp | 57 + src/test/cpp/filter/levelmatchfiltertest.cpp | 129 + src/test/cpp/filter/levelrangefiltertest.cpp | 149 + src/test/cpp/filter/loggermatchfiltertest.cpp | 109 + src/test/cpp/filter/stringmatchfiltertest.cpp | 133 + .../cpp/helpers/cacheddateformattestcase.cpp | 108 +- .../cpp/helpers/datetimedateformattestcase.cpp | 2 +- src/test/cpp/helpers/filewatchdogtest.cpp | 66 + src/test/cpp/helpers/propertiestestcase.cpp | 206 + src/test/cpp/helpers/threadtestcase.cpp | 66 + src/test/cpp/helpers/transcodertestcase.cpp | 35 +- src/test/cpp/hierarchytest.cpp | 0 src/test/cpp/l7dtestcase.cpp | 3 + src/test/cpp/leveltestcase.cpp | 24 +- src/test/cpp/logunit.cpp | 4 +- src/test/cpp/logunit.h | 71 +- src/test/cpp/mdctestcase.cpp | 60 + src/test/cpp/ndctestcase.cpp | 0 src/test/cpp/net/smtpappendertestcase.cpp | 4 +- src/test/cpp/net/socketappendertestcase.cpp | 1 + src/test/cpp/net/xmlsocketappendertestcase.cpp | 1 + src/test/cpp/rolling/timebasedrollingtest.cpp | 948 +- src/test/cpp/streamtestcase.cpp | 14 +- src/test/cpp/util/filter.h | 2 +- src/test/cpp/varia/errorhandlertestcase.cpp | 89 +- src/test/cpp/xml/domtestcase.cpp | 329 +- src/test/resources/L7D_fr.properties | 1 + src/test/resources/Makefile.am | 29 +- src/test/resources/input/Makefile.am | 42 +- src/test/resources/input/decoding/Makefile.am | 31 + src/test/resources/input/decoding/UTF-16.txt | Bin 0 -> 18 bytes src/test/resources/input/decoding/UTF-16BE.txt | Bin 0 -> 16 bytes src/test/resources/input/decoding/UTF-16LE.txt | Bin 0 -> 16 bytes src/test/resources/input/decoding/UTF-8.txt | 1 + src/test/resources/input/decoding/ascii.txt | 1 + src/test/resources/input/decoding/latin1.txt | 1 + src/test/resources/input/ndc/Makefile.am | 11 +- src/test/resources/input/ndc/NDC1.properties | 0 .../input/propertiestestcase.properties | 32 + src/test/resources/input/rolling/Makefile.am | 15 +- src/test/resources/input/xml/DOMTestCase1.xml | 0 src/test/resources/input/xml/DOMTestCase2.xml | 0 src/test/resources/input/xml/DOMTestCase3.xml | 0 src/test/resources/input/xml/DOMTestCase4.xml | 0 src/test/resources/input/xml/Makefile.am | 30 +- src/test/resources/input/xml/asyncAppender1.xml | 0 src/test/resources/input/xml/customLevel1.xml | 0 src/test/resources/input/xml/customLevel2.xml | 0 src/test/resources/input/xml/customLevel3.xml | 0 src/test/resources/input/xml/customLevel4.xml | 0 src/test/resources/input/xml/fallback1.xml | 27 +- src/test/resources/input/xml/log4j.dtd | 0 src/test/resources/witness/Makefile.am | 78 +- src/test/resources/witness/customLevel.1 | 0 src/test/resources/witness/customLevel.2 | 0 src/test/resources/witness/customLevel.3 | 0 src/test/resources/witness/customLevel.4 | 0 src/test/resources/witness/dom.A1.1 | 0 src/test/resources/witness/dom.A1.2 | 0 src/test/resources/witness/dom.A2.1 | 0 src/test/resources/witness/dom.A2.2 | 0 src/test/resources/witness/encoding/Makefile.am | 18 +- src/test/resources/witness/fallback | 10 - src/test/resources/witness/fallback1 | 14 + src/test/resources/witness/l7d.1 | 4 + src/test/resources/witness/ndc/Makefile.am | 11 +- src/test/resources/witness/ndc/NDC.1 | 0 src/test/resources/witness/rolling/Makefile.am | 36 +- 299 files changed, 37796 insertions(+), 9975 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/configure.ac ---------------------------------------------------------------------- diff --cc configure.ac index 0000000,6ec857e..d8ad3d4 mode 000000,100644..100644 --- a/configure.ac +++ b/configure.ac @@@ -1,0 -1,491 +1,493 @@@ + # Licensed to the Apache Software Foundation (ASF) under one or more + # contributor license agreements. See the NOTICE file distributed with + # this work for additional information regarding copyright ownership. + # The ASF licenses this file to You under the Apache License, Version 2.0 + # (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + + AC_INIT([log4cxx], [0.11.0]) + AC_CONFIG_MACRO_DIR([src/m4]) + AC_CONFIG_SRCDIR(src/main/cpp/logger.cpp) + + # autoconf 2.50 or higher to rebuild aclocal.m4, because the + # AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro. + AC_PREREQ(2.50) + + AC_CANONICAL_HOST + AC_CANONICAL_TARGET + + # + # +1 : ? : +1 == new interface that does not break old one + # +1 : ? : 0 == new interface that breaks old one + # ? : ? : 0 == no new interfaces, but breaks apps + # ? :+1 : ? == just some internal changes, nothing breaks but might work + # better + # CURRENT : REVISION : AGE + LT_VERSION=10:0:0 + + AC_SUBST(LT_VERSION) + + AH_VERBATIM([HAVE_NO_EXPLICIT_EXPORTS], + [/* no explicit exports */ + #define LOG4CXX_EXPORT]) + + AM_INIT_AUTOMAKE([foreign subdir-objects -Wall]) + + # Checks for programs + # ---------------------------------------------------------------------------- + + AM_PROG_AR + AM_PROG_LIBTOOL + AC_PROG_INSTALL + AC_PROG_LN_S + AC_PROG_MAKE_SET + + AC_PROG_CXX([g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC]) + + AC_PROG_CXXCPP + AC_LANG(C++) + + # CXX fine tuning + case "$host" in + *-dec-osf*) + CXXFLAGS="$CXXFLAGS -std strict_ansi_errors" + ;; + *) + ;; + esac + ++CXXFLAGS="$CXXFLAGS -std=c++11" ++ + # Doxygen + + AC_ARG_ENABLE(doxygen, + AC_HELP_STRING(--enable-doxygen, + [enable documentation generation with doxygen (auto)])) + + AC_ARG_ENABLE(dot, + AC_HELP_STRING(--enable-dot, + [use 'dot' to generate graphs in doxygen (auto)])) + + AC_ARG_ENABLE(html-docs, + AC_HELP_STRING(--enable-html-docs, + [enable HTML generation with doxygen (yes)]), + [], + [enable_html_docs=yes]) + + AC_ARG_ENABLE(latex-docs, + AC_HELP_STRING(--enable-latex-docs, + [enable LaTeX documentation generation with doxygen (no)]), + [], + [enable_latex_docs=no]) + + if test "x$enable_doxygen" = xno; then + enable_doc=no + else + AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) + if test "x$DOXYGEN" = x; then + if test "x$enable_doxygen" = xyes; then + AC_MSG_ERROR([could not find doxygen]) + fi + enable_doc=no + else + enable_doc=yes + AC_PATH_PROG(DOT, dot, , $PATH) + fi + fi + AM_CONDITIONAL(DOC, test x$enable_doc = xyes) + AM_CONDITIONAL(LATEX_DOC, test x$enable_latex_docs = xyes) + + if test x$DOT = x; then + if test "x$enable_dot" = xyes; then + AC_MSG_ERROR([could not find dot]) + fi + enable_dot=no + else + enable_dot=yes + fi + + manual_dest="manual" + base_dir=`(cd $srcdir && pwd)` + + AC_SUBST(enable_dot) + AC_SUBST(enable_html_docs) + AC_SUBST(enable_latex_docs) + AC_SUBST(manual_dest) + AC_SUBST(base_dir) + + + + + # Checks header files + # ---------------------------------------------------------------------------- + APR_FIND_APR( , , 1, 1) + if test "$apr_found" = "no"; then + AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.) + fi + + CPPFLAGS="$CPPFLAGS `$apr_config --cppflags` `$apr_config --includes`" + APR_LIBS="`$apr_config --link-ld --libs`" + AC_SUBST(APR_LIBS) + LDFLAGS="$LDFLAGS $APR_LIBS" + + APR_FIND_APU( , , 1, 1) + if test "$apu_found" = "no"; then + AC_MSG_ERROR(APR-util could not be located. Please use the --with-apr-util option.) + fi + + CPPFLAGS="$CPPFLAGS `$apu_config --includes`" + APU_LIBS="`$apu_config --link-ld --libs`" + AC_SUBST(APU_LIBS) + LDFLAGS="$LDFLAGS $APU_LIBS" + + # Checks local idioms + # ---------------------------------------------------------------------------- + + # for local syslog() function for SyslogAppender + AC_CHECK_FUNCS(mbsrtowcs, [have_mbsrtowcs=yes], [have_mbsrtowcs=no]) + if test "$have_mbsrtowcs" = "yes" + then + AC_SUBST(HAS_MBSRTOWCS, 1) + else + AC_SUBST(HAS_MBSRTOWCS, 0) + fi + + AC_CHECK_FUNCS(wcstombs, [have_wcstombs=yes], [have_wcstombs=no]) + if test "$have_wcstombs" = "yes" + then + AC_SUBST(HAS_WCSTOMBS, 1) + else + AC_SUBST(HAS_WCSTOMBS, 0) + fi + + # for local syslog() function for SyslogAppender + AC_CHECK_FUNCS(syslog, [have_syslog=yes], [have_syslog=no]) + if test "$have_syslog" = "yes" + then + AC_SUBST(HAS_SYSLOG, 1) + else + AC_SUBST(HAS_SYSLOG, 0) + fi + + AC_CHECK_HEADER([locale],have_locale=yes,have_locale=no) + if test "$have_locale" = "yes" + then + AC_SUBST(HAS_STD_LOCALE, 1) + else + AC_SUBST(HAS_STD_LOCALE, 0) + fi + + AC_MSG_CHECKING([for wchar_t]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include <string> + std::wstring w;])], [have_wchar_t=yes], [have_wchar_t=no]) + AC_MSG_RESULT($have_wchar_t) + if test "$have_wchar_t" = "yes" + then + AC_SUBST(HAS_WCHAR_T, 1) + else + AC_SUBST(HAS_WCHAR_T, 0) + fi + + AC_CHECK_FUNCS(fwide, [have_fwide=yes], [have_fwide=no]) + if test "$have_fwide" = "yes" + then + AC_SUBST(HAS_FWIDE, 1) + else + AC_SUBST(HAS_FWIDE, 0) + fi + + + # Checks for libraries + # ---------------------------------------------------------------------------- + + #for ODBCAppender + AC_MSG_CHECKING(for ODBC support) + AC_ARG_WITH(ODBC, + AC_HELP_STRING(--with-ODBC, [ODBC support. Accepted arguments : + unixODBC, iODBC, Microsoft, no (default=no)]), + [ac_with_odbc=$withval], + [ac_with_odbc=no]) + case "$ac_with_odbc" in + Microsoft) + AC_SUBST(HAS_ODBC, 1, ODBC support) + AC_MSG_RESULT(Microsoft) + LIBS_ODBC="-lodbc32" + ;; + unixODBC) + AC_MSG_RESULT(unixODBC) + AC_CHECK_HEADER(sqlext.h,, AC_MSG_ERROR(unixODBC not found !)) + AC_SUBST(HAS_ODBC, 1, ODBC support) + LIBS_ODBC="-lodbc" + ;; + iODBC) + AC_MSG_RESULT(iODBC) + AC_CHECK_PROG(IODBC_CONFIG, iodbc-config, yes, no) + if test "x$IODBC_CONFIG" = "xyes" + then + AC_SUBST(HAS_ODBC, 1, ODBC support) + LIBS_ODBC="`iodbc-config --libs`" + CPPFLAGS_ODBC="`iodbc-config --cflags`" + else + AC_MSG_ERROR(iODBC not found !) + fi + ;; + no) + AC_SUBST(HAS_ODBC, 0, No ODBC support) + AC_MSG_RESULT(no) + ;; + *) + AC_MSG_RESULT(???) + AC_MSG_ERROR(Unknown option : $ac_with_odbc) + ;; + esac + AC_SUBST(LIBS_ODBC) + AC_SUBST(CPPFLAGS_ODBC) + + + #for SMTPAppender + AC_MSG_CHECKING(for SMTP support) + AC_ARG_WITH(SMTP, + AC_HELP_STRING(--with-SMTP, [SMTP support. Accepted arguments : + libesmtp, no (default=no)]), + [ac_with_smtp=$withval], + [ac_with_smtp=no]) + case "$ac_with_smtp" in + libesmtp) + AC_MSG_RESULT(libesmtp) + AC_CHECK_LIB([esmtp], [smtp_create_session],, + AC_MSG_ERROR(libesmtp library not found !), + -lesmtp) + AC_SUBST(HAS_LIBESMTP, 1, SMTP support through libesmtp library.) + LIBS="-lesmtp $LIBS" + ;; + no) + AC_MSG_RESULT(no) + AC_SUBST(HAS_LIBESMTP, 0, SMTP support through libesmtp library.) + ;; + *) + AC_MSG_RESULT(???) + AC_MSG_ERROR(Unknown option : $ac_with_smtp) + ;; + esac + + #for char api + AC_ARG_ENABLE(char, + AC_HELP_STRING(--enable-char, + [enable char API (yes)])) + if test "x$enable_char" = xno; then + have_char_api=no + else + have_char_api=yes + fi + + if test "$have_char_api" = "yes" + then + AC_SUBST(CHAR_API, 1) + else + AC_SUBST(CHAR_API, 0) + fi + + #for wchar_t api + AC_ARG_ENABLE(wchar_t, + AC_HELP_STRING(--enable-wchar_t, + [enable wchar_t API (yes if wchar_t available)])) + if test "x$enable_wchar_t" = xno; then + have_wchar_t_api=no + else + if test "$have_wchar_t" = "yes" + then + have_wchar_t_api=yes + else + have_wchar_t_api=no + fi + fi + + if test "$have_wchar_t_api" = "yes" + then + AC_SUBST(WCHAR_T_API, 1) + else + AC_SUBST(WCHAR_T_API, 0) + fi + + #for unichar api + AC_ARG_ENABLE(unichar, + AC_HELP_STRING(--enable-unichar, + [enable unichar API (no)])) + if test "x$enable_unichar" = "yes" + then + AC_SUBST(UNICHAR_API, 1) + else + AC_SUBST(UNICHAR_API, 0) + fi + + #for cfstring api + AC_ARG_ENABLE(cfstring, + AC_HELP_STRING(--enable-cfstring, + [enable cfstring API (no)])) + if test "x$enable_cfstring" = xyes; then + AC_MSG_CHECKING([for cfstring]) + CPPFLAGS="$CPPFLAGS -framework CoreFoundation" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include <CoreFoundation/CFString.h> + CFStringRef x = CFSTR("Hello");])], [have_cfstring_api=yes], [have_cfstring_api=no]) + AC_MSG_RESULT($have_cfstring_api) + else + have_cfstring_api=no + fi + + if test "$have_cfstring_api" = "yes" + then + AC_SUBST(CFSTRING_API, 1) + else + AC_SUBST(CFSTRING_API, 0) + fi + + #determine charset type + AC_MSG_CHECKING([charset type]) + AC_ARG_WITH(charset, + AC_HELP_STRING(--with-charset=TYPE, [locale charset. + Accepted TYPE variants: auto, utf-8, iso-8859-1, usascii, ebcdic (default=auto)]), + [ac_with_charset=$withval], + [ac_with_charset=auto]) + + case "$ac_with_charset" in + utf-8) + AC_MSG_RESULT(utf-8) + AC_SUBST(CHARSET_UTF8, 1) + AC_SUBST(CHARSET_ISO88591, 0) + AC_SUBST(CHARSET_USASCII, 0) + AC_SUBST(CHARSET_EBCDIC, 0) + ;; + + iso-8859-1) + AC_MSG_RESULT(iso-8859-1) + AC_SUBST(CHARSET_UTF8, 0) + AC_SUBST(CHARSET_ISO88591, 1) + AC_SUBST(CHARSET_USASCII, 0) + AC_SUBST(CHARSET_EBCDIC, 0) + ;; + + usascii) + AC_MSG_RESULT(usascii) + AC_SUBST(CHARSET_UTF8, 0) + AC_SUBST(CHARSET_ISO88591, 0) + AC_SUBST(CHARSET_USASCII, 1) + AC_SUBST(CHARSET_EBCDIC, 0) + ;; + + ebcdic) + AC_MSG_RESULT(usascii) + AC_SUBST(CHARSET_UTF8, 0) + AC_SUBST(CHARSET_ISO88591, 0) + AC_SUBST(CHARSET_USASCII, 0) + AC_SUBST(CHARSET_EBCDIC, 1) + ;; + + auto) + AC_MSG_RESULT(auto) + AC_SUBST(CHARSET_UTF8, 0) + AC_SUBST(CHARSET_ISO88591, 0) + AC_SUBST(CHARSET_USASCII, 0) + AC_SUBST(CHARSET_EBCDIC, 0) + ;; + + *) + AC_MSG_RESULT(???) + AC_MSG_ERROR(Invalid charset type: $ac_with_charset) + ;; + esac + + + + #determine logchar type + AC_MSG_CHECKING([logchar type]) + AC_ARG_WITH(logchar, + AC_HELP_STRING(--with-logchar=TYPE, [type for logchar. + Accepted TYPE variants: utf-8, wchar_t, unichar (default=utf-8)]), + [ac_with_logchar=$withval], + [ac_with_logchar=utf-8]) + + case "$ac_with_logchar" in + utf-8) + AC_MSG_RESULT(utf-8) + AC_SUBST(LOGCHAR_IS_UTF8, 1) + AC_SUBST(LOGCHAR_IS_WCHAR, 0) + AC_SUBST(LOGCHAR_IS_UNICHAR, 0) + ;; + + wchar_t) + AC_MSG_RESULT(wchar_t) + AC_SUBST(LOGCHAR_IS_UTF8, 0) + AC_SUBST(LOGCHAR_IS_WCHAR, 1) + AC_SUBST(LOGCHAR_IS_UNICHAR, 0) + ;; + + unichar) + AC_MSG_RESULT(unichar) + AC_SUBST(LOGCHAR_IS_UTF8, 0) + AC_SUBST(LOGCHAR_IS_WCHAR, 0) + AC_SUBST(LOGCHAR_IS_UNICHAR, 1) + ;; + + *) + AC_MSG_RESULT(???) + AC_MSG_ERROR(Invalid logchar type: $ac_with_logchar) + ;; + esac + + + + # Create files + # ---------------------------------------------------------------------------- + + AC_CONFIG_FILES([ + Makefile + liblog4cxx.pc + src/Makefile + src/main/Makefile + src/main/cpp/Makefile + src/main/include/Makefile + src/main/include/log4cxx/log4cxx.h + src/main/include/log4cxx/private/log4cxx_private.h + src/main/include/log4cxx/private/Makefile + src/main/include/log4cxx/Makefile + src/main/include/log4cxx/helpers/Makefile + src/main/include/log4cxx/net/Makefile + src/main/include/log4cxx/nt/Makefile + src/main/include/log4cxx/spi/Makefile + src/main/include/log4cxx/spi/location/Makefile + src/main/include/log4cxx/varia/Makefile + src/main/include/log4cxx/xml/Makefile + src/main/include/log4cxx/config/Makefile + src/main/include/log4cxx/db/Makefile + src/main/include/log4cxx/rolling/Makefile + src/main/include/log4cxx/pattern/Makefile + src/main/include/log4cxx/filter/Makefile + src/m4/Makefile + src/site/Makefile + src/site/doxy/Makefile + src/site/doxy/Doxyfile + src/test/Makefile + src/test/resources/Makefile + src/test/resources/input/Makefile + src/test/resources/input/ndc/Makefile + src/test/resources/input/rolling/Makefile + src/test/resources/input/xml/Makefile + src/test/cpp/Makefile + src/test/resources/witness/Makefile + src/test/resources/witness/encoding/Makefile + src/test/resources/witness/ndc/Makefile + src/test/resources/witness/rolling/Makefile + src/examples/Makefile + src/examples/cpp/Makefile + ]) + AC_OUTPUT http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/asyncappender.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/asyncappender.cpp index 9fdb69c,52fc194..b7a4292 --- a/src/main/cpp/asyncappender.cpp +++ b/src/main/cpp/asyncappender.cpp @@@ -321,29 -311,13 +321,29 @@@ LoggingEventPtr AsyncAppender::DiscardS LocationInfo::getLocationUnavailable()); } +::log4cxx::spi::LoggingEventPtr +AsyncAppender::DiscardSummary::createEvent(::log4cxx::helpers::Pool& p, + unsigned discardedCount) +{ + char msg[128]; + + snprintf(msg, 128, LOG4CXX_STR("Discarded %u messages due to a full event buffer."), discardedCount); + + return new LoggingEvent( + "", + log4cxx::Level::getError(), + msg, + LocationInfo::getLocationUnavailable()); +} #if APR_HAS_THREADS - void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* thread, void* data) { + void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* /*thread*/, void* data) { AsyncAppender* pThis = (AsyncAppender*) data; - bool isActive = true; try { - while (isActive) { + while (!pThis->closed) { + + pThis->bufferNotEmpty.await(); + // // process events after lock on buffer is released. // http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/domconfigurator.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/domconfigurator.cpp index 10b328b,95a7b60..618048a --- a/src/main/cpp/domconfigurator.cpp +++ b/src/main/cpp/domconfigurator.cpp @@@ -44,8 -44,10 +44,11 @@@ #include <log4cxx/helpers/bytebuffer.h> #include <log4cxx/helpers/charsetdecoder.h> #include <log4cxx/net/smtpappender.h> +#include <log4cxx/helpers/messagebuffer.h> + #define LOG4CXX 1 + #include <log4cxx/helpers/aprinitializer.h> + using namespace log4cxx; using namespace log4cxx::xml; using namespace log4cxx::helpers; http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/fileappender.cpp ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/logger.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/logger.cpp index 15f748c,dd9a343..8c9a379 --- a/src/main/cpp/logger.cpp +++ b/src/main/cpp/logger.cpp @@@ -43,9 -43,8 +43,8 @@@ IMPLEMENT_LOG4CXX_OBJECT(Logger Logger::Logger(Pool& p, const LogString& name1) : pool(&p), name(), level(), parent(), resourceBundle(), -repository(), aai(), mutex(p) +repository(), aai(), SHARED_MUTEX_INIT(mutex, p) { - LOCK_W sync(mutex); name = name1; additive = true; } @@@ -64,7 -63,9 +63,9 @@@ void Logger::releaseRef() const void Logger::addAppender(const AppenderPtr& newAppender) { + log4cxx::spi::LoggerRepository* rep = 0; + { - synchronized sync(mutex); + LOCK_W sync(mutex); if (aai == 0) { http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/mutex.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/mutex.cpp index 4faf556,c50a562..2a1f79d mode 100755,100644..100755 --- a/src/main/cpp/mutex.cpp +++ b/src/main/cpp/mutex.cpp @@@ -16,10 -16,10 +16,11 @@@ */ #include <log4cxx/logstring.h> --#include <log4cxx/helpers/mutex.h> #include <log4cxx/helpers/exception.h> -#include <apr_thread_mutex.h> ++#include <log4cxx/helpers/mutex.h> + #include <log4cxx/helpers/pool.h> +#include <apr_thread_mutex.h> +#include <apr_thread_rwlock.h> #include <assert.h> #if !defined(LOG4CXX) #define LOG4CXX 1 http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/propertyconfigurator.cpp ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/rollingfileappender.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/rollingfileappender.cpp index 4ae03da,777d0f8..33510de --- a/src/main/cpp/rollingfileappender.cpp +++ b/src/main/cpp/rollingfileappender.cpp @@@ -134,105 -158,196 +158,196 @@@ void RollingFileAppenderSkeleton::relea * @return true if rollover performed. */ bool RollingFileAppenderSkeleton::rollover(Pool& p) { - // - // can't roll without a policy - // - if (rollingPolicy != NULL) { - - { - LOCK_W sync(mutex); - try { - RolloverDescriptionPtr rollover1(rollingPolicy->rollover(getFile(), p)); - - if (rollover1 != NULL) { - if (rollover1->getActiveFileName() == getFile()) { - closeWriter(); - - bool success = true; - - if (rollover1->getSynchronous() != NULL) { - success = false; - - try { - success = rollover1->getSynchronous()->execute(p); - } catch (std::exception& ex) { - LogLog::warn(LOG4CXX_STR("Exception on rollover")); - } + // + // can't roll without a policy + // + if (rollingPolicy != NULL) { + + { - synchronized sync(mutex); ++ LOCK_W sync(mutex); + + #ifdef LOG4CXX_MULTI_PROCESS + std::string fileName(getFile()); + RollingPolicyBase *basePolicy = dynamic_cast<RollingPolicyBase* >(&(*rollingPolicy)); + apr_time_t n = apr_time_now(); + ObjectPtr obj(new Date(n)); + LogString fileNamePattern; + if (basePolicy){ + if (basePolicy->getPatternConverterList().size()){ + (*(basePolicy->getPatternConverterList().begin()))->format(obj, fileNamePattern, p); + fileName = std::string(fileNamePattern); + } } - if (success) { - if (rollover1->getAppend()) { - fileLength = File().setPath(rollover1->getActiveFileName()).length(p); - } else { - fileLength = 0; - } - - // - // async action not yet implemented - // - ActionPtr asyncAction(rollover1->getAsynchronous()); - if (asyncAction != NULL) { - asyncAction->execute(p); - } - - setFile( - rollover1->getActiveFileName(), rollover1->getAppend(), - bufferedIO, bufferSize, p); - } else { - setFile( - rollover1->getActiveFileName(), true, bufferedIO, bufferSize, p); - } - } else { - OutputStreamPtr os(new FileOutputStream( - rollover1->getActiveFileName(), rollover1->getAppend())); - WriterPtr newWriter(createWriter(os)); - closeWriter(); - setFile(rollover1->getActiveFileName()); - setWriter(newWriter); - - bool success = true; - - if (rollover1->getSynchronous() != NULL) { - success = false; - - try { - success = rollover1->getSynchronous()->execute(p); - } catch (std::exception& ex) { - LogLog::warn(LOG4CXX_STR("Exception during rollover")); - } + bool bAlreadyRolled = true; + char szDirName[MAX_FILE_LEN] = {'\0'}; + char szBaseName[MAX_FILE_LEN] = {'\0'}; + char szUid[MAX_FILE_LEN] = {'\0'}; + memcpy(szDirName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size()); + memcpy(szBaseName, fileName.c_str(), fileName.size() > MAX_FILE_LEN ? MAX_FILE_LEN : fileName.size()); + apr_uid_t uid; + apr_gid_t groupid; + apr_status_t stat = apr_uid_current(&uid, &groupid, pool.getAPRPool()); + if (stat == APR_SUCCESS){ + snprintf(szUid, MAX_FILE_LEN, "%u", uid); } - if (success) { - if (rollover1->getAppend()) { - fileLength = File().setPath(rollover1->getActiveFileName()).length(p); - } else { - fileLength = 0; - } - - // - // async action not yet implemented - // - ActionPtr asyncAction(rollover1->getAsynchronous()); - if (asyncAction != NULL) { - asyncAction->execute(p); - } + const std::string lockname = std::string(::dirname(szDirName)) + "/." + ::basename(szBaseName) + szUid + ".lock"; + apr_file_t* lock_file; + stat = apr_file_open(&lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, p.getAPRPool()); + if (stat != APR_SUCCESS) { + std::string err = "lockfile return error: open lockfile failed. "; + err += (strerror(errno)); + LogLog::warn(LOG4CXX_STR(err.c_str())); + bAlreadyRolled = false; + lock_file = NULL; + }else{ + stat = apr_file_lock(lock_file, APR_FLOCK_EXCLUSIVE); + if (stat != APR_SUCCESS){ + std::string err = "apr_file_lock: lock failed. "; + err += (strerror(errno)); + LogLog::warn(LOG4CXX_STR(err.c_str())); + bAlreadyRolled = false; + } + else { + if (_event) + triggeringPolicy->isTriggeringEvent(this, *_event, getFile(), getFileLength()); + } } - writeHeader(p); - } + if (bAlreadyRolled){ + apr_finfo_t finfo1, finfo2; + apr_status_t st1, st2; + apr_file_t* _fd = getWriter()->getOutPutStreamPtr()->getFileOutPutStreamPtr().getFilePtr(); + st1 = apr_file_info_get(&finfo1, APR_FINFO_IDENT, _fd); + if (st1 != APR_SUCCESS){ + LogLog::warn(LOG4CXX_STR("apr_file_info_get failed")); + } + + st2 = apr_stat(&finfo2, std::string(getFile()).c_str(), APR_FINFO_IDENT, p.getAPRPool()); + if (st2 != APR_SUCCESS){ + LogLog::warn(LOG4CXX_STR("apr_stat failed.")); + } + + bAlreadyRolled = ((st1 == APR_SUCCESS) && (st2 == APR_SUCCESS) + && ((finfo1.device != finfo2.device) || (finfo1.inode != finfo2.inode))); + } - return true; + if (!bAlreadyRolled){ + #endif + try { + RolloverDescriptionPtr rollover1(rollingPolicy->rollover(this->getFile(), this->getAppend(), p)); + if (rollover1 != NULL) { + if (rollover1->getActiveFileName() == getFile()) { + closeWriter(); + + bool success = true; + if (rollover1->getSynchronous() != NULL) { + success = false; + + try { + success = rollover1->getSynchronous()->execute(p); + } catch (std::exception& ex) { + LogLog::warn(LOG4CXX_STR("Exception on rollover")); + } + } + + if (success) { + if (rollover1->getAppend()) { + fileLength = File().setPath(rollover1->getActiveFileName()).length(p); + } else { + fileLength = 0; + } + + // + // async action not yet implemented + // + ActionPtr asyncAction(rollover1->getAsynchronous()); + if (asyncAction != NULL) { + asyncAction->execute(p); + } + + setFile( + rollover1->getActiveFileName(), rollover1->getAppend(), + bufferedIO, bufferSize, p); + } else { + setFile( + rollover1->getActiveFileName(), true, bufferedIO, bufferSize, p); + } + } else { + OutputStreamPtr os(new FileOutputStream( + rollover1->getActiveFileName(), rollover1->getAppend())); + WriterPtr newWriter(createWriter(os)); + closeWriter(); + setFile(rollover1->getActiveFileName()); + setWriter(newWriter); + + bool success = true; + + if (rollover1->getSynchronous() != NULL) { + success = false; + + try { + success = rollover1->getSynchronous()->execute(p); + } catch (std::exception& ex) { + LogLog::warn(LOG4CXX_STR("Exception during rollover")); + } + } + + if (success) { + if (rollover1->getAppend()) { + fileLength = File().setPath(rollover1->getActiveFileName()).length(p); + } else { + fileLength = 0; + } + + // + // async action not yet implemented + // + ActionPtr asyncAction(rollover1->getAsynchronous()); + if (asyncAction != NULL) { + asyncAction->execute(p); + } + } + + writeHeader(p); + } + + #ifdef LOG4CXX_MULTI_PROCESS + releaseFileLock(lock_file); + #endif + return true; + } + } catch (std::exception& ex) { + LogLog::warn(LOG4CXX_STR("Exception during rollover")); + } + #ifdef LOG4CXX_MULTI_PROCESS + }else{ + reopenLatestFile(p); + } + releaseFileLock(lock_file); + #endif } - } catch (std::exception& ex) { - LogLog::warn(LOG4CXX_STR("Exception during rollover")); - } } + return false; + } - } - - return false; + #ifdef LOG4CXX_MULTI_PROCESS + /** + * re-open current file when its own handler has been renamed + */ + void RollingFileAppenderSkeleton::reopenLatestFile(Pool& p){ + closeWriter(); + OutputStreamPtr os(new FileOutputStream(getFile(), true)); + WriterPtr newWriter(createWriter(os)); + setFile(getFile()); + setWriter(newWriter); + fileLength = File().setPath(getFile()).length(p); + writeHeader(p); } + #endif + /** * {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/socketappender.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/socketappender.cpp index 6c4fc60,0103b42..70826c3 --- a/src/main/cpp/socketappender.cpp +++ b/src/main/cpp/socketappender.cpp @@@ -63,49 -64,67 +64,67 @@@ SocketAppender::SocketAppender(const Lo SocketAppender::~SocketAppender() { - finalize(); + finalize(); } - int SocketAppender::getDefaultDelay() const { - return DEFAULT_RECONNECTION_DELAY; + int SocketAppender::getDefaultDelay() const + { + return DEFAULT_RECONNECTION_DELAY; } - int SocketAppender::getDefaultPort() const { - return DEFAULT_PORT; + int SocketAppender::getDefaultPort() const + { + return DEFAULT_PORT; } - void SocketAppender::setSocket(log4cxx::helpers::SocketPtr& socket, Pool& p) { - LOCK_W sync(mutex); - oos = new ObjectOutputStream(new SocketOutputStream(socket), p); - } + void SocketAppender::setSocket(log4cxx::helpers::SocketPtr& socket, Pool& p) + { - synchronized sync(mutex); ++ LOCK_W sync(mutex); - void SocketAppender::cleanUp(Pool& p) { - if (oos != 0) { - try { - oos->close(p); - oos = 0; - } catch(std::exception& e) { - } - } + oos = new ObjectOutputStream(new SocketOutputStream(socket), p); } + void SocketAppender::cleanUp(Pool& p) + { + if (oos == 0) + { + return; + } + + try + { + oos->close(p); + oos = 0; + } + catch(std::exception& e) + {} + } - void SocketAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) { - if (oos != 0) { - LogString ndcVal; - event->getNDC(ndcVal); - event->getThreadName(); - // Get a copy of this thread's MDC. - event->getMDCCopy(); - try { - event->write(*oos, p); - oos->flush(p); - } catch(std::exception& e) { - oos = 0; - LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e); - if (getReconnectionDelay() > 0) { - fireConnector(); - } - } - } + void SocketAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) + { + if (oos == 0) + { + return; + } + + LogString ndcVal; + event->getNDC(ndcVal); + event->getThreadName(); + event->getMDCCopy(); + + try + { + event->write(*oos, p); + oos->reset(p); + } + catch(std::exception& e) + { + oos = 0; + LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e); + + if (getReconnectionDelay() > 0) + { + fireConnector(); + } + } } http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/socketappenderskeleton.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/socketappenderskeleton.cpp index 6a28a9d,a6b99cc..3010590 mode 100755,100644..100755 --- a/src/main/cpp/socketappenderskeleton.cpp +++ b/src/main/cpp/socketappenderskeleton.cpp @@@ -129,9 -133,14 +133,14 @@@ void SocketAppenderSkeleton::setOption( void SocketAppenderSkeleton::fireConnector() { - synchronized sync(mutex); + LOCK_W sync(mutex); - if (thread.isActive()) { - thread.run(monitor, this); + if ( !thread.isAlive() ) { + LogLog::debug(LOG4CXX_STR("Connector thread not alive: starting monitor.")); + try { + thread.run(monitor, this); + } catch( ThreadException& te ) { + LogLog::error(LOG4CXX_STR("Monitor not started: "), te); + } } } http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/sockethubappender.cpp ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/synchronized.cpp ---------------------------------------------------------------------- diff --cc src/main/cpp/synchronized.cpp index 210bf1f,5233a0f..e561f54 mode 100755,100644..100644 --- a/src/main/cpp/synchronized.cpp +++ b/src/main/cpp/synchronized.cpp http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/telnetappender.cpp ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/cpp/writerappender.cpp ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/appenderskeleton.h ---------------------------------------------------------------------- diff --cc src/main/include/log4cxx/appenderskeleton.h index 4b63c98,670f683..dfdabb1 --- a/src/main/include/log4cxx/appenderskeleton.h +++ b/src/main/include/log4cxx/appenderskeleton.h @@@ -76,8 -76,15 +76,17 @@@ namespace log4cx bool closed; log4cxx::helpers::Pool pool; - log4cxx::helpers::Mutex mutex; + mutable SHARED_MUTEX mutex; + /** + Subclasses of <code>AppenderSkeleton</code> should implement this + method to perform actual logging. See also AppenderSkeleton::doAppend + method. + */ + virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) = 0; + ++ void doAppendImpl(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool); ++ public: DECLARE_ABSTRACT_LOG4CXX_OBJECT(AppenderSkeleton) BEGIN_LOG4CXX_CAST_MAP() http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/asyncappender.h ---------------------------------------------------------------------- diff --cc src/main/include/log4cxx/asyncappender.h index 7449f67,3c24ae2..7d43d81 --- a/src/main/include/log4cxx/asyncappender.h +++ b/src/main/include/log4cxx/asyncappender.h @@@ -198,8 -195,8 +199,9 @@@ namespace log4cx /** * Event buffer. */ - LoggingEventList buffer; + boost::lockfree::queue<log4cxx::spi::LoggingEvent* > buffer; + std::atomic<unsigned> discardedCount; + /** * Mutex used to guard access to buffer and discardMap. */ http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/helpers/mutex.h ---------------------------------------------------------------------- diff --cc src/main/include/log4cxx/helpers/mutex.h index 58cf7db,d26487b..58cf7db mode 100755,100644..100644 --- a/src/main/include/log4cxx/helpers/mutex.h +++ b/src/main/include/log4cxx/helpers/mutex.h http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/helpers/synchronized.h ---------------------------------------------------------------------- diff --cc src/main/include/log4cxx/helpers/synchronized.h index e3486c5,66e6259..f4b31d7 mode 100755,100644..100644 --- a/src/main/include/log4cxx/helpers/synchronized.h +++ b/src/main/include/log4cxx/helpers/synchronized.h http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/logger.h ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/7dabde01/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h ---------------------------------------------------------------------- diff --cc src/main/include/log4cxx/rolling/timebasedrollingpolicy.h index 4becb3b,4491b0b..4491b0b mode 100755,100644..100755 --- a/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h +++ b/src/main/include/log4cxx/rolling/timebasedrollingpolicy.h
