carnold 2004/12/15 00:10:42
Modified: . configure.in
examples delayedloop.cpp stream.cpp trivial.cpp
include/log4cxx file.h fileappender.h rollingfileappender.h
writerappender.h
include/log4cxx/helpers transcoder.h
performance main.cpp
simplesocketserver simplesocketserver.cpp
src Makefile.am cacheddateformat.cpp file.cpp
fileappender.cpp logmanager.cpp
rollingfileappender.cpp transcoder.cpp
tests/src Makefile.am filetestcase.cpp main.cpp
tests/src/helpers Makefile.am
tests/src/util xmltimestampfilter.cpp
Log:
LOGCXX-10: tchar.h/unicode: Encoding unit tests
Revision Changes Path
1.44 +185 -184 logging-log4cxx/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/logging-log4cxx/configure.in,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- configure.in 13 Aug 2004 12:27:45 -0000 1.43
+++ configure.in 15 Dec 2004 08:10:36 -0000 1.44
@@ -41,47 +41,47 @@
# CXX fine tuning
case "$host" in
*-dec-osf*)
- CXXFLAGS="$CXXFLAGS -std strict_ansi_errors"
- ;;
+ CXXFLAGS="$CXXFLAGS -std strict_ansi_errors"
+ ;;
*)
- ;;
+ ;;
esac
# Doxygen
AC_ARG_ENABLE(doxygen,
- AC_HELP_STRING(--enable-doxygen,
- [enable documentation generation with doxygen (auto)]))
+ 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_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_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])
+ 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
+ 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)
@@ -101,34 +101,34 @@
# CppUnit
AC_ARG_ENABLE(cppunit,
- AC_HELP_STRING(--enable-cppunit,
- [enable test excution with cppunit (auto)]))
+ AC_HELP_STRING(--enable-cppunit,
+ [enable test excution with cppunit (auto)]))
enable_tests=yes
if test "x$enable_cppunit" = xno; then
enable_tests=no
else
- AC_CHECK_PROG(CPPUNIT_CONFIG, cppunit-config, yes, no)
- if test "x$CPPUNIT_CONFIG" = "xyes"
- then
- LIBS_CPPUNIT="`cppunit-config --libs`"
- CPPFLAGS_CPPUNIT="`cppunit-config --cflags`"
- AC_SUBST(LIBS_CPPUNIT)
- AC_SUBST(CPPFLAGS_CPPUNIT)
- else
- AC_MSG_WARN(cppunit not found !)
- fi
-
- AC_CHECK_HEADER([cppunit/TestFixture.h],,
- enable_tests=no)
+ AC_CHECK_PROG(CPPUNIT_CONFIG, cppunit-config, yes, no)
+ if test "x$CPPUNIT_CONFIG" = "xyes"
+ then
+ LIBS_CPPUNIT="`cppunit-config --libs`"
+ CPPFLAGS_CPPUNIT="`cppunit-config --cflags`"
+ AC_SUBST(LIBS_CPPUNIT)
+ AC_SUBST(CPPFLAGS_CPPUNIT)
+ else
+ AC_MSG_WARN(cppunit not found !)
+ fi
+
+ AC_CHECK_HEADER([cppunit/TestFixture.h],,
+ enable_tests=no)
fi
AC_HAVE_LIBRARY([boost_regex],,
- enable_tests=no)
+ enable_tests=no)
AC_CHECK_HEADERS([boost/regex.hpp],,
- enable_tests=no)
+ enable_tests=no)
AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
@@ -137,6 +137,7 @@
# Checks header files
#
----------------------------------------------------------------------------
AC_CHECK_HEADERS(unistd.h io.h alloca.h)
+AC_CHECK_HEADERS(apr.h,, AC_MSG_ERROR(Apache Portable Runtime headers not
found))
# Checks local idioms
#
----------------------------------------------------------------------------
@@ -155,101 +156,101 @@
# for threads
AC_MSG_CHECKING(for thread support)
AC_ARG_WITH(thread,
- AC_HELP_STRING(--with-thread, [thread support. Accepted arguments :
- pthread, Microsoft, no (default=pthread)]),
- [ac_with_thread=$withval],
- [ac_with_thread=pthread])
+ AC_HELP_STRING(--with-thread, [thread support. Accepted arguments :
+ pthread, Microsoft, no (default=pthread)]),
+ [ac_with_thread=$withval],
+ [ac_with_thread=pthread])
case "$ac_with_thread" in
Microsoft)
- AC_DEFINE(HAVE_MS_THREAD, 1, thread support through Microsoft threads.)
- AC_DEFINE(HAVE_THREAD, 1, thread support)
- AC_MSG_RESULT(Microsoft)
- ;;
+ AC_DEFINE(HAVE_MS_THREAD, 1, thread support through Microsoft
threads.)
+ AC_DEFINE(HAVE_THREAD, 1, thread support)
+ AC_MSG_RESULT(Microsoft)
+ ;;
pthread)
- AC_MSG_RESULT(pthread)
- AC_CHECK_HEADER(pthread.h,, AC_MSG_ERROR(pthread library not found !))
- AC_DEFINE(HAVE_PTHREAD, 1, thread support through pthread library.)
- AC_DEFINE(HAVE_THREAD, 1, thread support)
-
- case "$host" in
- *freebsd*)
- CPPFLAGS="$CPPLAGS -D_THREAD_SAFE"
- LIBS="-pthread $LIBS"
- ;;
- *solaris*)
- AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM(,[
- #if defined(sparc) && defined(__SUNPRO_CC)
- char c;
- #endif
- c = 0;]),
- sunpro_cc=yes,
- sunpro_cc=no)
- if test "x$sunpro_cc" = "xyes"
- then
- CPPFLAGS="$CPPFLAGS -D_REENTRANT
-features=%all,no%iddollar,extensions -xarch=v8plus"
- LIBS="-lpthread -lrt -xarch=v8plus $LIBS"
- else
- CPPFLAGS="$CPPFLAGS -D_REENTRANT"
- LIBS="-lpthread -lrt $LIBS"
- fi
- ;;
- *)
- CPPFLAGS="$CPPFLAGS -D_REENTRANT"
- LIBS="-lpthread $LIBS"
- ;;
- esac
-
- ;;
- no)
- AC_MSG_RESULT(no)
- ;;
+ AC_MSG_RESULT(pthread)
+ AC_CHECK_HEADER(pthread.h,, AC_MSG_ERROR(pthread library not found
!))
+ AC_DEFINE(HAVE_PTHREAD, 1, thread support through pthread library.)
+ AC_DEFINE(HAVE_THREAD, 1, thread support)
+
+ case "$host" in
+ *freebsd*)
+ CPPFLAGS="$CPPLAGS -D_THREAD_SAFE"
+ LIBS="-pthread $LIBS"
+ ;;
+ *solaris*)
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM(,[
+ #if defined(sparc) && defined(__SUNPRO_CC)
+ char c;
+ #endif
+ c = 0;]),
+ sunpro_cc=yes,
+ sunpro_cc=no)
+ if test "x$sunpro_cc" = "xyes"
+ then
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT
-features=%all,no%iddollar,extensions -xarch=v8plus"
+ LIBS="-lpthread -lrt -xarch=v8plus $LIBS"
+ else
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ LIBS="-lpthread -lrt $LIBS"
+ fi
+ ;;
+ *)
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ LIBS="-lpthread $LIBS"
+ ;;
+ esac
+
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
*)
- AC_MSG_RESULT(???)
- AC_MSG_ERROR(Unknown option : $ac_with_thread)
- ;;
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Unknown option : $ac_with_thread)
+ ;;
esac
# for SocketAppender
AC_CHECK_FUNCS(gethostbyname,,
- [AC_CHECK_LIB(nsl,gethostbyname,,
- [AC_CHECK_LIB(socket,gethostbyname)])])
-AC_CHECK_FUNCS(setsockopt,,[AC_CHECK_LIB(socket,setsockopt)])
+ [AC_CHECK_LIB(nsl,gethostbyname,,
+ [AC_CHECK_LIB(socket,gethostbyname)])])
+AC_CHECK_FUNCS(setsockopt,,[AC_CHECK_LIB(socket,setsockopt)])
# for DOMConfigurator
AC_MSG_CHECKING(for XML support)
AC_ARG_WITH(XML,
- AC_HELP_STRING(--with-XML, [XML support. Accepted arguments :
- libxml2, Microsoft, no (default=libxml2)]),
- [ac_with_xml=$withval],
- [ac_with_xml=libxml2]
- )
+ AC_HELP_STRING(--with-XML, [XML support. Accepted arguments :
+ libxml2, Microsoft, no (default=libxml2)]),
+ [ac_with_xml=$withval],
+ [ac_with_xml=libxml2]
+ )
case "$ac_with_xml" in
Microsoft)
- AC_DEFINE(HAVE_MS_XML, 1, ODBC support through Microsoft XML.)
- AC_DEFINE(HAVE_XML, 1, XML support)
- AC_MSG_RESULT(Microsoft)
- ;;
+ AC_DEFINE(HAVE_MS_XML, 1, ODBC support through Microsoft XML.)
+ AC_DEFINE(HAVE_XML, 1, XML support)
+ AC_MSG_RESULT(Microsoft)
+ ;;
libxml2)
- AC_MSG_RESULT(libxml2)
- AC_CHECK_PROG(XML2_CONFIG, xml2-config, yes, no)
- if test "x$XML2_CONFIG" = "xyes"
- then
- AC_DEFINE(HAVE_LIBXML2, 1, XML support through libxml2.)
- AC_DEFINE(HAVE_XML, 1, XML support)
- LIBS_XML="`xml2-config --libs`"
- CPPFLAGS_XML="`xml2-config --cflags`"
- else
- AC_MSG_WARN(libxml2 not found !)
- fi
- ;;
- no)
- AC_MSG_RESULT(no)
- ;;
+ AC_MSG_RESULT(libxml2)
+ AC_CHECK_PROG(XML2_CONFIG, xml2-config, yes, no)
+ if test "x$XML2_CONFIG" = "xyes"
+ then
+ AC_DEFINE(HAVE_LIBXML2, 1, XML support through libxml2.)
+ AC_DEFINE(HAVE_XML, 1, XML support)
+ LIBS_XML="`xml2-config --libs`"
+ CPPFLAGS_XML="`xml2-config --cflags`"
+ else
+ AC_MSG_WARN(libxml2 not found !)
+ fi
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
*)
- AC_MSG_RESULT(???)
- AC_MSG_ERROR(Unknown option : $ac_with_xml)
- ;;
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Unknown option : $ac_with_xml)
+ ;;
esac
AC_SUBST(LIBS_XML)
AC_SUBST(CPPFLAGS_XML)
@@ -257,52 +258,52 @@
#for UNICODE
AC_MSG_CHECKING(for UTF-16 Unicode support)
AC_ARG_ENABLE(unicode,
- AC_HELP_STRING(--enable-unicode, [UTF-16 Unicode support (default=no)]),
- AC_DEFINE(UNICODE, 1, UTF-16 Unicode support.)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
+ AC_HELP_STRING(--enable-unicode, [UTF-16 Unicode support
(default=no)]),
+ AC_DEFINE(UNICODE, 1, UTF-16 Unicode support.)
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
#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])
+ 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_DEFINE(HAVE_MS_ODBC, 1, ODBC support through Microsoft ODBC.)
- AC_DEFINE(HAVE_ODBC, 1, ODBC support)
- AC_MSG_RESULT(Microsoft)
- LIBS_ODBC="-lodbc32"
- ;;
+ AC_DEFINE(HAVE_MS_ODBC, 1, ODBC support through Microsoft ODBC.)
+ AC_DEFINE(HAVE_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_DEFINE(HAVE_UNIX_ODBC, 1, ODBC support through unixODBC.)
- AC_DEFINE(HAVE_ODBC, 1, ODBC support)
- LIBS_ODBC="-lodbc"
- ;;
+ AC_MSG_RESULT(unixODBC)
+ AC_CHECK_HEADER(sqlext.h,, AC_MSG_ERROR(unixODBC not found !))
+ AC_DEFINE(HAVE_UNIX_ODBC, 1, ODBC support through unixODBC.)
+ AC_DEFINE(HAVE_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_DEFINE(HAVE_I_ODBC, 1, ODBC support through iODBC.)
- AC_DEFINE(HAVE_ODBC, 1, ODBC support)
- LIBS_ODBC="`iodbc-config --libs`"
- CPPFLAGS_ODBC="`iodbc-config --cflags`"
- else
- AC_MSG_ERROR(iODBC not found !)
- fi
- ;;
- no)
- AC_MSG_RESULT(no)
- ;;
+ AC_MSG_RESULT(iODBC)
+ AC_CHECK_PROG(IODBC_CONFIG, iodbc-config, yes, no)
+ if test "x$IODBC_CONFIG" = "xyes"
+ then
+ AC_DEFINE(HAVE_I_ODBC, 1, ODBC support through iODBC.)
+ AC_DEFINE(HAVE_ODBC, 1, ODBC support)
+ LIBS_ODBC="`iodbc-config --libs`"
+ CPPFLAGS_ODBC="`iodbc-config --cflags`"
+ else
+ AC_MSG_ERROR(iODBC not found !)
+ fi
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
*)
- AC_MSG_RESULT(???)
- AC_MSG_ERROR(Unknown option : $ac_with_odbc)
- ;;
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Unknown option : $ac_with_odbc)
+ ;;
esac
AC_SUBST(LIBS_ODBC)
AC_SUBST(CPPFLAGS_ODBC)
@@ -313,41 +314,41 @@
#for SMTPAppender
AC_MSG_CHECKING(for SMTP support)
AC_ARG_WITH(SMTP,
- AC_HELP_STRING(--with-SMTP, [SMTP support. Accepted arguments :
- libsmtp, CDO, no (default=no)]),
- [ac_with_smtp=$withval],
- [ac_with_smtp=no])
+ AC_HELP_STRING(--with-SMTP, [SMTP support. Accepted arguments :
+ libsmtp, CDO, no (default=no)]),
+ [ac_with_smtp=$withval],
+ [ac_with_smtp=no])
case "$ac_with_smtp" in
CDO)
- AC_MSG_RESULT(CDO)
- AC_DEFINE(HAVE_CDO_SMTP, 1, SMTP support through Microsoft CDO.)
- AC_DEFINE(HAVE_SMTP, 1, SMTP support)
- ;;
+ AC_MSG_RESULT(CDO)
+ AC_DEFINE(HAVE_CDO_SMTP, 1, SMTP support through Microsoft CDO.)
+ AC_DEFINE(HAVE_SMTP, 1, SMTP support)
+ ;;
libsmtp)
- AC_MSG_RESULT(libsmtp)
- AC_CHECK_LIB([smtp_mime], [libsmtp_session_initialize],,
- AC_MSG_ERROR(libsmtp library not found !),
- `glib-config --libs` -lsmtp)
- AC_DEFINE(HAVE_LIBSMTP, 1, SMTP support through libsmtp library.)
- AC_DEFINE(HAVE_SMTP, 1, SMTP support)
- LIBS="`glib-config --libs` -lsmtp $LIBS"
- CPPFLAGS="`glib-config --cflags` $CPPFLAGS"
- ;;
- no)
- AC_MSG_RESULT(no)
- ;;
+ AC_MSG_RESULT(libsmtp)
+ AC_CHECK_LIB([smtp_mime], [libsmtp_session_initialize],,
+ AC_MSG_ERROR(libsmtp library not found !),
+ `glib-config --libs` -lsmtp)
+ AC_DEFINE(HAVE_LIBSMTP, 1, SMTP support through libsmtp library.)
+ AC_DEFINE(HAVE_SMTP, 1, SMTP support)
+ LIBS="`glib-config --libs` -lsmtp $LIBS"
+ CPPFLAGS="`glib-config --cflags` $CPPFLAGS"
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
*)
- AC_MSG_RESULT(???)
- AC_MSG_ERROR(Unknown option : $ac_with_smtp)
- ;;
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Unknown option : $ac_with_smtp)
+ ;;
esac
#for _T
case "$host" in
- *apple-darwin*)
- AC_DEFINE(MUST_UNDEF_T, 1, Defined to 1 if macro _T has to be undefined)
- ;;
+ *apple-darwin*)
+ AC_DEFINE(MUST_UNDEF_T, 1, Defined to 1 if macro _T has to be
undefined)
+ ;;
esac
CPPFLAGS="-DLOG4CXX $CPPFLAGS"
1.6 +60 -58 logging-log4cxx/examples/delayedloop.cpp
Index: delayedloop.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/examples/delayedloop.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- delayedloop.cpp 26 Nov 2004 07:23:29 -0000 1.5
+++ delayedloop.cpp 15 Dec 2004 08:10:37 -0000 1.6
@@ -15,11 +15,12 @@
*/
#include <log4cxx/logger.h>
-#include <log4cxx//helpers/stringhelper.h>
#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <apr_general.h>
#include <apr_time.h>
+#include <iostream>
+#include <log4cxx/stream.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -31,65 +32,66 @@
*/
class DelayedLoop
{
- static LoggerPtr logger;
+ static LoggerPtr logger;
public:
- static void main(int argc, const char * const argv[])
- {
- if(argc == 2)
- {
- USES_CONVERSION;
- init(A2T(argv[1]));
- }
- else
- {
- usage(argv[0], "Wrong number of arguments.");
- }
-
- test();
- }
-
- static void usage(const char * programName, const char * msg)
- {
- std::cout << msg << std::endl;
- std::cout << "Usage: " << programName <<
- " configFile" << std::endl;
- exit(1);
- }
+ static void main(int argc, const char * const argv[])
+ {
+ if(argc == 2)
+ {
+ init(argv[1]);
+ }
+ else
+ {
+ usage(argv[0], "Wrong number of arguments.");
+ }
+
+ test();
+ }
+
+ static void usage(const char * programName, const char * msg)
+ {
+ std::cout << msg << std::endl;
+ std::cout << "Usage: " << programName <<
+ " configFile" << std::endl;
+ exit(1);
+ }
- static void init(const String& configFile)
- {
+ static void init(const std::string& configFile)
+ {
#ifdef HAVE_XML
- if(StringHelper::endsWith(configFile, _T("xml")))
- {
- xml::DOMConfigurator::configureAndWatch(configFile,
3000);
- }
- else
+ if(configFile.length() > 4 &&
+ configFile.substr(configFile.length() - 4) == ".xml")
+ {
+ xml::DOMConfigurator::configureAndWatch(configFile,
3000);
+ }
+ else
#endif
- {
- PropertyConfigurator::configureAndWatch(configFile,
3000);
- }
- }
-
- static void test()
- {
- int i = 0;
- while(true)
- {
- LOG4CXX_DEBUG(logger, _T("MSG ") << i++);
- try
- {
- apr_sleep(1000000);
- }
- catch(Exception& e)
- {
- }
- }
- }
+ {
+ PropertyConfigurator::configureAndWatch(configFile,
3000);
+ }
+ }
+
+ static void test()
+ {
+ int i = 0;
+ logstream log(logger, Level::DEBUG);
+ while(true)
+ {
+ log << L"MSG " << i++ << LOG4CXX_ENDMSG;
+ try
+ {
+ apr_sleep(1000000);
+ }
+ catch(Exception& e)
+ {
+ }
+ }
+ }
};
-LoggerPtr DelayedLoop::logger = Logger::getLogger(_T("DelayedLoop"));
+LoggerPtr DelayedLoop::logger = Logger::getLogger(L"DelayedLoop");
int main(int argc, const char * const argv[])
{
@@ -97,12 +99,12 @@
int result = EXIT_SUCCESS;
try
{
- DelayedLoop::main(argc, argv);
- }
- catch(Exception&)
- {
- result = EXIT_FAILURE;
- }
+ DelayedLoop::main(argc, argv);
+ }
+ catch(std::exception&)
+ {
+ result = EXIT_FAILURE;
+ }
apr_terminate();
return result;
1.2 +12 -12 logging-log4cxx/examples/stream.cpp
Index: stream.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/examples/stream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- stream.cpp 7 Oct 2004 18:52:12 -0000 1.1
+++ stream.cpp 15 Dec 2004 08:10:37 -0000 1.2
@@ -28,26 +28,26 @@
int result = EXIT_SUCCESS;
try
{
- BasicConfigurator::configure();
- LoggerPtr rootLogger = Logger::getRootLogger();
+ BasicConfigurator::configure();
+ LoggerPtr rootLogger = Logger::getRootLogger();
- NDC::push(_T("trivial context"));
+ NDC::push("trivial context");
log4cxx::logstream logstream(rootLogger, Level::DEBUG);
- logstream << "debug message" << LOG4CXX_ENDMSG;
+ logstream << "debug message " << 1 << LOG4CXX_ENDMSG;
logstream.setLevel(Level::INFO);
- logstream << "info message" << LOG4CXX_ENDMSG;
+ logstream << L"info message" << LOG4CXX_ENDMSG;
logstream << Level::WARN << "warn message" << LOG4CXX_ENDMSG;
- logstream << Level::ERROR << "error message" <<
LOG4CXX_ENDMSG;
+ logstream << Level::ERROR << L"error message" <<
LOG4CXX_ENDMSG;
logstream << Level::FATAL << "fatal message" <<
LOG4CXX_ENDMSG;
- NDC::pop();
- }
- catch(Exception&)
- {
- result = EXIT_FAILURE;
- }
+ NDC::pop();
+ }
+ catch(std::exception&)
+ {
+ result = EXIT_FAILURE;
+ }
return result;
}
1.6 +19 -19 logging-log4cxx/examples/trivial.cpp
Index: trivial.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/examples/trivial.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- trivial.cpp 20 May 2004 07:13:31 -0000 1.5
+++ trivial.cpp 15 Dec 2004 08:10:37 -0000 1.6
@@ -1,19 +1,19 @@
/*
* Copyright 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.
*/
-
+
#include <stdlib.h>
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
@@ -28,23 +28,23 @@
int result = EXIT_SUCCESS;
try
{
- BasicConfigurator::configure();
- LoggerPtr rootLogger = Logger::getRootLogger();
+ BasicConfigurator::configure();
+ LoggerPtr rootLogger = Logger::getRootLogger();
+
+ NDC::push("trivial context");
- NDC::push(_T("trivial context"));
+ LOG4CXX_DEBUG(rootLogger, "debug message");
+ LOG4CXX_INFO(rootLogger, L"info message");
+ LOG4CXX_WARN(rootLogger, "warn message");
+ LOG4CXX_ERROR(rootLogger, "error message");
+ LOG4CXX_FATAL(rootLogger, L"fatal message");
- rootLogger->debug(_T("debug message"));
- rootLogger->info(_T("info message"));
- rootLogger->warn(_T("warn message"));
- rootLogger->error(_T("error message"));
- rootLogger->fatal(_T("fatal message"));
-
- NDC::pop();
- }
- catch(Exception&)
- {
- result = EXIT_FAILURE;
- }
+ NDC::pop();
+ }
+ catch(std::exception&)
+ {
+ result = EXIT_FAILURE;
+ }
return result;
}
1.5 +3 -0 logging-log4cxx/include/log4cxx/file.h
Index: file.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/file.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- file.h 15 Dec 2004 00:38:47 -0000 1.4
+++ file.h 15 Dec 2004 08:10:38 -0000 1.5
@@ -60,6 +60,9 @@
log4cxx_status_t write(const LogString& src, apr_pool_t*
p) const;
+ log4cxx_status_t open(apr_file_t** file, int flags,
+ int perm, apr_pool_t* p) const;
+
private:
LogString internalName;
std::string mbcsName;
1.18 +1 -1 logging-log4cxx/include/log4cxx/fileappender.h
Index: fileappender.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/fileappender.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- fileappender.h 15 Dec 2004 00:15:19 -0000 1.17
+++ fileappender.h 15 Dec 2004 08:10:38 -0000 1.18
@@ -169,7 +169,7 @@
*/
virtual void closeWriter();
- virtual void subAppend(const char* encoded, apr_size_t size,
apr_pool_t* p);
+ virtual void subAppend(const char* encoded, log4cxx_size_t size,
apr_pool_t* p);
public:
/**
1.13 +114 -114 logging-log4cxx/include/log4cxx/rollingfileappender.h
Index: rollingfileappender.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/rollingfileappender.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- rollingfileappender.h 11 Dec 2004 04:53:21 -0000 1.12
+++ rollingfileappender.h 15 Dec 2004 08:10:38 -0000 1.13
@@ -22,120 +22,120 @@
namespace log4cxx
{
- /**
- RollingFileAppender extends FileAppender to backup the log files when
- they reach a certain size.
- */
- class LOG4CXX_EXPORT RollingFileAppender : public FileAppender
- {
- protected:
- /**
- The default maximum file size is 10MB.
- */
- long maxFileSize;
-
- /**
- There is one backup file by default.
- */
- int maxBackupIndex;
-
- public:
- DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(RollingFileAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
- END_LOG4CXX_CAST_MAP()
- /**
- The default constructor simply calls its [EMAIL PROTECTED]
- FileAppender#FileAppender parents constructor}. */
- RollingFileAppender();
-
- /**
- Instantiate a RollingFileAppender and open the file designated
by
- <code>filename</code>. The opened filename will become the ouput
- destination for this appender.
-
- <p>If the <code>append</code> parameter is true, the file will
be
- appended to. Otherwise, the file desginated by
- <code>filename</code> will be truncated before being opened.
- */
- RollingFileAppender(const LayoutPtr& layout, const File&
fileName, bool append);
-
- /**
- Instantiate a FileAppender and open the file designated by
- <code>filename</code>. The opened filename will become the
output
- destination for this appender.
- <p>The file will be appended to. */
- RollingFileAppender(const LayoutPtr& layout, const File&
fileName);
-
- ~RollingFileAppender();
-
- /**
- Returns the value of the <b>MaxBackupIndex</b> option.
- */
- inline int getMaxBackupIndex() const
- { return maxBackupIndex; }
-
- /**
- Get the maximum size that the output file is allowed to reach
- before being rolled over to backup files.
- */
- inline long getMaximumFileSize() const
- { return maxFileSize; }
-
- /**
- Implements the usual roll over behaviour.
-
- <p>If <code>MaxBackupIndex</code> is positive, then files
- {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>}
- are renamed to {<code>File.2</code>, ...,
- <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code>
is
- renamed <code>File.1</code> and closed. A new <code>File</code>
is
- created to receive further log output.
-
- <p>If <code>MaxBackupIndex</code> is equal to zero, then the
- <code>File</code> is truncated with no backup files created.
- */
- // synchronization not necessary since doAppend is alreasy
synched
- void rollOver();
-
- /**
- Set the maximum number of backup files to keep around.
-
- <p>The <b>MaxBackupIndex</b> option determines how many backup
- files are kept before the oldest is erased. This option takes
- a positive integer value. If set to zero, then there will be no
- backup files and the log file will be truncated when it reaches
- <code>MaxFileSize</code>.
- */
- inline void setMaxBackupIndex(int maxBackupIndex)
- { this->maxBackupIndex = maxBackupIndex; }
-
- /**
- Set the maximum size that the output file is allowed to reach
- before being rolled over to backup files.
-
- <p>In configuration files, the <b>MaxFileSize</b> option takes
an
- long integer in the range 0 - 2^63. You can specify the value
- with the suffixes "KB", "MB" or "GB" so that the integer is
- interpreted being expressed respectively in kilobytes, megabytes
- or gigabytes. For example, the value "10KB" will be interpreted
- as 10240.
- */
- inline void setMaxFileSize(const LogString& value)
- { maxFileSize = helpers::OptionConverter::toFileSize(
- value, maxFileSize + 1); }
-
-
- virtual void setOption(const LogString& option, const
LogString& value);
-
- protected:
- /**
- This method differentiates RollingFileAppender from its parent
- class.
- */
- virtual void subAppend(const char* encoded, apr_size_t size,
apr_pool_t* p);
- }; // class RollingFileAppender
+ /**
+ RollingFileAppender extends FileAppender to backup the log files when
+ they reach a certain size.
+ */
+ class LOG4CXX_EXPORT RollingFileAppender : public FileAppender
+ {
+ protected:
+ /**
+ The default maximum file size is 10MB.
+ */
+ long maxFileSize;
+
+ /**
+ There is one backup file by default.
+ */
+ int maxBackupIndex;
+
+ public:
+ DECLARE_LOG4CXX_OBJECT(RollingFileAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(RollingFileAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(FileAppender)
+ END_LOG4CXX_CAST_MAP()
+ /**
+ The default constructor simply calls its [EMAIL PROTECTED]
+ FileAppender#FileAppender parents constructor}. */
+ RollingFileAppender();
+
+ /**
+ Instantiate a RollingFileAppender and open the file
designated by
+ <code>filename</code>. The opened filename will become the
ouput
+ destination for this appender.
+
+ <p>If the <code>append</code> parameter is true, the file
will be
+ appended to. Otherwise, the file desginated by
+ <code>filename</code> will be truncated before being opened.
+ */
+ RollingFileAppender(const LayoutPtr& layout, const File&
fileName, bool append);
+
+ /**
+ Instantiate a FileAppender and open the file designated by
+ <code>filename</code>. The opened filename will become the
output
+ destination for this appender.
+ <p>The file will be appended to. */
+ RollingFileAppender(const LayoutPtr& layout, const File&
fileName);
+
+ ~RollingFileAppender();
+
+ /**
+ Returns the value of the <b>MaxBackupIndex</b> option.
+ */
+ inline int getMaxBackupIndex() const
+ { return maxBackupIndex; }
+
+ /**
+ Get the maximum size that the output file is allowed to reach
+ before being rolled over to backup files.
+ */
+ inline long getMaximumFileSize() const
+ { return maxFileSize; }
+
+ /**
+ Implements the usual roll over behaviour.
+
+ <p>If <code>MaxBackupIndex</code> is positive, then files
+ {<code>File.1</code>, ..., <code>File.MaxBackupIndex
-1</code>}
+ are renamed to {<code>File.2</code>, ...,
+ <code>File.MaxBackupIndex</code>}. Moreover,
<code>File</code> is
+ renamed <code>File.1</code> and closed. A new
<code>File</code> is
+ created to receive further log output.
+
+ <p>If <code>MaxBackupIndex</code> is equal to zero, then the
+ <code>File</code> is truncated with no backup files created.
+ */
+ // synchronization not necessary since doAppend is alreasy
synched
+ void rollOver();
+
+ /**
+ Set the maximum number of backup files to keep around.
+
+ <p>The <b>MaxBackupIndex</b> option determines how many
backup
+ files are kept before the oldest is erased. This option takes
+ a positive integer value. If set to zero, then there will be
no
+ backup files and the log file will be truncated when it
reaches
+ <code>MaxFileSize</code>.
+ */
+ inline void setMaxBackupIndex(int maxBackupIndex)
+ { this->maxBackupIndex = maxBackupIndex; }
+
+ /**
+ Set the maximum size that the output file is allowed to reach
+ before being rolled over to backup files.
+
+ <p>In configuration files, the <b>MaxFileSize</b> option
takes an
+ long integer in the range 0 - 2^63. You can specify the value
+ with the suffixes "KB", "MB" or "GB" so that the integer is
+ interpreted being expressed respectively in kilobytes,
megabytes
+ or gigabytes. For example, the value "10KB" will be
interpreted
+ as 10240.
+ */
+ inline void setMaxFileSize(const LogString& value)
+ { maxFileSize = helpers::OptionConverter::toFileSize(
+ value, maxFileSize + 1); }
+
+
+ virtual void setOption(const LogString& option, const
LogString& value);
+
+ protected:
+ /**
+ This method differentiates RollingFileAppender from its
parent
+ class.
+ */
+ virtual void subAppend(const char* encoded, log4cxx_size_t
size, apr_pool_t* p);
+ }; // class RollingFileAppender
} // namespace log4cxx
#endif //_LOG4CXX_ROLLING_FILE_APPENDER_H
1.15 +133 -133 logging-log4cxx/include/log4cxx/writerappender.h
Index: writerappender.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/writerappender.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- writerappender.h 11 Dec 2004 05:42:26 -0000 1.14
+++ writerappender.h 15 Dec 2004 08:10:38 -0000 1.15
@@ -21,175 +21,175 @@
#include <log4cxx/helpers/transcoder.h>
#include <log4cxx/helpers/pool.h>
-typedef unsigned int apr_size_t;
+typedef size_t log4cxx_size_t;
typedef void* apr_iconv_t;
namespace log4cxx
{
- class WriterAppender;
- typedef helpers::ObjectPtrT<WriterAppender> WriterAppenderPtr;
+ class WriterAppender;
+ typedef helpers::ObjectPtrT<WriterAppender> WriterAppenderPtr;
namespace helpers {
class Transcoder;
}
- /**
- WriterAppender appends log events to a standard output stream
- */
- class LOG4CXX_EXPORT WriterAppender : public AppenderSkeleton
- {
- protected:
+ /**
+ WriterAppender appends log events to a standard output stream
+ */
+ class LOG4CXX_EXPORT WriterAppender : public AppenderSkeleton
+ {
+ protected:
log4cxx::helpers::Pool pool;
- /**
- Immediate flush means that the underlying writer or output
stream
- will be flushed at the end of each append operation. Immediate
- flush is slower but ensures that each append request is actually
- written. If <code>immediateFlush</code> is set to
+ /**
+ Immediate flush means that the underlying writer or output
stream
+ will be flushed at the end of each append operation.
Immediate
+ flush is slower but ensures that each append request is
actually
+ written. If <code>immediateFlush</code> is set to
+
+
+
+ <code>false</code>, then there is a good chance that the
last few
+ logs events are not actually written to persistent media if
and
+ when the application crashes.
+ <p>The <code>immediateFlush</code> variable is set to
+ <code>true</code> by default.
+ */
+ bool immediateFlush;
+
+ /**
+ The encoding to use when opening an input stream.
+ <p>The <code>encoding</code> variable is set to
<code>""</code> by
+ default which results in the utilization of the system's
default
+ encoding. */
+ LogString encoding;
- <code>false</code>, then there is a good chance that the last
few
- logs events are not actually written to persistent media if and
- when the application crashes.
-
- <p>The <code>immediateFlush</code> variable is set to
- <code>true</code> by default.
-
- */
- bool immediateFlush;
-
- /**
- The encoding to use when opening an input stream.
- <p>The <code>encoding</code> variable is set to <code>""</code>
by
- default which results in the utilization of the system's default
- encoding. */
- LogString encoding;
-
-
- public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(WriterAppender)
- BEGIN_LOG4CXX_CAST_MAP()
- LOG4CXX_CAST_ENTRY(WriterAppender)
- LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
- END_LOG4CXX_CAST_MAP()
-
- /**
- This default constructor does nothing.*/
- WriterAppender();
+
+ public:
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(WriterAppender)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(WriterAppender)
+ LOG4CXX_CAST_ENTRY_CHAIN(AppenderSkeleton)
+ END_LOG4CXX_CAST_MAP()
+
+ /**
+ This default constructor does nothing.*/
+ WriterAppender();
WriterAppender(const LayoutPtr& layout);
- ~WriterAppender();
+ ~WriterAppender();
- /**
- If the <b>ImmediateFlush</b> option is set to
- <code>true</code>, the appender will flush at the end of each
- write. This is the default behavior. If the option is set to
- <code>false</code>, then the underlying stream can defer writing
- to physical medium to a later time.
-
- <p>Avoiding the flush operation at the end of each append
results in
- a performance gain of 10 to 20 percent. However, there is safety
- tradeoff involved in skipping flushing. Indeed, when flushing is
- skipped, then it is likely that the last few log events will not
- be recorded on disk when the application exits. This is a high
- price to pay even for a 20% performance gain.
- */
- void setImmediateFlush(bool value) { immediateFlush = value; }
-
- /**
- Returns value of the <b>ImmediateFlush</b> option.
- */
- bool getImmediateFlush() const { return immediateFlush; }
-
- /**
- This method is called by the AppenderSkeleton#doAppend
- method.
-
- <p>If the output stream exists and is writable then write a log
- statement to the output stream. Otherwise, write a single
warning
- message to <code>stderr</code>.
+ /**
+ If the <b>ImmediateFlush</b> option is set to
+ <code>true</code>, the appender will flush at the end of each
+ write. This is the default behavior. If the option is set to
+ <code>false</code>, then the underlying stream can defer
writing
+ to physical medium to a later time.
+
+ <p>Avoiding the flush operation at the end of each append
results in
+ a performance gain of 10 to 20 percent. However, there is
safety
+ tradeoff involved in skipping flushing. Indeed, when
flushing is
+ skipped, then it is likely that the last few log events will
not
+ be recorded on disk when the application exits. This is a
high
+ price to pay even for a 20% performance gain.
+ */
+ void setImmediateFlush(bool value) { immediateFlush = value;
}
- <p>The format of the output will depend on this appender's
- layout.
+ /**
+ Returns value of the <b>ImmediateFlush</b> option.
+ */
+ bool getImmediateFlush() const { return immediateFlush; }
+
+ /**
+ This method is called by the AppenderSkeleton#doAppend
+ method.
- */
- virtual void append(const spi::LoggingEventPtr& event,
apr_pool_t* p);
+ <p>If the output stream exists and is writable then write a
log
+ statement to the output stream. Otherwise, write a single
warning
+ message to <code>stderr</code>.
+
+ <p>The format of the output will depend on this appender's
+ layout.
+
+ */
+ virtual void append(const spi::LoggingEventPtr& event,
apr_pool_t* p);
/**
*
*/
void activateOptions(apr_pool_t* pool);
- protected:
- /**
- This method determines if there is a sense in attempting to
append.
+ protected:
+ /**
+ This method determines if there is a sense in attempting to
append.
- <p>It checks whether there is a set output target and also if
- there is a set layout. If these checks fail, then the boolean
- value <code>false</code> is returned. */
- virtual bool checkEntryConditions() const;
+ <p>It checks whether there is a set output target and also if
+ there is a set layout. If these checks fail, then the boolean
+ value <code>false</code> is returned. */
+ virtual bool checkEntryConditions() const;
- public:
- /**
- Close this appender instance. The underlying stream or writer is
- also closed.
+ public:
+ /**
+ Close this appender instance. The underlying stream or
writer is
+ also closed.
- <p>Closed appenders cannot be reused.
- */
- virtual void close();
+ <p>Closed appenders cannot be reused.
+ */
+ virtual void close();
- protected:
- /**
- * Close the underlying output stream.
- * */
- virtual void closeWriter() = 0;
+ protected:
+ /**
+ * Close the underlying output stream.
+ * */
+ virtual void closeWriter() = 0;
- public:
- const LogString& getEncoding() const;
- void setEncoding(const LogString& value);
+ public:
+ const LogString& getEncoding() const;
+ void setEncoding(const LogString& value);
- protected:
- /**
+ protected:
+ /**
- Actual writing occurs here.
+ Actual writing occurs here.
- <p>Most subclasses of <code>WriterAppender</code> will need to
- override one of these method.
- */
- virtual void subAppend(const spi::LoggingEventPtr& event,
apr_pool_t* p);
+ <p>Most subclasses of <code>WriterAppender</code> will need
to
+ override one of these method.
+ */
+ virtual void subAppend(const spi::LoggingEventPtr& event,
apr_pool_t* p);
virtual void subAppend(const LogString& msg, apr_pool_t* p);
- virtual void subAppend(const char* encoded, apr_size_t size,
apr_pool_t* p);
+ virtual void subAppend(const char* encoded, log4cxx_size_t
size, apr_pool_t* p);
- /**
- The WriterAppender requires a layout. Hence, this method returns
- <code>true</code>.
- */
- public:
- virtual bool requiresLayout() const { return true; }
-
- /**
- Clear internal references to the writer and other variables.
-
- Subclasses can override this method for an alternate closing
- behavior. */
-
- protected:
- virtual void reset();
-
- /**
- Write a footer as produced by the embedded layout's
- Layout#appendFooter method. */
- protected:
- virtual void writeFooter(apr_pool_t* p);
-
- /**
- Write a header as produced by the embedded layout's
- Layout#appendHeader method. */
- protected:
- virtual void writeHeader(apr_pool_t* p);
+ /**
+ The WriterAppender requires a layout. Hence, this method returns
+ <code>true</code>.
+ */
+ public:
+ virtual bool requiresLayout() const { return true; }
+
+ /**
+ Clear internal references to the writer and other variables.
+
+ Subclasses can override this method for an alternate closing
+ behavior. */
+
+ protected:
+ virtual void reset();
+
+ /**
+ Write a footer as produced by the embedded layout's
+ Layout#appendFooter method. */
+ protected:
+ virtual void writeFooter(apr_pool_t* p);
+
+ /**
+ Write a header as produced by the embedded layout's
+ Layout#appendHeader method. */
+ protected:
+ virtual void writeHeader(apr_pool_t* p);
private:
//
@@ -199,7 +199,7 @@
apr_iconv_t transcoder;
enum { SUBSTITUTION_CHAR = LOG4CXX_STR('?') };
enum { BUFSIZE = 1024 };
- };
+ };
} //namespace log4cxx
#endif //_LOG4CXX_WRITER_APPENDER_H
1.5 +0 -2 logging-log4cxx/include/log4cxx/helpers/transcoder.h
Index: transcoder.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/transcoder.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- transcoder.h 14 Dec 2004 19:03:14 -0000 1.4
+++ transcoder.h 15 Dec 2004 08:10:39 -0000 1.5
@@ -82,8 +82,6 @@
enum { BUFSIZE = 256 };
static const Transcoder& detect(unsigned char byte0, unsigned char
byte1, size_t* offset);
};
- static const char SUBSTITUTION_CHAR = '?';
- static const wchar_t SUBSTITUTION_WCHAR = L'?';
}
};
1.13 +82 -82 logging-log4cxx/performance/main.cpp
Index: main.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/performance/main.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- main.cpp 13 Dec 2004 05:05:13 -0000 1.12
+++ main.cpp 15 Dec 2004 08:10:39 -0000 1.13
@@ -23,6 +23,9 @@
#include <apr_general.h>
#include <apr_pools.h>
#include <apr_time.h>
+#include <iostream>
+
+#define _T(str) str
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -37,16 +40,16 @@
LoggerPtr logger =
Logger::getLogger(_T("A0123456789.B0123456789.C0123456789"));
-void Usage(const String& processName, const String& msg)
+void Usage(const std::string& processName, const std::string& msg)
{
- tcerr << msg << std::endl;
- tcerr <<
- _T("Usage: ") << processName
- << _T(" confFile runLength [delay] [burstLen]") << std::endl
- << _T(" confFile is an XML configuration file and") <<
std::endl
- << _T(" runLength (integer) is the length of test loop.")
<< std::endl
- << _T(" delay is the time in millisecs to wait every
burstLen log requests.") << std::endl;
- exit(EXIT_FAILURE);
+ std::cerr << msg << std::endl;
+ std::cerr <<
+ "Usage: " << processName
+ << " confFile runLength [delay] [burstLen]" << std::endl
+ << " confFile is an XML configuration file and" <<
std::endl
+ << " runLength (integer) is the length of test loop."
<< std::endl
+ << " delay is the time in millisecs to wait every
burstLen log requests." << std::endl;
+ exit(EXIT_FAILURE);
}
class IllegalRunLengthException : public IllegalArgumentException {
@@ -57,106 +60,103 @@
}
};
-void init(const String& configFile, const String& runLengthStr,
- const String& delayStr, const String& burstLenStr)
+void init(const std::string& configFile, const std::string& runLengthStr,
+ const std::string& delayStr, const std::string&
burstLenStr)
{
- runLength = OptionConverter::toInt(runLengthStr, runLength);
- if (runLength < 1)
- {
- throw IllegalRunLengthException();
- }
- if (!delayStr.empty())
- {
- delay = OptionConverter::toInt(delayStr, delay);
- }
- if (!burstLenStr.empty())
- {
- burstLen = OptionConverter::toInt(burstLenStr, burstLen);
- DELAY_MULT = 1000/burstLen;
- }
+ runLength = atoi(runLengthStr.c_str());
+ if (runLength < 1)
+ {
+ throw IllegalRunLengthException();
+ }
+ if (!delayStr.empty())
+ {
+ delay = atoi(delayStr.c_str());
+ }
+ if (!burstLenStr.empty())
+ {
+ burstLen = atoi(burstLenStr.c_str());
+ DELAY_MULT = 1000/burstLen;
+ }
#ifdef LOG4CXX_HAVE_XML
- xml::DOMConfigurator::configure(configFile);
+ xml::DOMConfigurator::configure(configFile);
#endif
}
-double NoDelayLoop(LoggerPtr logger, const String& msg)
+double NoDelayLoop(LoggerPtr logger, const std::string& msg)
{
- log4cxx_time_t before = apr_time_now();
- for(int i = 0; i < runLength; i++)
- {
- logger->info(msg, __FILE__, __LINE__);
+ log4cxx_time_t before = apr_time_now();
+ for(int i = 0; i < runLength; i++) {
+ logger->info(msg, LOG4CXX_LOCATION);
}
- log4cxx_time_t after = apr_time_now();
- return (after - before)/(runLength*1000);
+ log4cxx_time_t after = apr_time_now();
+ return (after - before)/(runLength*1000);
}
-double DelayedLoop(LoggerPtr logger, const String& msg)
+double DelayedLoop(LoggerPtr logger, const std::string& msg)
{
log4cxx_time_t before = apr_time_now();
int j = 0;
for(int i = 0; i < runLength; i++)
- {
- logger->info(msg);
- if(j++ == burstLen)
- {
- j = 0;
- try
- {
+ {
+ logger->info(msg, LOG4CXX_LOCATION);
+ if(j++ == burstLen)
+ {
+ j = 0;
+ try
+ {
apr_sleep(delay * 1000);
- }
- catch(Exception&)
- {
- }
- }
+ }
+ catch(Exception&)
+ {
+ }
+ }
}
double actualTime = (apr_time_now()-before)/(runLength*1000);
- tcout << "actual time: " << actualTime << std::endl;
+ std::cout << "actual time: " << actualTime << std::endl;
return (actualTime - delay*DELAY_MULT);
}
int main(int argc, const char* const argv[])
{
apr_app_initialize(&argc, &argv, NULL);
- int ret = EXIT_SUCCESS;
+ int ret = EXIT_SUCCESS;
- try
- {
- USES_CONVERSION;
-
- if(argc == 3)
- init(A2T(argv[1]), A2T(argv[2]), String(), String());
- else if(argc == 5)
- init(A2T(argv[1]), A2T(argv[2]), A2T(argv[3]),
A2T(argv[4]));
- else
- Usage(A2T(argv[0]), _T("Wrong number of arguments."));
-
-
- NDC::push(_T("some context"));
-
- double delta;
- String msg =
_T("ABCDEGHIJKLMNOPQRSTUVWXYZabcdeghijklmnopqrstuvwxyz1234567890");
- if(delay <= 0)
- {
- delta = NoDelayLoop(logger, msg);
- }
- else
- {
- delta = DelayedLoop(logger, msg);
- }
-
- tcout << (int)delta << std::endl;
-
- LogManager::shutdown();
- }
- catch(Exception&)
- {
- ret = EXIT_FAILURE;
- }
+ try
+ {
+ if(argc == 3)
+ init(argv[1], argv[2], "", "");
+ else if(argc == 5)
+ init(argv[1], argv[2], argv[3], argv[4]);
+ else
+ Usage(argv[0], "Wrong number of arguments.");
+
+
+ NDC::push(_T("some context"));
+
+ double delta;
+ std::string msg =
_T("ABCDEGHIJKLMNOPQRSTUVWXYZabcdeghijklmnopqrstuvwxyz1234567890");
+ if(delay <= 0)
+ {
+ delta = NoDelayLoop(logger, msg);
+ }
+ else
+ {
+ delta = DelayedLoop(logger, msg);
+ }
+
+ std::cout << (int)delta << std::endl;
+
+ LogManager::shutdown();
+ }
+ catch(Exception&)
+ {
+ ret = EXIT_FAILURE;
+ }
apr_terminate();
- return ret;
+ return ret;
}
1.3 +48 -47 logging-log4cxx/simplesocketserver/simplesocketserver.cpp
Index: simplesocketserver.cpp
===================================================================
RCS file:
/home/cvs/logging-log4cxx/simplesocketserver/simplesocketserver.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- simplesocketserver.cpp 26 Nov 2004 07:23:30 -0000 1.2
+++ simplesocketserver.cpp 15 Dec 2004 08:10:39 -0000 1.3
@@ -29,6 +29,8 @@
#include <log4cxx/logmanager.h>
#include <log4cxx/level.h>
#include <log4cxx/helpers/stringhelper.h>
+#include <iostream>
+#include <log4cxx/stream.h>
using namespace log4cxx;
#ifdef HAVE_XML
@@ -39,28 +41,28 @@
int port = 0;
-void usage(const String& msg)
+void usage(const std::string& msg)
{
- tcout << msg << std::endl;
- tcout << _T("Usage: simpleocketServer port configFile") << std::endl;
+ std::cout << msg << std::endl;
+ std::cout << "Usage: simpleocketServer port configFile" << std::endl;
}
-void init(const String& portStr, const String& configFile)
+void init(const std::string& portStr, const std::string& configFile)
{
- USES_CONVERSION;
- port = ttol(portStr.c_str());
+ port = atol(portStr.c_str());
#ifdef HAVE_XML
- // tests if configFile ends with ".xml"
- if (StringHelper::endsWith(configFile, _T(".xml")))
- {
- DOMConfigurator::configure(configFile);
- }
- else
+ // tests if configFile ends with ".xml"
+ if (configFile.length() > 4 &&
+ configFile.substr(configFile.length() -4) == ".xml")
+ {
+ DOMConfigurator::configure(configFile);
+ }
+ else
#endif
- {
- PropertyConfigurator::configure(configFile);
- }
+ {
+ PropertyConfigurator::configure(configFile);
+ }
}
void* LOG4CXX_THREAD_FUNC runSocket(apr_thread_t* thread, void* data) {
@@ -73,50 +75,49 @@
int main(int argc, const char * const argv[])
{
apr_app_initialize(&argc, &argv, NULL);
- if(argc == 3)
- {
- USES_CONVERSION;
- init(A2T(argv[1]), A2T(argv[2]));
- }
- else
- {
- USES_CONVERSION;
- usage(_T("Wrong number of arguments."));
- return 1;
- }
+ if(argc == 3)
+ {
+ init(argv[1], argv[2]);
+ }
+ else
+ {
+ usage("Wrong number of arguments.");
+ return 1;
+ }
apr_pool_t* pool;
apr_status_t stat = apr_pool_create(&pool, NULL);
- try
- {
- LoggerPtr logger = Logger::getLogger(_T("SimpleSocketServer"));
+ try
+ {
+ LoggerPtr logger = Logger::getLogger(L"SimpleSocketServer");
+ log4cxx::logstream logstream(logger, Level::INFO);
- LOG4CXX_INFO(logger, _T("Listening on port ") << port);
+ logstream << L"Listening on port " << port;
- ServerSocket serverSocket(port);
+ ServerSocket serverSocket(port);
- while(true)
- {
- LOG4CXX_INFO(logger, _T("Waiting to accept a new
client."));
- SocketPtr socket = serverSocket.accept();
+ while(true)
+ {
+ logstream << "Waiting to accept a new client.";
+ SocketPtr socket = serverSocket.accept();
- LOG4CXX_INFO(logger, _T("Connected to client at ")
- << socket->getInetAddress().toString());
- LOG4CXX_INFO(logger, _T("Starting new socket node."));
+ logstream << "Connected to client at "
+ << socket->getInetAddress().toString();
+ logstream << "Starting new socket node.";
- Thread * thread = new Thread();
+ Thread * thread = new Thread();
SocketNode* node = new SocketNode(socket,
- LogManager::getLoggerRepository());
+ LogManager::getLoggerRepository());
thread->run(pool, runSocket, node);
- }
- }
- catch(SocketException& e)
- {
- tcout << _T("SocketException: ") << e.getMessage() << std::endl;
- }
+ }
+ }
+ catch(SocketException& e)
+ {
+ std::cout << "SocketException: " << e.what() << std::endl;
+ }
apr_pool_destroy(pool);
apr_terminate();
- return 0;
+ return 0;
}
1.21 +80 -79 logging-log4cxx/src/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/Makefile.am,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Makefile.am 26 Nov 2004 07:23:30 -0000 1.20
+++ Makefile.am 15 Dec 2004 08:10:39 -0000 1.21
@@ -3,92 +3,93 @@
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include
-I/usr/local/apr/include/apr-1
liblog4cxx_la_SOURCES = \
- appenderattachableimpl.cpp \
- appenderskeleton.cpp \
+ appenderattachableimpl.cpp \
+ appenderskeleton.cpp \
aprinitializer.cpp \
- asyncappender.cpp \
- basicconfigurator.cpp \
+ asyncappender.cpp \
+ basicconfigurator.cpp \
cacheddateformat.cpp \
- class.cpp \
- condition.cpp \
- configurator.cpp \
- consoleappender.cpp \
- cyclicbuffer.cpp \
- datagrampacket.cpp \
- datagramsocket.cpp \
- datelayout.cpp \
- dateformat.cpp \
- defaultcategoryfactory.cpp \
- domconfigurator.cpp \
- event.cpp \
- fallbackerrorhandler.cpp \
- fileappender.cpp \
- filewatchdog.cpp \
- formattinginfo.cpp \
- gnomexml.cpp \
- hierarchy.cpp \
- htmllayout.cpp \
- inetaddress.cpp \
- layout.cpp\
- level.cpp \
- levelmatchfilter.cpp \
- levelrangefilter.cpp \
- loader.cpp\
- locale.cpp\
+ class.cpp \
+ condition.cpp \
+ configurator.cpp \
+ consoleappender.cpp \
+ cyclicbuffer.cpp \
+ datagrampacket.cpp \
+ datagramsocket.cpp \
+ datelayout.cpp \
+ dateformat.cpp \
+ defaultcategoryfactory.cpp \
+ domconfigurator.cpp \
+ fallbackerrorhandler.cpp \
+ file.cpp \
+ fileappender.cpp \
+ filewatchdog.cpp \
+ formattinginfo.cpp \
+ gnomexml.cpp \
+ hierarchy.cpp \
+ htmllayout.cpp \
+ inetaddress.cpp \
+ layout.cpp\
+ level.cpp \
+ levelmatchfilter.cpp \
+ levelrangefilter.cpp \
+ loader.cpp\
+ locale.cpp\
locationinfo.cpp\
- logger.cpp \
- loggingevent.cpp \
- loglog.cpp \
- logmanager.cpp \
- mdc.cpp \
- msxml.cpp \
- mutex.cpp \
- ndc.cpp \
- nteventlogappender.cpp \
- objectimpl.cpp \
- odbcappender.cpp \
- onlyonceerrorhandler.cpp \
- optionconverter.cpp \
- patternconverter.cpp \
- patternlayout.cpp \
- patternparser.cpp \
+ logger.cpp \
+ loggingevent.cpp \
+ loglog.cpp \
+ logmanager.cpp \
+ mdc.cpp \
+ msxml.cpp \
+ mutex.cpp \
+ ndc.cpp \
+ nteventlogappender.cpp \
+ objectimpl.cpp \
+ odbcappender.cpp \
+ onlyonceerrorhandler.cpp \
+ optionconverter.cpp \
+ patternconverter.cpp \
+ patternlayout.cpp \
+ patternparser.cpp \
pool.cpp \
- properties.cpp \
- propertyconfigurator.cpp \
- propertyresourcebundle.cpp \
- propertysetter.cpp \
+ properties.cpp \
+ propertyconfigurator.cpp \
+ propertyresourcebundle.cpp \
+ propertysetter.cpp \
relativetimedateformat.cpp \
- resourcebundle.cpp \
- rollingfileappender.cpp \
- rootcategory.cpp \
- serversocket.cpp \
+ resourcebundle.cpp \
+ rollingfileappender.cpp \
+ rootcategory.cpp \
+ serversocket.cpp \
simpledateformat.cpp \
- simplelayout.cpp \
- smtpappender.cpp \
- socket.cpp \
- socketappender.cpp \
- sockethubappender.cpp \
- socketimpl.cpp \
- socketinputstream.cpp \
- socketnode.cpp \
- socketoutputstream.cpp \
+ simplelayout.cpp \
+ smtpappender.cpp \
+ socket.cpp \
+ socketappender.cpp \
+ sockethubappender.cpp \
+ socketimpl.cpp \
+ socketinputstream.cpp \
+ socketnode.cpp \
+ socketoutputstream.cpp \
strftimedateformat.cpp \
- stringhelper.cpp \
- stringmatchfilter.cpp \
- stringtokenizer.cpp \
- synchronized.cpp \
- syslogappender.cpp \
- syslogwriter.cpp \
- system.cpp \
- telnetappender.cpp \
- timezone.cpp \
- transform.cpp \
- thread.cpp \
- threadspecificdata.cpp \
- ttcclayout.cpp \
- writerappender.cpp \
- xmllayout.cpp\
- xmlsocketappender.cpp
+ stringhelper.cpp \
+ stringmatchfilter.cpp \
+ stringtokenizer.cpp \
+ synchronized.cpp \
+ syslogappender.cpp \
+ syslogwriter.cpp \
+ system.cpp \
+ telnetappender.cpp \
+ timezone.cpp \
+ transform.cpp \
+ thread.cpp \
+ threadspecificdata.cpp \
+ transcoder.cpp \
+ ttcclayout.cpp \
+ writerappender.cpp \
+ xmllayout.cpp\
+ xmlsocketappender.cpp
AM_CPPFLAGS = @CPPFLAGS_XML@ @CPPFLAGS_ODBC@
liblog4cxx_la_LDFLAGS = -version-info @LT_VERSION@ @LIBS_XML@ @LIBS_ODBC@
-L/usr/local/apr/lib -static -lapr-1 -lapriconv
1.6 +3 -3 logging-log4cxx/src/cacheddateformat.cpp
Index: cacheddateformat.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/cacheddateformat.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cacheddateformat.cpp 12 Dec 2004 05:53:58 -0000 1.5
+++ cacheddateformat.cpp 15 Dec 2004 08:10:39 -0000 1.6
@@ -49,7 +49,7 @@
p);
}
-int CachedDateFormat::findMillisecondStart(const apr_time_t time,
+int CachedDateFormat::findMillisecondStart(const log4cxx_time_t time,
const LogString& formatted,
logchar zeroDigit,
logchar nineDigit,
@@ -81,7 +81,7 @@
@param sbuf the string buffer to write to
@param fieldPosition remains untouched
*/
-void CachedDateFormat::format(LogString& s, apr_time_t date, apr_pool_t* p)
const {
+void CachedDateFormat::format(LogString& s, log4cxx_time_t date, apr_pool_t*
p) const {
if (millisecondStart == UNRECOGNIZED_MILLISECOND_PATTERN) {
formatter->format(s, date, p);
return;
@@ -113,7 +113,7 @@
if (date - prev < 0) {
prev -= APR_USEC_PER_SEC;
}
- previousTime = prev;
+ previousTime = prev;
int prevLength = cache.length();
cache.erase(cache.begin(), cache.end());
formatter->format(cache, date, p);
1.3 +15 -3 logging-log4cxx/src/file.cpp
Index: file.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/file.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- file.cpp 12 Dec 2004 05:53:58 -0000 1.2
+++ file.cpp 15 Dec 2004 08:10:39 -0000 1.3
@@ -52,6 +52,18 @@
File::~File() {
}
+log4cxx_status_t File::open(apr_file_t** file, int flags,
+ int perm, apr_pool_t* p) const {
+ //
+ // The trunction to MBCS can corrupt filenames
+ // would be nice to be able to do something about
+ // it here since we have both Unicode
+ // and local code page file names
+ //
+ return apr_file_open(file, mbcsName.c_str(), flags, perm, p);
+}
+
+
bool File::exists() const {
Pool pool;
apr_finfo_t finfo;
@@ -92,7 +104,7 @@
LogString File::read(apr_pool_t* p) const {
LogString output;
apr_file_t* f = NULL;
- apr_status_t rv = apr_file_open(&f, mbcsName.c_str(), APR_READ,
APR_OS_DEFAULT, p);
+ apr_status_t rv = open(&f, APR_READ, APR_OS_DEFAULT, p);
if (rv == APR_SUCCESS) {
const size_t BUFSIZE = 4096;
char* buf = (char*) apr_palloc(p, BUFSIZE);
@@ -124,8 +136,8 @@
contents = newContents;
}
} while(rv == APR_SUCCESS);
+ apr_file_close(f);
}
- apr_file_close(f);
return output;
}
@@ -138,7 +150,7 @@
apr_status_t File::write(const LogString& src, apr_pool_t* p) const {
LogString output;
apr_file_t* f = NULL;
- apr_status_t rv = apr_file_open(&f, mbcsName.c_str(),
+ apr_status_t rv = open(&f,
APR_WRITE | APR_TRUNCATE | APR_CREATE, APR_OS_DEFAULT, p);
if (rv == APR_SUCCESS) {
std::string encoded;
1.15 +39 -39 logging-log4cxx/src/fileappender.cpp
Index: fileappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/fileappender.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- fileappender.cpp 11 Dec 2004 04:53:25 -0000 1.14
+++ fileappender.cpp 15 Dec 2004 08:10:39 -0000 1.15
@@ -36,36 +36,36 @@
}
FileAppender::FileAppender(const LayoutPtr& layout, const File& fileName,
- bool append, bool bufferedIO, int bufferSize)
+ bool append, bool bufferedIO, int bufferSize)
: fileAppend(append), bufferedIO(bufferedIO), bufferSize(bufferSize),
fileName(fileName), ofs(NULL), fileClosed(1)
{
- this->layout = layout;
+ this->layout = layout;
}
FileAppender::FileAppender(const LayoutPtr& layout, const File& fileName,
- bool append)
+ bool append)
: fileAppend(append), bufferedIO(false), bufferSize(8*1024),
fileName(fileName), ofs(NULL), fileClosed(1)
{
- this->layout = layout;
+ this->layout = layout;
}
FileAppender::FileAppender(const LayoutPtr& layout, const File& fileName)
: fileAppend(true), bufferedIO(false), bufferSize(8*1024),
fileName(fileName), ofs(NULL), fileClosed(1)
{
- this->layout = layout;
+ this->layout = layout;
}
FileAppender::~FileAppender()
{
- finalize();
+ finalize();
}
void FileAppender::setFile(const File& file)
{
- fileName = file;
+ fileName = file;
}
void FileAppender::setFile(const File& file, bool append,
@@ -86,41 +86,41 @@
void FileAppender::setBufferedIO(bool bufferedIO)
{
- this->bufferedIO = bufferedIO;
- if(bufferedIO)
- {
- immediateFlush = false;
- }
+ this->bufferedIO = bufferedIO;
+ if(bufferedIO)
+ {
+ immediateFlush = false;
+ }
}
void FileAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"),
LOG4CXX_STR("file"))
- || StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
- {
- fileName = value;
- }
- else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("APPEND"),
LOG4CXX_STR("append")))
- {
- fileAppend = OptionConverter::toBoolean(value, true);
- }
- else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
- {
- bufferedIO = OptionConverter::toBoolean(value, true);
- }
- else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
- {
- bufferedIO = !OptionConverter::toBoolean(value, false);
- }
- else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
- {
- bufferSize = OptionConverter::toFileSize(value, 8*1024);
- }
- else
- {
- WriterAppender::setOption(option, value);
- }
+ if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"),
LOG4CXX_STR("file"))
+ || StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
+ {
+ fileName = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("APPEND"), LOG4CXX_STR("append")))
+ {
+ fileAppend = OptionConverter::toBoolean(value, true);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
+ {
+ bufferedIO = OptionConverter::toBoolean(value, true);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
+ {
+ bufferedIO = !OptionConverter::toBoolean(value, false);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
+ {
+ bufferSize = OptionConverter::toFileSize(value, 8*1024);
+ }
+ else
+ {
+ WriterAppender::setOption(option, value);
+ }
}
void FileAppender::activateOptions(apr_pool_t* p)
@@ -155,7 +155,7 @@
}
}
-void FileAppender::subAppend(const char* encoded, apr_size_t size,
apr_pool_t* p) {
+void FileAppender::subAppend(const char* encoded, log4cxx_size_t size,
apr_pool_t* p) {
if (ofs != NULL) {
apr_status_t rv = apr_file_write(ofs, encoded, &size);
if (rv == APR_SUCCESS && immediateFlush) {
1.17 +2 -4 logging-log4cxx/src/logmanager.cpp
Index: logmanager.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/logmanager.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- logmanager.cpp 13 Dec 2004 05:05:13 -0000 1.16
+++ logmanager.cpp 15 Dec 2004 08:10:39 -0000 1.17
@@ -70,13 +70,11 @@
const LogString LogManager::getConfiguratorClass() {
- static const LogString
LOG4J_CONFIGURATOR_CLASS_KEY(LOG4CXX_STR("log4j.configuratorClass"));
- static const LogString
LOG4CXX_CONFIGURATOR_CLASS_KEY(LOG4CXX_STR("LOG4CXX_CONFIGURATOR_CLASS"));
// Use automatic configration to configure the default hierarchy
const LogString log4jConfiguratorClassName(
-
OptionConverter::getSystemProperty(LOG4J_CONFIGURATOR_CLASS_KEY,LOG4CXX_STR("")));
+
OptionConverter::getSystemProperty(LOG4CXX_STR("log4j.configuratorClass"),LOG4CXX_STR("")));
const LogString configuratorClassName(
- OptionConverter::getSystemProperty(LOG4CXX_CONFIGURATOR_CLASS_KEY,
+
OptionConverter::getSystemProperty(LOG4CXX_STR("LOG4CXX_CONFIGURATOR_CLASS"),
log4jConfiguratorClassName));
return configuratorClassName;
}
1.13 +60 -60 logging-log4cxx/src/rollingfileappender.cpp
Index: rollingfileappender.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/rollingfileappender.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- rollingfileappender.cpp 11 Dec 2004 04:53:25 -0000 1.12
+++ rollingfileappender.cpp 15 Dec 2004 08:10:39 -0000 1.13
@@ -46,7 +46,7 @@
RollingFileAppender::~RollingFileAppender()
{
- finalize();
+ finalize();
}
// synchronization not necessary since doAppend is alreasy synched
@@ -54,80 +54,80 @@
{
// TODO
#if 0
- LogLog::debug(LOG4CXX_STR("rolling over count="));
- LogLog::debug(((LogString) LOG4CXX_STR("maxBackupIndex=")) +
StringHelper::toInt(maxBackupIndex));
+ LogLog::debug(LOG4CXX_STR("rolling over count="));
+ LogLog::debug(((LogString) LOG4CXX_STR("maxBackupIndex=")) +
StringHelper::toInt(maxBackupIndex));
- // close and reset the current file
+ // close and reset the current file
apr_file_close(ofs);
ofs = NULL;
- // If maxBackups <= 0, then there is no file renaming to be done.
- if(maxBackupIndex > 0)
- {
- // Delete the oldest file, to keep Windows happy.
- StringBuffer file;
- file << fileName << _T(".") << maxBackupIndex;
- USES_CONVERSION;
- remove(T2A(file.str().c_str()));
-
- // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex,
..., 3, 2}
- for (int i = maxBackupIndex - 1; i >= 1; i--)
- {
- StringBuffer file;
- StringBuffer target;
-
- file << fileName << _T(".") << i;
- target << fileName << _T(".") << (i + 1);
- LogLog::debug(_T("Renaming file ") + file.str() + _T("
to ") + target.str());
- std::string aFileName = T2A(file.str().c_str());
- std::string aTarget = T2A(target.str().c_str());
- rename(aFileName.c_str(), aTarget.c_str());
- }
-
- // Rename fileName to fileName.1
- StringBuffer target;
- target << fileName << _T(".") << 1;
-
- LogLog::debug(_T("Renaming file ") + fileName + _T(" to ") +
target.str());
- std::string aFileName = T2A(fileName.c_str());
- std::string aTarget = T2A(target.str().c_str());
- rename(aFileName.c_str(), aTarget.c_str());
- }
-
- // Open the current file up again in truncation mode
- USES_CONVERSION;
- ofs.open(T2A(fileName.c_str()), std::ios::out|std::ios::trunc);
- if(!ofs.is_open())
- {
- LogLog::error(_T("Unable to open file: ") + fileName);
- }
+ // If maxBackups <= 0, then there is no file renaming to be done.
+ if(maxBackupIndex > 0)
+ {
+ // Delete the oldest file, to keep Windows happy.
+ StringBuffer file;
+ file << fileName << _T(".") << maxBackupIndex;
+ USES_CONVERSION;
+ remove(T2A(file.str().c_str()));
+
+ // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex,
..., 3, 2}
+ for (int i = maxBackupIndex - 1; i >= 1; i--)
+ {
+ StringBuffer file;
+ StringBuffer target;
+
+ file << fileName << _T(".") << i;
+ target << fileName << _T(".") << (i + 1);
+ LogLog::debug(_T("Renaming file ") + file.str() +
_T(" to ") + target.str());
+ std::string aFileName = T2A(file.str().c_str());
+ std::string aTarget = T2A(target.str().c_str());
+ rename(aFileName.c_str(), aTarget.c_str());
+ }
+
+ // Rename fileName to fileName.1
+ StringBuffer target;
+ target << fileName << _T(".") << 1;
+
+ LogLog::debug(_T("Renaming file ") + fileName + _T(" to ") +
target.str());
+ std::string aFileName = T2A(fileName.c_str());
+ std::string aTarget = T2A(target.str().c_str());
+ rename(aFileName.c_str(), aTarget.c_str());
+ }
+
+ // Open the current file up again in truncation mode
+ USES_CONVERSION;
+ ofs.open(T2A(fileName.c_str()), std::ios::out|std::ios::trunc);
+ if(!ofs.is_open())
+ {
+ LogLog::error(_T("Unable to open file: ") + fileName);
+ }
#endif
}
void RollingFileAppender::setOption(const LogString& option,
- const LogString& value)
+ const LogString& value)
{
- if (StringHelper::equalsIgnoreCase(option,
+ if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MAXFILESIZE"),
LOG4CXX_STR("maxfilesize"))
- || StringHelper::equalsIgnoreCase(option,
+ || StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MAXIMUMFILESIZE"),
LOG4CXX_STR("maximumfilesize")))
- {
- setMaxFileSize(value);
- }
- else if (StringHelper::equalsIgnoreCase(option,
+ {
+ setMaxFileSize(value);
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MAXBACKUPINDEX"),
LOG4CXX_STR("maxbackupindex"))
- || StringHelper::equalsIgnoreCase(option,
+ || StringHelper::equalsIgnoreCase(option,
LOG4CXX_STR("MAXIMUMBACKUPINDEX"),
LOG4CXX_STR("maximumbackupindex")))
- {
- maxBackupIndex = StringHelper::toInt(value);
- }
- else
- {
- FileAppender::setOption(option, value);
- }
+ {
+ maxBackupIndex = StringHelper::toInt(value);
+ }
+ else
+ {
+ FileAppender::setOption(option, value);
+ }
}
-void RollingFileAppender::subAppend(const char* encoded, apr_size_t size,
apr_pool_t* p) {
+void RollingFileAppender::subAppend(const char* encoded, log4cxx_size_t
size, apr_pool_t* p) {
FileAppender::subAppend(encoded, size, p);
}
1.5 +108 -66 logging-log4cxx/src/transcoder.cpp
Index: transcoder.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/transcoder.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- transcoder.cpp 14 Dec 2004 20:26:13 -0000 1.4
+++ transcoder.cpp 15 Dec 2004 08:10:39 -0000 1.5
@@ -29,76 +29,99 @@
*/
#if defined(LOG4CXX_LOGCHAR_IS_WCHAR)
-
-#if !defined(__GCC__)
namespace log4cxx {
- struct mbstate_t {};
- size_t mbsnrtowcs(wchar_t *dest, const char **src,
- size_t srclenin, size_t destlenin, mbstate_t *ps) {
- size_t destlen = destlenin;
- size_t srclen = srclenin;
- size_t mblen;
- while(srclen > 0 && destlen > 0) {
- mblen = mbtowc(dest, *src, srclen);
- if (mblen <= 0) break;
- *src += mblen;
- *dest++;
- destlen--;
- srclen -= mblen;
- }
- if (mblen < 0) {
- return mblen;
- }
- return destlenin - destlen;
- }
+ namespace helpers {
- size_t wcsnrtombs(char *dest, const wchar_t **src, size_t srclenin,
- size_t destlenin, mbstate_t *ps) {
- size_t destlen = destlenin;
- size_t srclen = srclenin;
- size_t mblen;
- char buf[12];
- while(srclen > 0 && destlen > 0) {
- mblen = wctomb(buf, **src);
- //
- // not enough space
- //
- if (mblen > destlen) {
- return (size_t) -1;
+#if !defined(HAVE_MBSTATE_T)
+ struct mbstate_t {};
+#endif
+
+#if !defined(HAVE_MBSNRTOWCS)
+ size_t mbsnrtowcs(wchar_t *dest, const char **src,
+ size_t srcLen, size_t destLen, mbstate_t *ps) {
+ const char* srcEnd = *src + srcLen;
+ wchar_t* current = dest;
+ const wchar_t* destEnd = dest + destLen;
+ while(*src < srcEnd && current < destEnd) {
+ if (**src == 0) {
+ *src = NULL;
+ return current - dest;
+ }
+ size_t mblen = mbtowc(current, *src, srcEnd - *src);
+ if (mblen == (size_t) -1) {
+ return mblen;
+ }
+ *src += mblen;
+ current++;
}
- if (mblen <= 0) break;
- *src++;
- memcpy(dest, buf, mblen);
- *dest += mblen;
- destlen -= mblen;
- srclen--;
- }
- if (mblen < 0) {
- return mblen;
- }
- return destlenin - destlen;
- }
-}
+ return current - dest;
+ }
#endif
+#if !defined(HAVE_WCSNRTOMBS)
+ size_t wcsnrtombs(char *dest, const wchar_t **src, size_t srcLen,
+ size_t destLen, mbstate_t *ps) {
+ const wchar_t* srcEnd = *src + srcLen;
+ char* current = dest;
+ const char* destEnd = dest + destLen;
+ char buf[12];
+ while(*src < srcEnd && current < destEnd) {
+ if (**src == 0) {
+ *src = NULL;
+ return current - dest;
+ }
+ size_t mblen = wctomb(buf, **src);
+ //
+ // not representable
+ if (mblen == (size_t) -1) {
+ return mblen;
+ }
+ //
+ // if not enough space then return length so far
+ //
+ if(mblen > (destEnd - current)) {
+ return current - dest;
+ }
+ //
+ // copy from temp buffer to destination
+ //
+ memcpy(current, buf, mblen);
+ current += mblen;
+ (*src)++;
+ }
+ return current - dest;
+ }
+#endif
+
+ }
+}
+
void Transcoder::decode(const char* src, size_t len, LogString& dst) {
wchar_t buf[BUFSIZE];
mbstate_t ps;
- size_t inRemaining = len;
+ const char* end = src + len;
for(const char* in = src;
- in < src + len && in != NULL;) {
- size_t rv = mbsnrtowcs(buf, &in, len - (in - src), BUFSIZE, &ps);
- if (rv > (size_t) 0) {
- dst.append(buf, rv);
- }
- //
- // invalid sequence, add a substitution character and move on
- //
- if (rv < 0) {
- dst.append(1, SUBSTITUTION_WCHAR);
+ in < end && in != NULL;) {
+ const char* start = in;
+ size_t rv = mbsnrtowcs(buf, &in, end - in, BUFSIZE, &ps);
+ if (rv == (size_t) -1) {
+ //
+ // bad sequence encounted
+ //
+ size_t convertableLength = in - start;
+ in = start;
+ if (convertableLength > 0) {
+ rv = mbsnrtowcs(buf, &in, convertableLength, BUFSIZE, &ps);
+ if (rv != (size_t) -1) {
+ dst.append(buf, rv);
+ }
+ }
+ dst.append(1, LOG4CXX_STR('?'));
in++;
+ } else {
+ dst.append(buf, rv);
}
}
}
@@ -111,16 +134,34 @@
char buf[BUFSIZE];
mbstate_t ps;
const wchar_t* pSrc = src.data();
- size_t srcLen = src.length();
+ const wchar_t* pEnd = pSrc + src.length();
for(const wchar_t* in = pSrc;
- in < pSrc + srcLen && in != NULL;) {
- size_t rv = wcsnrtombs(buf, &in, srcLen - (in - pSrc), BUFSIZE, &ps);
- if (rv > (size_t) 0) {
- dst.append(buf, rv);
- }
- if (rv < 0) {
- dst.append(1, SUBSTITUTION_CHAR);
+ in < pEnd && in != NULL;) {
+ const wchar_t* start = in;
+ size_t rv = wcsnrtombs(buf, &in, pEnd - in, BUFSIZE, &ps);
+ // illegal sequence, convert only the initial fragment
+ if (rv == (size_t) -1) {
+ size_t convertableLength = in - start;
+ in = start;
+ if (convertableLength > 0) {
+ rv = wcsnrtombs(buf, &in, convertableLength, BUFSIZE, &ps);
+ if (rv != (size_t) -1) {
+ dst.append(buf, rv);
+ }
+ }
+ //
+ // represent character with an escape sequence
+ //
+ dst.append("\\u");
+ const char* hexdigits = "0123456789ABCDEF";
+ wchar_t unencodable = *in;
+ dst.append(1, hexdigits[(unencodable >> 12) & 0x0F]);
+ dst.append(1, hexdigits[(unencodable >> 8) & 0x0F]);
+ dst.append(1, hexdigits[(unencodable >> 4) & 0x0F]);
+ dst.append(1, hexdigits[unencodable & 0x0F]);
in++;
+ } else {
+ dst.append(buf, rv);
}
}
}
@@ -130,6 +171,7 @@
}
#endif
+
1.9 +41 -40 logging-log4cxx/tests/src/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.am 13 Nov 2004 02:42:37 -0000 1.8
+++ Makefile.am 15 Dec 2004 08:10:39 -0000 1.9
@@ -9,15 +9,16 @@
noinst_PROGRAMS = testsuite shortsocketserver
testsuite_SOURCES = \
- asyncappendertestcase.cpp\
- drfatestcase.cpp\
- hierarchythresholdtestcase.cpp\
- l7dtestcase.cpp\
- loggertestcase.cpp\
- main.cpp\
- minimumtestcase.cpp\
- patternlayouttest.cpp\
- vectorappender.cpp\
+ asyncappendertestcase.cpp\
+ drfatestcase.cpp\
+ filetestcase.cpp \
+ hierarchythresholdtestcase.cpp\
+ l7dtestcase.cpp\
+ loggertestcase.cpp\
+ main.cpp\
+ minimumtestcase.cpp\
+ patternlayouttest.cpp\
+ vectorappender.cpp\
appenderskeletontestcase.cpp\
consoleappendertestcase.cpp\
dailyrollingfileappendertestcase.cpp\
@@ -27,51 +28,51 @@
testsuite_LDADD = \
- $(top_builddir)/src/liblog4cxx.la
+ $(top_builddir)/src/liblog4cxx.la
testsuite_LDFLAGS = \
- -Wl,--whole-archive,customlogger/libcustomlogger.a,--no-whole-archive\
- -Wl,--whole-archive,defaultinit/libdefaultinit.a,--no-whole-archive\
- -Wl,--whole-archive,helpers/libhelpers.a,--no-whole-archive\
- -Wl,--whole-archive,net/libnet.a,--no-whole-archive\
- -Wl,--whole-archive,pattern/libpattern.a,--no-whole-archive\
- -Wl,--whole-archive,util/libutil.a,--no-whole-archive\
- -Wl,--whole-archive,varia/libvaria.a,--no-whole-archive\
- -Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
- -Wl,--whole-archive,xml/libdb.a,--no-whole-archive\
- -Wl,--whole-archive,xml/libnt.a,--no-whole-archive\
- @LIBS_CPPUNIT@ -lboost_regex
+
-Wl,--whole-archive,customlogger/libcustomlogger.a,--no-whole-archive\
+ -Wl,--whole-archive,defaultinit/libdefaultinit.a,--no-whole-archive\
+ -Wl,--whole-archive,helpers/libhelpers.a,--no-whole-archive\
+ -Wl,--whole-archive,net/libnet.a,--no-whole-archive\
+ -Wl,--whole-archive,pattern/libpattern.a,--no-whole-archive\
+ -Wl,--whole-archive,util/libutil.a,--no-whole-archive\
+ -Wl,--whole-archive,varia/libvaria.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libdb.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libnt.a,--no-whole-archive\
+ @LIBS_CPPUNIT@ -lboost_regex
AM_CPPFLAGS = @CPPFLAGS_CPPUNIT@
testsuite_DEPENDENCIES = \
- customlogger/libcustomlogger.a\
- defaultinit/libdefaultinit.a\
- helpers/libhelpers.a\
- net/libnet.a\
- pattern/libpattern.a\
- util/libutil.a\
- varia/libvaria.a\
- xml/libxml.a\
- db/libdb.a\
- nt/libnt.a\
- $(top_builddir)/src/liblog4cxx.la
+ customlogger/libcustomlogger.a\
+ defaultinit/libdefaultinit.a\
+ helpers/libhelpers.a\
+ net/libnet.a\
+ pattern/libpattern.a\
+ util/libutil.a\
+ varia/libvaria.a\
+ xml/libxml.a\
+ db/libdb.a\
+ nt/libnt.a\
+ $(top_builddir)/src/liblog4cxx.la
shortsocketserver_SOURCES = \
- shortsocketserver.cpp
+ shortsocketserver.cpp
shortsocketserver_LDADD = \
- $(top_builddir)/src/liblog4cxx.la
+ $(top_builddir)/src/liblog4cxx.la
shortsocketserver_LDFLAGS = \
- -Wl,--whole-archive,util/libutil.a,--no-whole-archive\
- -Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
- @LIBS_CPPUNIT@ -lboost_regex
+ -Wl,--whole-archive,util/libutil.a,--no-whole-archive\
+ -Wl,--whole-archive,xml/libxml.a,--no-whole-archive\
+ @LIBS_CPPUNIT@ -lboost_regex
shortsocketserver_DEPENDENCIES = \
- util/libutil.a\
- xml/libxml.a\
- $(top_builddir)/src/liblog4cxx.la
+ util/libutil.a\
+ xml/libxml.a\
+ $(top_builddir)/src/liblog4cxx.la
check: testsuite shortsocketserver
endif
1.3 +13 -3 logging-log4cxx/tests/src/filetestcase.cpp
Index: filetestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/filetestcase.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- filetestcase.cpp 14 Dec 2004 20:26:14 -0000 1.2
+++ filetestcase.cpp 15 Dec 2004 08:10:39 -0000 1.3
@@ -31,6 +31,7 @@
CPPUNIT_TEST(defaultExists);
CPPUNIT_TEST(defaultRead);
CPPUNIT_TEST(propertyRead);
+ CPPUNIT_TEST(propertyExists);
CPPUNIT_TEST(fileWrite1);
CPPUNIT_TEST_SUITE_END();
@@ -43,14 +44,16 @@
void defaultExists() {
File defFile;
- CPPUNIT_ASSERT_EQUAL(false, defFile.exists());
+ bool exists = defFile.exists();
+ CPPUNIT_ASSERT_EQUAL(false, exists);
}
void defaultRead() {
File defFile;
Pool pool;
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""),
defFile.read(pool));
+ LogString contents(defFile.read(pool));
+ CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""), contents);
}
@@ -58,7 +61,8 @@
File defFile;
Pool pool;
LogString greeting(LOG4CXX_STR("Hello, World"));
- CPPUNIT_ASSERT(defFile.write(greeting, pool) != APR_SUCCESS);
+ apr_status_t stat = defFile.write(greeting, pool);
+ CPPUNIT_ASSERT(stat != APR_SUCCESS);
}
void propertyRead() {
@@ -67,6 +71,12 @@
LogString props(propFile.read(pool));
LogString line1(LOG4CXX_STR("log4j.rootCategory=DEBUG,
testAppender\n"));
CPPUNIT_ASSERT_EQUAL(line1, props.substr(0, line1.length()));
+ }
+
+ void propertyExists() {
+ File propFile("input//patternLayout1.properties");
+ bool exists = propFile.exists();
+ CPPUNIT_ASSERT_EQUAL(true, exists);
}
1.8 +29 -29 logging-log4cxx/tests/src/main.cpp
Index: main.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/main.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- main.cpp 11 Dec 2004 04:53:27 -0000 1.7
+++ main.cpp 15 Dec 2004 08:10:39 -0000 1.8
@@ -31,39 +31,39 @@
int main( int argc, const char * const argv[])
{
- apr_app_initialize(&argc, &argv, NULL);
- CppUnit::TextUi::TestRunner runner;
+ apr_app_initialize(&argc, &argv, NULL);
+ CppUnit::TextUi::TestRunner runner;
- CppUnit::TestFactoryRegistry ®istry =
- CppUnit::TestFactoryRegistry::getRegistry();
+ CppUnit::TestFactoryRegistry ®istry =
+ CppUnit::TestFactoryRegistry::getRegistry();
- runner.addTest(registry.makeTest());
+ runner.addTest(registry.makeTest());
- bool wasSuccessful = true;
- if (argc > 1)
- {
- for (int n = 1; n < argc; n++)
- {
- try
- {
- wasSuccessful = runner.run(argv[n], false) &&
wasSuccessful;
- }
- catch(std::exception& e)
- {
- std::cout << e.what() << std::endl;
- }
- catch (...) {
- std::cout << "Unexpected exception";
- }
- }
- }
- else
- {
- bool wasSuccessful = runner.run("", false);
- }
+ bool wasSuccessful = true;
+ if (argc > 1)
+ {
+ for (int n = 1; n < argc; n++)
+ {
+ try
+ {
+ wasSuccessful = runner.run(argv[n], false)
&& wasSuccessful;
+ }
+ catch(std::exception& e)
+ {
+ std::cout << e.what() << std::endl;
+ }
+ catch (...) {
+ std::cout << "Unexpected exception";
+ }
+ }
+ }
+ else
+ {
+ bool wasSuccessful = runner.run("", false);
+ }
- apr_terminate();
- return wasSuccessful ? EXIT_SUCCESS : EXIT_FAILURE;
+ apr_terminate();
+ return wasSuccessful ? EXIT_SUCCESS : EXIT_FAILURE;
}
std::ostream& operator<<(std::ostream& os,
1.7 +4 -3 logging-log4cxx/tests/src/helpers/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/helpers/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.am 12 Dec 2004 05:53:58 -0000 1.6
+++ Makefile.am 15 Dec 2004 08:10:40 -0000 1.7
@@ -9,13 +9,14 @@
libhelpers_a_SOURCES = \
absolutetimedateformattestcase.cpp \
cacheddateformattestcase.cpp \
- cyclicbuffertestcase.cpp\
+ cyclicbuffertestcase.cpp\
datetimedateformattestcase.cpp \
iso8601dateformattestcase.cpp \
- optionconvertertestcase.cpp \
+ optionconvertertestcase.cpp \
relativetimedateformattestcase.cpp \
stringtokenizertestcase.cpp \
- timezonetestcase.cpp
+ timezonetestcase.cpp \
+ transcodertestcase.cpp
check: libhelpers.a
1.4 +2 -3 logging-log4cxx/tests/src/util/xmltimestampfilter.cpp
Index: xmltimestampfilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmltimestampfilter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xmltimestampfilter.cpp 11 Dec 2004 04:53:29 -0000 1.3
+++ xmltimestampfilter.cpp 15 Dec 2004 08:10:40 -0000 1.4
@@ -20,9 +20,8 @@
using namespace log4cxx::helpers;
LogString XMLTimestampFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(LOG4CXX_STR("timestamp=\"\\d{10,13}\""), in,
LOG4CXX_STR("timestamp=\"XXX\""));
+ const throw(UnexpectedFormatException) {
+ return merge(LOG4CXX_STR("timestamp=\"\\d{10,13}\""), in,
LOG4CXX_STR("timestamp=\"XXX\""));
}