carnold 2005/01/28 09:03:38
Modified: . build.xml
include/log4cxx file.h
src loggingevent.cpp mutex.cpp ndc.cpp
socketinputstream.cpp
tests/src asyncappendertestcase.cpp minimumtestcase.cpp
patternlayouttest.cpp
tests/src/net socketservertestcase.cpp
tests/src/util absolutedateandtimefilter.cpp
absolutedateandtimefilter.h absolutetimefilter.cpp
absolutetimefilter.h controlfilter.cpp
controlfilter.h filenamefilter.cpp filenamefilter.h
filter.cpp filter.h iso8601filter.cpp
iso8601filter.h linenumberfilter.cpp
linenumberfilter.h relativetimefilter.cpp
relativetimefilter.h threadfilter.cpp
threadfilter.h transformer.cpp transformer.h
xmlfilenamefilter.cpp xmlfilenamefilter.h
xmllineattributefilter.cpp xmllineattributefilter.h
xmlthreadfilter.cpp xmlthreadfilter.h
xmltimestampfilter.cpp xmltimestampfilter.h
tests/src/varia errorhandlertestcase.cpp
tests/src/xml domtestcase.cpp xmllayouttestcase.cpp
Log:
LOGCXX-54: Eliminate use of boost-regex with sed
Revision Changes Path
1.24 +0 -20 logging-log4cxx/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4cxx/build.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- build.xml 22 Jan 2005 23:38:42 -0000 1.23
+++ build.xml 28 Jan 2005 17:03:37 -0000 1.24
@@ -31,7 +31,6 @@
<property name="build.dir" location="build"/>
<property name="examples.dir" location="examples"/>
<property name="tests.dir" location="tests"/>
-<property name="boost.version" value="1_32"/>
<property name="version" value="0.9.8"/>
<taskdef resource="cpptasks.tasks"/>
<typedef resource="cpptasks.types"/>
@@ -76,10 +75,6 @@
<istrue value="${debug}"/>
</condition>
<property name="cppunit.lib.name" value="cppunit"/>
- <property name="boost.include.dir"
location="\boost\include\boost-${boost.version}"/>
- <property name="boost-lib.suffix" value="-vc6-mt-gd-${boost.version}"/>
- <property name="boost-lib.prefix" value="lib"/>
- <property name="boost.lib.dir" value="/boost/lib"/>
</target>
<target name="unix-init" depends="os-detect" if="is-unix">
@@ -109,13 +104,9 @@
<property name="cppunit.lib.dir" location="/usr/local/lib"/>
<property name="cppunit.bin.dir" location="/usr/local/lib"/>
<property name="cppunit.lib.name" value="cppunit"/>
- <property name="boost-lib.prefix" value=""/>
- <property name="boost-lib.suffix" value="-gcc"/>
-
</target>
<target name="init" depends="win-init, unix-init">
- <property name="boost_regex.lib.name"
value="${boost-lib.prefix}boost_regex${boost-lib.suffix}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="cbx"/>
<mkdir dir="xcode"/>
@@ -369,7 +360,6 @@
<libset libs="${apriconv.lib.name}"
unless="apriconv.lib.dir"/>
<libset libs="stdc++" if="is-gcc"/>
- <!-- libset libs="boost_regex-gcc" if="is-gcc"/ -->
<libset libs="${cppunit.lib.name}" dir="${cppunit.lib.dir}"/>
<project outfile="cbx/shortsocketserver" type="cbuilderx"
if="gen-cbx"/>
<project outfile="msvc/shortsocketserver" type="msvc6" if="gen-dsw"/>
@@ -400,7 +390,6 @@
<includepath path="${apr.include.dir}"/>
<defineset define="APR_DECLARE_STATIC"/>
<defineset define="WIN32" if="is-windows"/>
- <includepath path="${boost.include.dir}" if="boost.include.dir"/>
<libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
<libset libs="${apr.lib.name}" dir="${apr.lib.dir}"
if="apr.lib.dir"/>
<libset libs="${apr.lib.name}" unless="apr.lib.dir"/>
@@ -410,8 +399,6 @@
dir="${apriconv.lib.dir}" if="apriconv.lib.dir"/>
<libset libs="${apriconv.lib.name}" unless="apriconv.lib.dir"/>
<libset libs="stdc++" if="is-gcc"/>
- <libset libs="${boost_regex.lib.name}" if="is-gcc"
unless="boost.lib.dir"/>
- <libset libs="${boost_regex.lib.name}" dir="${boost.lib.dir}"
if="boost.lib.dir"/>
<libset libs="${cppunit.lib.name}" dir="${cppunit.lib.dir}"/>
<syslibset libs="Ws2_32 ws2 advapi32" if="is-windows"/>
<project outfile="cbx/log4cxx-test" type="cbuilderx" if="gen-cbx"/>
@@ -448,8 +435,6 @@
dir="${apriconv.lib.dir}" if="apriconv.lib.dir"/>
<libset libs="${apriconv.lib.name}" unless="apriconv.lib.dir"/>
<libset libs="stdc++" if="is-gcc"/>
- <libset libs="${boost_regex.lib.name}" if="is-gcc"
unless="boost.lib.dir"/>
- <libset libs="${boost_regex.lib.name}" dir="${boost.lib.dir}"
if="boost.lib.dir"/>
<libset libs="${cppunit.lib.name}" dir="${cppunit.lib.dir}"/>
<syslibset libs="Ws2_32 ws2 advapi32" if="is-windows"/>
<project outfile="cbx/log4cxx-testcase3" type="cbuilderx"
if="gen-cbx"/>
@@ -486,8 +471,6 @@
dir="${apriconv.lib.dir}" if="apriconv.lib.dir"/>
<libset libs="${apriconv.lib.name}" unless="apriconv.lib.dir"/>
<libset libs="stdc++" if="is-gcc"/>
- <libset libs="${boost_regex.lib.name}" if="is-gcc"
unless="boost.lib.dir"/>
- <libset libs="${boost_regex.lib.name}" dir="${boost.lib.dir}"
if="boost.lib.dir"/>
<libset libs="${cppunit.lib.name}" dir="${cppunit.lib.dir}"/>
<syslibset libs="Ws2_32 ws2 advapi32" if="is-windows"/>
<project outfile="cbx/log4cxx-testcase4" type="cbuilderx"
if="gen-cbx"/>
@@ -519,7 +502,6 @@
<includepath path="${cppunit.include.dir}"/>
<includepath path="${include.dir}"/>
<includepath path="${apr.include.dir}"/>
- <includepath path="${boost.include.dir}" if="boost.include.dir"/>
<defineset define="APR_DECLARE_STATIC"/>
<defineset define="WIN32" if="is-windows"/>
<libset libs="${apr.lib.name}" dir="${apr.lib.dir}"
if="apr.lib.dir"/>
@@ -531,8 +513,6 @@
<libset libs="${apriconv.lib.name}" unless="apriconv.lib.dir"/>
<libset libs="stdc++" if="is-gcc"/>
<libset libs="${cppunit.lib.name}" dir="${cppunit.lib.dir}"/>
- <libset libs="${boost_regex.lib.name}" if="is-gcc"
unless="boost.lib.dir"/>
- <libset libs="${boost_regex.lib.name}" dir="${boost.lib.dir}"
if="boost.lib.dir"/>
<includepath path="${include.dir}"/>
<includepath path="/usr/include/libxml2" if="is-unix"/>
1.8 +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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- file.h 26 Dec 2004 07:31:52 -0000 1.7
+++ file.h 28 Jan 2005 17:03:37 -0000 1.8
@@ -51,6 +51,9 @@
inline const LogString& getName() const {
return name;
}
+ inline const std::string& getOSName() const {
+ return osName;
+ }
LogString read(log4cxx::helpers::Pool& pool) const;
1.25 +2 -2 logging-log4cxx/src/loggingevent.cpp
Index: loggingevent.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/loggingevent.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- loggingevent.cpp 5 Jan 2005 22:42:58 -0000 1.24
+++ loggingevent.cpp 28 Jan 2005 17:03:37 -0000 1.25
@@ -47,8 +47,8 @@
}
LoggingEvent::LoggingEvent() :
- properties(0),
ndc(LOG4CXX_STR("null")),
+ properties(0),
ndcLookupRequired(true),
mdcCopyLookupRequired(true),
timeStamp(0),
@@ -60,8 +60,8 @@
const LogString& message, const LocationInfo& locationInfo) :
logger(logger),
level(level),
- properties(0),
ndc(LOG4CXX_STR("null")),
+ properties(0),
ndcLookupRequired(true),
mdcCopyLookupRequired(true),
message(message),
1.12 +1 -1 logging-log4cxx/src/mutex.cpp
Index: mutex.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/mutex.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- mutex.cpp 26 Dec 2004 07:31:53 -0000 1.11
+++ mutex.cpp 28 Jan 2005 17:03:37 -0000 1.12
@@ -46,7 +46,7 @@
Mutex::~Mutex() {
- apr_status_t stat = apr_thread_mutex_destroy((apr_thread_mutex_t*)
mutex);
+ apr_thread_mutex_destroy((apr_thread_mutex_t*) mutex);
}
1.14 +2 -2 logging-log4cxx/src/ndc.cpp
Index: ndc.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/ndc.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ndc.cpp 6 Jan 2005 07:26:56 -0000 1.13
+++ ndc.cpp 28 Jan 2005 17:03:37 -0000 1.14
@@ -23,7 +23,7 @@
NDC::DiagnosticContext::DiagnosticContext(const LogString& message,
const DiagnosticContext * parent)
- : message(message), fullMessage(message)
+ : fullMessage(message), message(message)
{
if (parent != 0)
{
@@ -36,7 +36,7 @@
}
NDC::DiagnosticContext::DiagnosticContext(const DiagnosticContext& src)
- : message(src.message), fullMessage(src.fullMessage) {
+ : fullMessage(src.fullMessage), message(src.message) {
}
NDC::DiagnosticContext& NDC::DiagnosticContext::operator=(
1.14 +8 -8 logging-log4cxx/src/socketinputstream.cpp
Index: socketinputstream.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/socketinputstream.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- socketinputstream.cpp 18 Dec 2004 07:53:05 -0000 1.13
+++ socketinputstream.cpp 28 Jan 2005 17:03:37 -0000 1.14
@@ -17,7 +17,7 @@
#include <log4cxx/helpers/socketinputstream.h>
#include <log4cxx/helpers/socket.h>
#include <log4cxx/helpers/loglog.h>
-//#include <malloc.h>
+//#include <malloc.h>
#include <assert.h>
using namespace log4cxx;
@@ -162,17 +162,17 @@
throw SocketMessageTooLargeException();
}
- logchar * buffer;
#if 0
+ logchar * buffer;
// buffer = (logchar *)alloca((size + 1)* sizeof(logchar));
buffer[size] = LOG4CXX_STR('\0');
read(buffer, size * sizeof(logchar));
- value = buffer;
-#else
- //
- // TODO: not impl
- //
- assert(false);
+ value = buffer;
+#else
+ //
+ // TODO: not impl
+ //
+ assert(false);
#endif
}
1.16 +1 -1 logging-log4cxx/tests/src/asyncappendertestcase.cpp
Index: asyncappendertestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/asyncappendertestcase.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- asyncappendertestcase.cpp 3 Jan 2005 06:43:44 -0000 1.15
+++ asyncappendertestcase.cpp 28 Jan 2005 17:03:37 -0000 1.16
@@ -124,7 +124,7 @@
Pool pool;
std::string msg("message");
- for (int i = 0; i < LEN; i++) {
+ for (size_t i = 0; i < LEN; i++) {
msg.erase(msg.begin() + 7, msg.end());
StringHelper::toString(i, pool, msg);
LOG4CXX_DEBUG(root, msg);
1.14 +4 -4 logging-log4cxx/tests/src/minimumtestcase.cpp
Index: minimumtestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/minimumtestcase.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- minimumtestcase.cpp 3 Jan 2005 06:43:44 -0000 1.13
+++ minimumtestcase.cpp 28 Jan 2005 17:03:37 -0000 1.14
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -44,12 +44,12 @@
#define TTCC_PAT \
ABSOLUTE_DATE_AND_TIME_PAT \
- LOG4CXX_STR(" \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* -
Message \\d{1,2}")
+ " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message
\\d{1,2}"
#define TTCC2_PAT \
ABSOLUTE_DATE_AND_TIME_PAT \
- LOG4CXX_STR(" \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* -
") \
- LOG4CXX_STR("Messages should bear numbers 0 through 23\\.")
+ " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - " \
+ "Messages should bear numbers 0 through 23\\."
class MinimumTestCase : public CppUnit::TestFixture
1.13 +16 -18 logging-log4cxx/tests/src/patternlayouttest.cpp
Index: patternlayouttest.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/patternlayouttest.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- patternlayouttest.cpp 3 Jan 2005 06:43:44 -0000 1.12
+++ patternlayouttest.cpp 28 Jan 2005 17:03:37 -0000 1.13
@@ -43,20 +43,20 @@
#include <log4cxx/helpers/stringhelper.h>
-
-#define PAT0 LOG4CXX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .*
- Message \\d{1,2}")
-#define PAT1 ISO8601_PAT LOG4CXX_STR(" ") PAT0
-#define PAT2 ABSOLUTE_DATE_AND_TIME_PAT LOG4CXX_STR(" ") PAT0
-#define PAT3 ABSOLUTE_TIME_PAT LOG4CXX_STR(" ") PAT0
-#define PAT4 RELATIVE_TIME_PAT LOG4CXX_STR(" ") PAT0
-#define PAT5 LOG4CXX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .*
: Message \\d{1,2}")
-#define PAT6 LOG4CXX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
.*patternlayouttest.cpp\\(\\d{1,4}\\): Message \\d{1,3}")
-#define PAT11a LOG4CXX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL)
\\[0x[0-9A-F]*]\\ log4j.PatternLayoutTest: Message \\d{1,2}")
-#define PAT11b LOG4CXX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL)
\\[0x[0-9A-F]*]\\ root: Message \\d{1,2}")
-#define PAT12 LOG4CXX_STR("^\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN
|ERROR|FATAL) ")\
- LOG4CXX_STR(".*patternlayouttest.cpp\\(\\d{1,4}\\): ")\
- LOG4CXX_STR("Message \\d{1,2}")
-#define PAT_MDC_1 LOG4CXX_STR("")
+#define REGEX_STR(x) x
+#define PAT0 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* -
Message \\d{1,2}")
+#define PAT1 ISO8601_PAT REGEX_STR(" ") PAT0
+#define PAT2 ABSOLUTE_DATE_AND_TIME_PAT REGEX_STR(" ") PAT0
+#define PAT3 ABSOLUTE_TIME_PAT REGEX_STR(" ") PAT0
+#define PAT4 RELATIVE_TIME_PAT REGEX_STR(" ") PAT0
+#define PAT5 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* :
Message \\d{1,2}")
+#define PAT6 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
.*patternlayouttest.cpp\\(\\d{1,4}\\): Message \\d{1,3}")
+#define PAT11a REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
log4j.PatternLayoutTest: Message \\d{1,2}")
+#define PAT11b REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
root: Message \\d{1,2}")
+#define PAT12 REGEX_STR("^\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
")\
+ REGEX_STR(".*patternlayouttest.cpp\\(\\d{1,4}\\): ")\
+ REGEX_STR("Message \\d{1,2}")
+#define PAT_MDC_1 REGEX_STR("")
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -335,8 +335,7 @@
filter1 << PAT6;
ThreadFilter filter2;
LineNumberFilter filter3;
- LOG4CXX_DECODE_CHAR(thisFile, __FILE__);
- FilenameFilter filenameFilter(thisFile,
LOG4CXX_STR("patternlayouttest.cpp"));
+ FilenameFilter filenameFilter(__FILE__,
"patternlayouttest.cpp");
std::vector<Filter *> filters;
@@ -394,8 +393,7 @@
filter1 << PAT12;
ThreadFilter filter2;
LineNumberFilter filter3;
- LOG4CXX_DECODE_CHAR(thisFile, __FILE__);
- FilenameFilter filenameFilter(thisFile,
LOG4CXX_STR("patternlayouttest.cpp"));
+ FilenameFilter filenameFilter(__FILE__,
"patternlayouttest.cpp");
std::vector<Filter *> filters;
filters.push_back(&filter1);
1.16 +23 -25 logging-log4cxx/tests/src/net/socketservertestcase.cpp
Index: socketservertestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/net/socketservertestcase.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- socketservertestcase.cpp 3 Jan 2005 06:43:44 -0000 1.15
+++ socketservertestcase.cpp 28 Jan 2005 17:03:37 -0000 1.16
@@ -55,42 +55,42 @@
using namespace log4cxx::helpers;
using namespace log4cxx::net;
-
+#define REGEX_STR(x) x
// %5p %x [%t] %c %m%n
// DEBUG T1 [thread] org.apache.log4j.net.SocketAppenderTestCase Message 1
#define PAT1 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T1
\\[0x[0-9A-F]*]\\ ") \
- LOG4CXX_STR(".* Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T1
\\[0x[0-9A-F]*]\\ ") \
+ REGEX_STR(".* Message \\d{1,2}")
// DEBUG T2 [thread] patternlayouttest.cpp(?) Message 1
#define PAT2 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T2
\\[0x[0-9A-F]*]\\ ") \
- LOG4CXX_STR(".*socketservertestcase.cpp\\(\\d{1,4}\\) Message
\\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T2
\\[0x[0-9A-F]*]\\ ") \
+ REGEX_STR(".*socketservertestcase.cpp\\(\\d{1,4}\\) Message
\\d{1,2}")
// DEBUG T3 [thread] patternlayouttest.cpp(?) Message 1
#define PAT3 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T3
\\[0x[0-9A-F]*]\\ ") \
- LOG4CXX_STR(".*socketservertestcase.cpp\\(\\d{1,4}\\) Message
\\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T3
\\[0x[0-9A-F]*]\\ ") \
+ REGEX_STR(".*socketservertestcase.cpp\\(\\d{1,4}\\) Message
\\d{1,2}")
// DEBUG some T4 MDC-TEST4 [thread] SocketAppenderTestCase - Message 1
// DEBUG some T4 MDC-TEST4 [thread] SocketAppenderTestCase - Message 1
#define PAT4 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some T4
MDC-TEST4 \\[0x[0-9A-F]*]\\") \
- LOG4CXX_STR(" (root|SocketServerTestCase) - Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some T4 MDC-TEST4
\\[0x[0-9A-F]*]\\") \
+ REGEX_STR(" (root|SocketServerTestCase) - Message \\d{1,2}")
#define PAT5 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some5 T5
MDC-TEST5 \\[0x[0-9A-F]*]\\") \
- LOG4CXX_STR(" (root|SocketServerTestCase) - Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some5 T5
MDC-TEST5 \\[0x[0-9A-F]*]\\") \
+ REGEX_STR(" (root|SocketServerTestCase) - Message \\d{1,2}")
#define PAT6 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some6 T6
client-test6 MDC-TEST6") \
- LOG4CXX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) -
Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some6 T6
client-test6 MDC-TEST6") \
+ REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
\\d{1,2}")
#define PAT7 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some7 T7
client-test7 MDC-TEST7") \
- LOG4CXX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) -
Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some7 T7
client-test7 MDC-TEST7") \
+ REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
\\d{1,2}")
// DEBUG some8 T8 shortSocketServer MDC-TEST7 [thread] SocketServerTestCase
- Message 1
#define PAT8 \
- LOG4CXX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some8 T8
shortSocketServer") \
- LOG4CXX_STR(" MDC-TEST8 \\[0x[0-9A-F]*]\\
(root|SocketServerTestCase) - Message \\d{1,2}")
+ REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some8 T8
shortSocketServer") \
+ REGEX_STR(" MDC-TEST8 \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase)
- Message \\d{1,2}")
class ShortSocketServerLauncher
{
@@ -105,9 +105,9 @@
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
- LogString
commandLine(LOG4CXX_STR("src\\shortsocketserver 8 input/socketServer"));
+ std::string commandLine("src\\shortsocketserver 8
input/socketServer");
- BOOL bResult = ::CreateProcess(NULL,
(LPTSTR)commandLine.c_str(), NULL, NULL,
+ BOOL bResult = ::CreateProcessA(NULL,
commandLine.c_str(), NULL, NULL,
TRUE, 0, NULL, NULL, &si, &pi);
#else
if(!::fork())
@@ -216,8 +216,7 @@
ThreadFilter threadFilter;
LineNumberFilter lineNumberFilter;
LogString thisFile;
- log4cxx::helpers::Transcoder::decode(__FILE__, thisFile);
- FilenameFilter filenameFilter(thisFile,
LOG4CXX_STR("socketservertestcase.cpp"));
+ FilenameFilter filenameFilter(__FILE__,
"socketservertestcase.cpp");
std::vector<Filter *> filters;
filters.push_back(&cf);
@@ -252,8 +251,7 @@
ThreadFilter threadFilter;
LineNumberFilter lineNumberFilter;
LogString thisFile;
- log4cxx::helpers::Transcoder::decode(__FILE__, thisFile);
- FilenameFilter filenameFilter(thisFile,
LOG4CXX_STR("socketservertestcase.cpp"));
+ FilenameFilter filenameFilter(__FILE__,
"socketservertestcase.cpp");
std::vector<Filter *> filters;
filters.push_back(&cf);
@@ -352,7 +350,7 @@
root->addAppender(asyncAppender);
NDC::push(LOG4CXX_TEST_STR("some6"));
- MDC::put(LOG4CXX_TEST_STR("hostID"),
LOG4CXX_TEST_STR("client-test6"));
+ MDC::put(LOG4CXX_TEST_STR("hostID"),
LOG4CXX_TEST_STR("client-test6"));
common(LOG4CXX_STR("T6"), LOG4CXX_STR("key6"),
LOG4CXX_STR("MDC-TEST6"));
NDC::pop();
MDC::remove(LOG4CXX_TEST_STR("hostID"));
@@ -390,7 +388,7 @@
root->addAppender(asyncAppender);
NDC::push(LOG4CXX_TEST_STR("some7"));
- MDC::put(LOG4CXX_TEST_STR("hostID"),
LOG4CXX_TEST_STR("client-test7"));
+ MDC::put(LOG4CXX_TEST_STR("hostID"),
LOG4CXX_TEST_STR("client-test7"));
common(LOG4CXX_STR("T7"), LOG4CXX_STR("key7"),
LOG4CXX_STR("MDC-TEST7"));
NDC::pop();
MDC::remove(LOG4CXX_TEST_STR("hostID"));
1.5 +2 -5
logging-log4cxx/tests/src/util/absolutedateandtimefilter.cpp
Index: absolutedateandtimefilter.cpp
===================================================================
RCS file:
/home/cvs/logging-log4cxx/tests/src/util/absolutedateandtimefilter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- absolutedateandtimefilter.cpp 11 Dec 2004 04:53:29 -0000 1.4
+++ absolutedateandtimefilter.cpp 28 Jan 2005 17:03:37 -0000 1.5
@@ -19,8 +19,5 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString AbsoluteDateAndTimeFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(ABSOLUTE_DATE_AND_TIME_PAT, in, LOG4CXX_STR(""));
-}
+AbsoluteDateAndTimeFilter::AbsoluteDateAndTimeFilter() :
+ Filter(ABSOLUTE_DATE_AND_TIME_PAT, "") {}
1.5 +1 -1
logging-log4cxx/tests/src/util/absolutedateandtimefilter.h
Index: absolutedateandtimefilter.h
===================================================================
RCS file:
/home/cvs/logging-log4cxx/tests/src/util/absolutedateandtimefilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- absolutedateandtimefilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ absolutedateandtimefilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -24,7 +24,7 @@
class AbsoluteDateAndTimeFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ AbsoluteDateAndTimeFilter();
};
}
1.5 +3 -6 logging-log4cxx/tests/src/util/absolutetimefilter.cpp
Index: absolutetimefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/absolutetimefilter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- absolutetimefilter.cpp 11 Dec 2004 04:53:29 -0000 1.4
+++ absolutetimefilter.cpp 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,8 +19,5 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString AbsoluteTimeFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(ABSOLUTE_TIME_PAT, in, LOG4CXX_STR(""));
-}
+AbsoluteTimeFilter::AbsoluteTimeFilter()
+ : Filter(ABSOLUTE_TIME_PAT, "") {}
1.5 +2 -2 logging-log4cxx/tests/src/util/absolutetimefilter.h
Index: absolutetimefilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/absolutetimefilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- absolutetimefilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ absolutetimefilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class AbsoluteTimeFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ AbsoluteTimeFilter();
};
}
1.6 +2 -19 logging-log4cxx/tests/src/util/controlfilter.cpp
Index: controlfilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/controlfilter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- controlfilter.cpp 11 Dec 2004 04:53:29 -0000 1.5
+++ controlfilter.cpp 28 Jan 2005 17:03:37 -0000 1.6
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -23,24 +23,7 @@
{
}
-LogString ControlFilter::filter(const LogString& in) const
throw(UnexpectedFormatException)
+ControlFilter& ControlFilter::operator<<(const std::string& allowedPattern)
{
- int len = allowedPatterns.size();
-
- for (int i = 0; i < len; i++)
- {
- if (match(allowedPatterns[i], in))
- {
- return in;
- }
- }
-
- throw UnexpectedFormatException(in);
-}
-
-ControlFilter& ControlFilter::operator<<(const LogString& allowedPattern)
-{
- allowedPatterns.push_back(allowedPattern);
return *this;
}
-
1.6 +2 -5 logging-log4cxx/tests/src/util/controlfilter.h
Index: controlfilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/controlfilter.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- controlfilter.h 11 Dec 2004 04:53:29 -0000 1.5
+++ controlfilter.h 28 Jan 2005 17:03:37 -0000 1.6
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -26,11 +26,8 @@
{
public:
ControlFilter();
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
- ControlFilter& operator<<(const LogString& allowedPattern);
+ ControlFilter& operator<<(const std::string& allowedPattern);
- protected:
- std::vector<LogString> allowedPatterns;
};
}
1.4 +12 -17 logging-log4cxx/tests/src/util/filenamefilter.cpp
Index: filenamefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/filenamefilter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- filenamefilter.cpp 11 Dec 2004 04:53:29 -0000 1.3
+++ filenamefilter.cpp 28 Jan 2005 17:03:37 -0000 1.4
@@ -19,28 +19,23 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-FilenameFilter::FilenameFilter(const LogString& actual, const LogString&
expected)
- : pattern(LOG4CXX_STR(" ")),
- replacement(LOG4CXX_STR(" ")) {
- pattern += actual;
- size_t backslash = pattern.rfind(LOG4CXX_STR('\\'), pattern.length() -
1);
- while (backslash != std::wstring::npos) {
- pattern.replace(backslash, 1, LOG4CXX_STR("\\\\"), 2);
+FilenameFilter::FilenameFilter(const std::string& actual, const std::string&
expected) {
+ std::string pattern(" ");
+ pattern += actual;
+ size_t backslash = pattern.rfind('\\', pattern.length() - 1);
+ while (backslash != std::string::npos) {
+ pattern.replace(backslash, 1, "\\\\", 2);
if (backslash == 0) {
backslash = std::string::npos;
} else {
- backslash = pattern.rfind(LOG4CXX_STR('\\'), backslash - 1);
+ backslash = pattern.rfind('\\', backslash - 1);
}
}
-
-
- replacement += expected;
-}
-
-LogString FilenameFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(pattern, in, replacement);
+
+ std::string replacement(1, ' ');
+ replacement.append(expected);
+
+ patterns.push_back( PatternReplacement(pattern, replacement) );
}
1.3 +2 -6 logging-log4cxx/tests/src/util/filenamefilter.h
Index: filenamefilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/filenamefilter.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- filenamefilter.h 11 Dec 2004 04:53:29 -0000 1.2
+++ filenamefilter.h 28 Jan 2005 17:03:37 -0000 1.3
@@ -24,12 +24,8 @@
class FilenameFilter : public Filter
{
public:
- FilenameFilter(const LogString& actual, const LogString&
expected);
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
-
- private:
- LogString pattern;
- LogString replacement;
+ FilenameFilter(const std::string& actual, const std::string&
expected);
+ static const std::string getMatch(const std::string& actual);
};
}
1.8 +7 -50 logging-log4cxx/tests/src/util/filter.cpp
Index: filter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/filter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- filter.cpp 2 Jan 2005 05:40:05 -0000 1.7
+++ filter.cpp 28 Jan 2005 17:03:37 -0000 1.8
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -14,60 +14,17 @@
* limitations under the License.
*/
-#include <boost/regex.hpp>
#include "filter.h"
#include <log4cxx/helpers/transcoder.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
-using namespace boost;
-
-UnexpectedFormatException::UnexpectedFormatException(const LogString& msg)
- : Exception(formatMessage(msg)) {
-}
-
-UnexpectedFormatException::UnexpectedFormatException(const
UnexpectedFormatException& src)
- : Exception(src) {
-}
-
-UnexpectedFormatException& UnexpectedFormatException::operator=(const
UnexpectedFormatException& src) {
- Exception::operator=(src);
- return *this;
-}
-
-std::string UnexpectedFormatException::formatMessage(const LogString& msg) {
- std::string s;
- Transcoder::encode(msg, s);
- return s;
-}
+Filter::Filter() {}
-std::string Filter::merge(const std::string& pattern,
- const std::string& in, const std::string& fmt)
-{
- boost::basic_regex<char> regex(pattern);
- return boost::regex_replace(in, regex, fmt);
+Filter::Filter(const std::string& match,
+ const std::string& replacement) {
+ patterns.push_back( PatternReplacement(match, replacement));
}
-
-bool Filter::match(const std::string& pattern,
- const std::string& in)
-{
- boost::basic_regex<char> regex(pattern);
- return boost::regex_match(in, regex);
-}
-
-std::wstring Filter::merge(const std::wstring& pattern,
- const std::wstring& in, const std::wstring& fmt)
-{
- boost::basic_regex<wchar_t> regex(pattern);
- return boost::regex_replace(in, regex, fmt);
-}
-
-bool Filter::match(const std::wstring& pattern,
- const std::wstring& in)
-{
- boost::basic_regex<wchar_t> regex(pattern);
- return boost::regex_match(in, regex);
-}
-
-
+
+Filter::~Filter() {}
1.12 +20 -27 logging-log4cxx/tests/src/util/filter.h
Index: filter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/filter.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- filter.h 3 Jan 2005 06:43:44 -0000 1.11
+++ filter.h 28 Jan 2005 17:03:37 -0000 1.12
@@ -17,48 +17,41 @@
#ifndef _LOG4CXX_TESTS_UTIL_FILTER_H
#define _LOG4CXX_TESTS_UTIL_FILTER_H
-#include <log4cxx/logstring.h>
+#include <string>
+#include <vector>
+#include <map>
#include <log4cxx/helpers/exception.h>
-#define BASIC_PAT LOG4CXX_STR("\\[0x[0-9A-F]*]
(FATAL|ERROR|WARN|INFO|DEBUG)")
-#define ISO8601_PAT LOG4CXX_STR("^\\d{4}-\\d{2}-\\d{2}
\\d{2}:\\d{2}:\\d{2},\\d{3}")
+#define BASIC_PAT "\\[0x[0-9A-F]*] (FATAL|ERROR|WARN|INFO|DEBUG)"
+#define ISO8601_PAT "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3}"
#define ABSOLUTE_DATE_AND_TIME_PAT \
- LOG4CXX_STR("^\\d{1,2} .{2,6}\\.? 200\\d
\\d{2}:\\d{2}:\\d{2},\\d{3}")
-#define ABSOLUTE_TIME_PAT LOG4CXX_STR("^\\d{2}:\\d{2}:\\d{2},\\d{3}")
-#define RELATIVE_TIME_PAT LOG4CXX_STR("^\\d{1,10}")
+ "^\\d{1,2} .{2,6}\\.? 200\\d \\d{2}:\\d{2}:\\d{2},\\d{3}"
+#define ABSOLUTE_TIME_PAT "^\\d{2}:\\d{2}:\\d{2},\\d{3}"
+#define RELATIVE_TIME_PAT "^\\d{1,10}"
namespace log4cxx
{
- class UnexpectedFormatException : public helpers::Exception
- {
- public:
- UnexpectedFormatException(const LogString& msg);
- UnexpectedFormatException(const UnexpectedFormatException&);
- UnexpectedFormatException& operator=(const
UnexpectedFormatException&);
- private:
- static std::string formatMessage(const LogString& msg);
+ class UnexpectedFormatException : public std::exception {
};
class Filter
{
public:
- Filter() {}
- virtual ~Filter() {}
- virtual LogString filter(const LogString& in)
- const throw(UnexpectedFormatException) = 0;
-
- static std::string merge(const std::string& pattern,
- const std::string& in, const std::string& fmt);
- static bool match(const std::string& pattern,
- const std::string& in);
- static std::wstring merge(const std::wstring& pattern,
- const std::wstring& in, const std::wstring& fmt);
- static bool match(const std::wstring& pattern,
- const std::wstring& in);
+ Filter(const std::string& match, const std::string& replacement);
+ Filter();
+ virtual ~Filter();
+
+ typedef std::pair<std::string, std::string>
PatternReplacement;
+ typedef std::vector <PatternReplacement> PatternList;
+ const PatternList& getPatterns() const{
+ return patterns;
+ }
private:
Filter(const Filter&);
Filter& operator=(const Filter&);
+ protected:
+ PatternList patterns;
};
}
1.5 +2 -5 logging-log4cxx/tests/src/util/iso8601filter.cpp
Index: iso8601filter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/iso8601filter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- iso8601filter.cpp 11 Dec 2004 04:53:29 -0000 1.4
+++ iso8601filter.cpp 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,7 +19,4 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString ISO8601Filter::filter(const LogString& in) const
throw(UnexpectedFormatException)
-{
- return merge(ISO8601_PAT, in, LOG4CXX_STR(""));
-}
+ISO8601Filter::ISO8601Filter() : Filter(ISO8601_PAT, "") {}
1.5 +1 -1 logging-log4cxx/tests/src/util/iso8601filter.h
Index: iso8601filter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/iso8601filter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- iso8601filter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ iso8601filter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -24,7 +24,7 @@
class ISO8601Filter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ ISO8601Filter();
};
}
1.7 +4 -4 logging-log4cxx/tests/src/util/linenumberfilter.cpp
Index: linenumberfilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/linenumberfilter.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- linenumberfilter.cpp 11 Dec 2004 04:53:29 -0000 1.6
+++ linenumberfilter.cpp 28 Jan 2005 17:03:37 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,8 +19,8 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString LineNumberFilter::filter(const LogString& in) const
throw(UnexpectedFormatException)
+LineNumberFilter::LineNumberFilter()
{
- LogString temp = merge(LOG4CXX_STR(" [^ ]*[\\\\]"), in, LOG4CXX_STR("
"));
- return merge(LOG4CXX_STR("\\(\\d{1,4}\\)"), temp,
LOG4CXX_STR("\\(X\\)"));
+ patterns.push_back( PatternReplacement(" [^ ]*[\\\\]", " "));
+ patterns.push_back( PatternReplacement("\\(\\d{1,4}\\)", "\\(X\\)"));
}
1.5 +2 -2 logging-log4cxx/tests/src/util/linenumberfilter.h
Index: linenumberfilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/linenumberfilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linenumberfilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ linenumberfilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class LineNumberFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ LineNumberFilter();
};
}
1.5 +3 -6 logging-log4cxx/tests/src/util/relativetimefilter.cpp
Index: relativetimefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/relativetimefilter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- relativetimefilter.cpp 11 Dec 2004 04:53:29 -0000 1.4
+++ relativetimefilter.cpp 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,8 +19,5 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString RelativeTimeFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(RELATIVE_TIME_PAT, in, LOG4CXX_STR(""));
-}
+RelativeTimeFilter::RelativeTimeFilter()
+ : Filter(RELATIVE_TIME_PAT, "") {}
1.5 +2 -2 logging-log4cxx/tests/src/util/relativetimefilter.h
Index: relativetimefilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/relativetimefilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- relativetimefilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ relativetimefilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class RelativeTimeFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ RelativeTimeFilter();
};
}
1.8 +1 -5 logging-log4cxx/tests/src/util/threadfilter.cpp
Index: threadfilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/threadfilter.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- threadfilter.cpp 3 Jan 2005 06:43:44 -0000 1.7
+++ threadfilter.cpp 28 Jan 2005 17:03:37 -0000 1.8
@@ -19,8 +19,4 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString ThreadFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(LOG4CXX_STR("\\[0x[0-9A-F]*]"), in,
LOG4CXX_STR("\\[main]"));
-}
+ThreadFilter::ThreadFilter() : Filter("\\[0x[0-9A-F]*]", "\\[main]") {}
1.5 +2 -2 logging-log4cxx/tests/src/util/threadfilter.h
Index: threadfilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/threadfilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- threadfilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ threadfilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class ThreadFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ ThreadFilter();
};
}
1.7 +70 -37 logging-log4cxx/tests/src/util/transformer.cpp
Index: transformer.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/transformer.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- transformer.cpp 26 Dec 2004 07:31:55 -0000 1.6
+++ transformer.cpp 28 Jan 2005 17:03:37 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -16,52 +16,85 @@
#include "transformer.h"
#include <log4cxx/file.h>
-#include <log4cxx/helpers/pool.h>
-#include <log4cxx/helpers/transcoder.h>
-#include <log4cxx/helpers/stringhelper.h>
+#include <apr_thread_proc.h>
+#include <apr_pools.h>
+#include <apr_file_io.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
void Transformer::transform(const File& in, const File& out,
- const std::vector<Filter *>& filters) throw(std::exception)
+ const std::vector<Filter *>& filters)
{
- Pool pool;
- LogString line;
- LogString input(in.read(pool));
- LogString output;
-
- while (StringHelper::getline(input, line))
- {
- for (std::vector<Filter *>::size_type i = 0; i <
filters.size(); i++)
- {
- line = filters[i]->filter(line);
- }
- if (!line.empty())
- {
- output.append(line);
- output.append(1, '\n');
- }
- }
- out.write(output, pool);
+ log4cxx::Filter::PatternList patterns;
+ for(std::vector<Filter*>::const_iterator iter = filters.begin();
+ iter != filters.end();
+ iter++) {
+
+ const log4cxx::Filter::PatternList& thesePatterns =
(*iter)->getPatterns();
+ for (log4cxx::Filter::PatternList::const_iterator pattern =
thesePatterns.begin();
+ pattern != thesePatterns.end();
+ pattern++) {
+ patterns.push_back(*pattern);
+ }
+ }
+ transform(in, out, patterns);
}
void Transformer::transform(const File& in, const File& out,
- const Filter& filter) throw(std::exception)
+ const Filter& filter)
{
- Pool pool;
- LogString line;
- LogString input(in.read(pool));
- LogString output;
-
- while (StringHelper::getline(input, line))
- {
- line = filter.filter(line);
- output.append(line);
- output.append(1, '\n');
- }
- out.write(output, pool);
-
+ transform(in, out, filter.getPatterns());
}
+
+void Transformer::transform(const File& in, const File& out,
+ const log4cxx::Filter::PatternList& patterns)
+{
+ apr_pool_t* pool;
+ apr_status_t stat = apr_pool_create(&pool, NULL);
+
+ apr_procattr_t* attr = NULL;
+ stat = apr_procattr_create(&attr, pool);
+
+ apr_file_t* child_out;
+ apr_int32_t flags = APR_FOPEN_WRITE | APR_FOPEN_CREATE |
APR_FOPEN_TRUNCATE;
+ stat = apr_file_open(&child_out, out.getOSName().c_str(),
+ flags, APR_OS_DEFAULT, pool);
+
+ stat = apr_procattr_child_out_set(attr, child_out, NULL);
+
+ const char** args = (const char**)
+ apr_palloc(pool, sizeof(*args) * patterns.size()*2 + 3);
+ args[0] = "-E";
+ int i = 1;
+ std::string tmp;
+ for (log4cxx::Filter::PatternList::const_iterator iter =
patterns.begin();
+ iter != patterns.end();
+ iter++) {
+ args[i++] = "-e";
+ tmp = "s`";
+ tmp.append(iter->first);
+ tmp.append(1, '`');
+ tmp.append(iter->second);
+ tmp.append("`g");
+ char* arg = (char*) apr_palloc(pool, tmp.length() + 1 *
sizeof(char));
+ strcpy(arg, tmp.c_str());
+ args[i++] = arg;
+ }
+
+ args[i++] = in.getOSName().c_str();
+ args[i] = NULL;
+
+
+ apr_proc_t pid;
+ stat = apr_proc_create(&pid,"sed", args, NULL, attr, pool);
+
+ int exitcode = -1;
+ apr_exit_why_e exitwhy;
+ stat = apr_proc_wait(&pid, &exitcode, &exitwhy, APR_WAIT);
+
+ apr_pool_destroy(pool);
+
+}
\ No newline at end of file
1.6 +6 -2 logging-log4cxx/tests/src/util/transformer.h
Index: transformer.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/transformer.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- transformer.h 26 Dec 2004 07:31:55 -0000 1.5
+++ transformer.h 28 Jan 2005 17:03:37 -0000 1.6
@@ -29,11 +29,15 @@
public:
static void transform(const File& in,
const File& out,
- const std::vector<Filter *>& filters)
throw(std::exception);
+ const std::vector<Filter *>& filters);
static void transform(const File& in,
const File& out,
- const Filter& filter) throw(std::exception);
+ const Filter& filter);
+
+ static void transform(const File& in,
+ const File& out,
+ const std::vector<
log4cxx::Filter::PatternReplacement >& patterns);
};
}
1.4 +10 -17 logging-log4cxx/tests/src/util/xmlfilenamefilter.cpp
Index: xmlfilenamefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmlfilenamefilter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xmlfilenamefilter.cpp 11 Dec 2004 04:53:29 -0000 1.3
+++ xmlfilenamefilter.cpp 28 Jan 2005 17:03:37 -0000 1.4
@@ -19,30 +19,23 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-XMLFilenameFilter::XMLFilenameFilter(const LogString& actual, const
LogString& expected)
- : pattern(LOG4CXX_STR(" file=\"")),
- replacement(LOG4CXX_STR(" file=\"")) {
- LogString filename(actual);
- size_t backslash = filename.rfind(LOG4CXX_STR('\\'), filename.length()
- 1);
+XMLFilenameFilter::XMLFilenameFilter(const std::string& actual, const
std::string& expected) {
+ std::string pattern(" file=\"");
+ std::string replacement(" file=\"");
+ std::string filename(actual);
+ size_t backslash = filename.rfind('\\', filename.length() - 1);
while (backslash != std::string::npos) {
- filename.replace(backslash, 1, LOG4CXX_STR("\\\\"), 2);
+ filename.replace(backslash, 1, "\\\\", 2);
if (backslash == 0) {
backslash = std::string::npos;
} else {
- backslash = filename.rfind(LOG4CXX_STR('\\'), backslash -
1);
+ backslash = filename.rfind('\\', backslash - 1);
}
}
pattern += filename;
- pattern += LOG4CXX_STR("\"");
+ pattern += "\"";
replacement += expected;
- replacement += LOG4CXX_STR("\"");
+ replacement += "\"";
+ patterns.push_back( PatternReplacement(pattern, replacement) );
}
-
-LogString XMLFilenameFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(pattern, in, replacement);
-}
-
-
1.3 +1 -6 logging-log4cxx/tests/src/util/xmlfilenamefilter.h
Index: xmlfilenamefilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmlfilenamefilter.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xmlfilenamefilter.h 11 Dec 2004 04:53:29 -0000 1.2
+++ xmlfilenamefilter.h 28 Jan 2005 17:03:37 -0000 1.3
@@ -24,12 +24,7 @@
class XMLFilenameFilter : public Filter
{
public:
- XMLFilenameFilter(const LogString& actual, const LogString&
expected);
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
-
- private:
- LogString pattern;
- LogString replacement;
+ XMLFilenameFilter(const std::string& actual, const std::string&
expected);
};
}
1.4 +4 -6 logging-log4cxx/tests/src/util/xmllineattributefilter.cpp
Index: xmllineattributefilter.cpp
===================================================================
RCS file:
/home/cvs/logging-log4cxx/tests/src/util/xmllineattributefilter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xmllineattributefilter.cpp 11 Dec 2004 04:53:29 -0000 1.3
+++ xmllineattributefilter.cpp 28 Jan 2005 17:03:37 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,9 +19,7 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString XMLLineAttributeFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- LogString temp = merge(LOG4CXX_STR("file=\"[^ ]*[\\\\]"), in,
LOG4CXX_STR("file=\""));
- return merge(LOG4CXX_STR("line=\"\\d{1,3}\""), temp,
LOG4CXX_STR("line=\"X\""));
+XMLLineAttributeFilter::XMLLineAttributeFilter() {
+ patterns.push_back( PatternReplacement("file=\"[^ ]*[\\\\]",
"file=\""));
+ patterns.push_back( PatternReplacement("line=\"\\d{1,3}\"",
"line=\"X\""));
}
1.5 +1 -1 logging-log4cxx/tests/src/util/xmllineattributefilter.h
Index: xmllineattributefilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmllineattributefilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmllineattributefilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ xmllineattributefilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -24,7 +24,7 @@
class XMLLineAttributeFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ XMLLineAttributeFilter();
};
}
1.6 +2 -4 logging-log4cxx/tests/src/util/xmlthreadfilter.cpp
Index: xmlthreadfilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmlthreadfilter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xmlthreadfilter.cpp 3 Jan 2005 06:43:44 -0000 1.5
+++ xmlthreadfilter.cpp 28 Jan 2005 17:03:37 -0000 1.6
@@ -19,8 +19,6 @@
using namespace log4cxx;
using namespace log4cxx::helpers;
-LogString XMLThreadFilter::filter(const LogString& in)
- const throw(UnexpectedFormatException)
-{
- return merge(LOG4CXX_STR("thread=\"0x[0-9A-F]*\""), in,
LOG4CXX_STR("thread=\"main\""));
+XMLThreadFilter::XMLThreadFilter()
+ : Filter("thread=\"0x[0-9A-F]*\"", "thread=\"main\"") {
}
1.5 +2 -2 logging-log4cxx/tests/src/util/xmlthreadfilter.h
Index: xmlthreadfilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmlthreadfilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmlthreadfilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ xmlthreadfilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class XMLThreadFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ XMLThreadFilter();
};
}
1.5 +3 -5 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmltimestampfilter.cpp 15 Dec 2004 08:10:40 -0000 1.4
+++ xmltimestampfilter.cpp 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -19,9 +19,7 @@
using namespace log4cxx;
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\""));
-}
+XMLTimestampFilter::XMLTimestampFilter()
+ : Filter("timestamp=\"\\d{10,13}\"", "timestamp=\"XXX\"") {}
1.5 +2 -2 logging-log4cxx/tests/src/util/xmltimestampfilter.h
Index: xmltimestampfilter.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmltimestampfilter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmltimestampfilter.h 11 Dec 2004 04:53:29 -0000 1.4
+++ xmltimestampfilter.h 28 Jan 2005 17:03:37 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2003,2004 The Apache Software Foundation.
+ * Copyright 2003-2005 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.
@@ -24,7 +24,7 @@
class XMLTimestampFilter : public Filter
{
public:
- LogString filter(const LogString& in) const
throw(UnexpectedFormatException);
+ XMLTimestampFilter();
};
}
1.6 +34 -37 logging-log4cxx/tests/src/varia/errorhandlertestcase.cpp
Index: errorhandlertestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/varia/errorhandlertestcase.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- errorhandlertestcase.cpp 12 Jan 2005 04:37:12 -0000 1.5
+++ errorhandlertestcase.cpp 28 Jan 2005 17:03:38 -0000 1.6
@@ -28,22 +28,19 @@
#include "../util/compare.h"
#include "../util/controlfilter.h"
#include "../util/threadfilter.h"
-#include "../util/linenumberfilter.h"
-#include <iostream>
+#include "../util/linenumberfilter.h"
+#include <iostream>
#include <log4cxx/file.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
using namespace log4cxx::xml;
-
-#define LOG4CXX_TEST_STR(x) L##x
-
-#define TEST1_A_PAT LOG4CXX_TEST_STR("FALLBACK - test - Message \\d")
-#define TEST1_B_PAT LOG4CXX_TEST_STR("FALLBACK - root - Message \\d")
+#define TEST1_A_PAT "FALLBACK - test - Message \\d"
+#define TEST1_B_PAT "FALLBACK - root - Message \\d"
#define TEST1_2_PAT \
- LOG4CXX_TEST_STR("^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3} ") \
- LOG4CXX_TEST_STR("\\[main]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message
\\d")
+ "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3} " \
+ "\\[main]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message \\d"
class ErrorHandlerTestCase : public CppUnit::TestFixture
{
@@ -52,10 +49,10 @@
CPPUNIT_TEST_SUITE_END();
LoggerPtr root;
- LoggerPtr logger;
-
- static const File TEMP;
- static const File FILTERED;
+ LoggerPtr logger;
+
+ static const File TEMP;
+ static const File FILTERED;
public:
@@ -72,7 +69,7 @@
void test1()
{
-
DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/fallback1.xml"));
+ DOMConfigurator::configure("input/xml/fallback1.xml");
common();
ControlFilter cf;
@@ -84,8 +81,8 @@
std::vector<Filter *> filters;
filters.push_back(&cf);
filters.push_back(&threadFilter);
- filters.push_back(&lineNumberFilter);
-
+ filters.push_back(&lineNumberFilter);
+
common();
try
@@ -97,7 +94,7 @@
std::cout << "UnexpectedFormatException :" << e.what() <<
std::endl;
throw;
}
-
+
const File witness(L"witness/fallback");
CPPUNIT_ASSERT(Compare::compare(FILTERED, witness));
}
@@ -105,41 +102,41 @@
void common()
{
int i = -1;
-
- std::ostringstream os;
+
+ std::ostringstream os;
os << "Message " << ++ i;
- LOG4CXX_DEBUG(logger, os.str());
- LOG4CXX_DEBUG(root, os.str());
-
- os.str("");
+ LOG4CXX_DEBUG(logger, os.str());
+ LOG4CXX_DEBUG(root, os.str());
+
+ os.str("");
os << "Message " << ++i;
LOG4CXX_INFO(logger, os.str());
LOG4CXX_INFO(root, os.str());
- os.str("");
- os << "Message " << ++i;
+ os.str("");
+ os << "Message " << ++i;
LOG4CXX_WARN(logger, os.str());
LOG4CXX_WARN(root, os.str());
- os.str("");
- os << "Message " << ++i;
+ os.str("");
+ os << "Message " << ++i;
LOG4CXX_ERROR(logger, os.str());
LOG4CXX_ERROR(root, os.str());
-
- os.str("");
+
+ os.str("");
os << "Message " << ++i;
LOG4CXX_FATAL(logger, os.str());
LOG4CXX_FATAL(root, os.str());
}
};
-
-//TODO: Not sure this test ever worked. 0.9.7 didn't call common
-// had nothing that attempted to dispatch any log events
-
-//CPPUNIT_TEST_SUITE_REGISTRATION(ErrorHandlerTestCase);
-
-const File ErrorHandlerTestCase::TEMP(L"output/temp");
-const File ErrorHandlerTestCase::FILTERED(L"output/filtered");
+
+//TODO: Not sure this test ever worked. 0.9.7 didn't call common
+// had nothing that attempted to dispatch any log events
+
+//CPPUNIT_TEST_SUITE_REGISTRATION(ErrorHandlerTestCase);
+
+const File ErrorHandlerTestCase::TEMP(L"output/temp");
+const File ErrorHandlerTestCase::FILTERED(L"output/filtered");
#endif //HAVE_XML
1.7 +34 -34 logging-log4cxx/tests/src/xml/domtestcase.cpp
Index: domtestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/xml/domtestcase.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- domtestcase.cpp 12 Jan 2005 04:37:12 -0000 1.6
+++ domtestcase.cpp 28 Jan 2005 17:03:38 -0000 1.7
@@ -29,10 +29,10 @@
#include "../util/controlfilter.h"
#include "../util/iso8601filter.h"
#include "../util/threadfilter.h"
-#include "../util/transformer.h"
-#include <iostream>
-#include <log4cxx/file.h>
-
+#include "../util/transformer.h"
+#include <iostream>
+#include <log4cxx/file.h>
+
#define LOG4CXX_TEST_STR(x) L##x
using namespace log4cxx;
@@ -41,12 +41,12 @@
#define TEST1_1A_PAT \
- LOG4CXX_TEST_STR("(DEBUG|INFO |WARN |ERROR|FATAL) \\w*\\.\\w* -
Message \\d")
+ "(DEBUG|INFO |WARN |ERROR|FATAL) \\w*\\.\\w* - Message \\d"
-#define TEST1_1B_PAT LOG4CXX_TEST_STR("(DEBUG|INFO |WARN |ERROR|FATAL) root
- Message \\d")
+#define TEST1_1B_PAT "(DEBUG|INFO |WARN |ERROR|FATAL) root - Message \\d"
-#define TEST1_2_PAT LOG4CXX_TEST_STR("^\\d{4}-\\d{2}-\\d{2}
\\d{2}:\\d{2}:\\d{2},\\d{3} ") \
- LOG4CXX_TEST_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .*
- Message \\d")
+#define TEST1_2_PAT "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3} " \
+ "\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message \\d"
class DOMTestCase : public CppUnit::TestFixture
{
@@ -55,11 +55,11 @@
CPPUNIT_TEST_SUITE_END();
LoggerPtr root;
- LoggerPtr logger;
-
- static const File TEMP_A1;
- static const File TEMP_A2;
- static const File FILTERED_A1;
+ LoggerPtr logger;
+
+ static const File TEMP_A1;
+ static const File TEMP_A2;
+ static const File FILTERED_A1;
static const File FILTERED_A2;
public:
@@ -106,39 +106,39 @@
std::cout << "UnexpectedFormatException :" << e.what()
<< std::endl;
throw;
}
-
+
const File witness1(L"witness/dom.A1.1");
- const File witness2(L"witness/dom.A2.1");
- // TODO: A1 doesn't contain duplicate entries
- //
+ const File witness2(L"witness/dom.A2.1");
+ // TODO: A1 doesn't contain duplicate entries
+ //
//
CPPUNIT_ASSERT(Compare::compare(FILTERED_A1, witness1));
CPPUNIT_ASSERT(Compare::compare(FILTERED_A2, witness2));
}
void common()
{
- int i = -1;
- std::ostringstream os;
+ int i = -1;
+ std::ostringstream os;
os << "Message " << ++i;
- LOG4CXX_DEBUG(logger, os.str());
+ LOG4CXX_DEBUG(logger, os.str());
LOG4CXX_DEBUG(root, os.str());
-
- os.str("");
+
+ os.str("");
os << "Message " << ++i;
LOG4CXX_INFO(logger,os.str());
LOG4CXX_INFO(root, os.str());
-
- os.str("");
+
+ os.str("");
os << "Message " << ++i;
LOG4CXX_WARN(logger, os.str());
LOG4CXX_WARN(root, os.str());
-
- os.str("");
+
+ os.str("");
os << "Message " << ++i;
LOG4CXX_ERROR(logger, os.str());
- LOG4CXX_ERROR(root, os.str());
-
+ LOG4CXX_ERROR(root, os.str());
+
os.str("");
os << "Message " << ++i;
LOG4CXX_FATAL(logger, os.str());
@@ -147,12 +147,12 @@
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(DOMTestCase);
-
-const File DOMTestCase::TEMP_A1(L"output/temp.A1");
-const File DOMTestCase::TEMP_A2(L"output/temp.A2");
-const File DOMTestCase::FILTERED_A1(L"output/filtered.A1");
-const File DOMTestCase::FILTERED_A2(L"output/filtered.A2");
+CPPUNIT_TEST_SUITE_REGISTRATION(DOMTestCase);
+
+const File DOMTestCase::TEMP_A1(L"output/temp.A1");
+const File DOMTestCase::TEMP_A2(L"output/temp.A2");
+const File DOMTestCase::FILTERED_A1(L"output/filtered.A1");
+const File DOMTestCase::FILTERED_A2(L"output/filtered.A2");
#endif //HAVE_XML
1.10 +2 -4 logging-log4cxx/tests/src/xml/xmllayouttestcase.cpp
Index: xmllayouttestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/xml/xmllayouttestcase.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- xmllayouttestcase.cpp 4 Jan 2005 06:38:15 -0000 1.9
+++ xmllayouttestcase.cpp 28 Jan 2005 17:03:38 -0000 1.10
@@ -117,8 +117,7 @@
XMLTimestampFilter xmlTimestampFilter;
XMLLineAttributeFilter xmlLineAttributeFilter;
XMLThreadFilter xmlThreadFilter;
- LOG4CXX_DECODE_CHAR(thisFile, __FILE__);
- XMLFilenameFilter xmlFilenameFilter(thisFile.c_str(),
LOG4CXX_STR("xmllayouttestcase.cpp"));
+ XMLFilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
std::vector<Filter *> filters;
filters.push_back(&xmlTimestampFilter);
@@ -156,8 +155,7 @@
XMLTimestampFilter xmlTimestampFilter;
XMLLineAttributeFilter xmlLineAttributeFilter;
XMLThreadFilter xmlThreadFilter;
- LOG4CXX_DECODE_CHAR(thisFile, __FILE__);
- XMLFilenameFilter xmlFilenameFilter(thisFile,
LOG4CXX_STR("xmllayouttestcase.cpp"));
+ XMLFilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
std::vector<Filter *> filters;
filters.push_back(&xmlTimestampFilter);