carnold 2005/01/29 15:44:54
Modified: . .cvsignore build.xml
tests/src minimumtestcase.cpp patternlayouttest.cpp
tests/src/net socketservertestcase.cpp
tests/src/util filenamefilter.cpp filter.h
linenumberfilter.cpp transformer.cpp
xmlfilenamefilter.cpp xmllineattributefilter.cpp
xmlthreadfilter.cpp xmltimestampfilter.cpp
tests/src/varia errorhandlertestcase.cpp
tests/src/xml domtestcase.cpp xmllayouttestcase.cpp
tests/witness patternLayout.8
Log:
LOGCXX-54: Replacement of boost-regex with sed
Revision Changes Path
1.2 +2 -1 logging-log4cxx/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/logging-log4cxx/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 8 Oct 2004 20:30:13 -0000 1.1
+++ .cvsignore 29 Jan 2005 23:44:52 -0000 1.2
@@ -5,7 +5,8 @@
.cdtproject
aclocal.m4
autom4te.cache
-bak
+bak
+lib
libtool
linux
log4cxx.cbx
1.26 +1 -1 logging-log4cxx/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4cxx/build.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- build.xml 29 Jan 2005 17:43:44 -0000 1.25
+++ build.xml 29 Jan 2005 23:44:52 -0000 1.26
@@ -640,6 +640,6 @@
<target name="test-all" depends="build-log4cxx, run-unittest"/>
-<target name="gump" depends="build-log4cxx, header-check"/>
+<target name="gump" depends="build-log4cxx, header-check, test-all"/>
</project>
1.16 +1 -1 logging-log4cxx/tests/src/minimumtestcase.cpp
Index: minimumtestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/minimumtestcase.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- minimumtestcase.cpp 29 Jan 2005 17:43:44 -0000 1.15
+++ minimumtestcase.cpp 29 Jan 2005 23:44:53 -0000 1.16
@@ -44,7 +44,7 @@
#define TTCC_PAT \
ABSOLUTE_DATE_AND_TIME_PAT \
- " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message
[0-9]{1,2}"
+ " \\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message
[0-9]\\{1,2\\}"
#define TTCC2_PAT \
ABSOLUTE_DATE_AND_TIME_PAT \
1.15 +13 -10 logging-log4cxx/tests/src/patternlayouttest.cpp
Index: patternlayouttest.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/patternlayouttest.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- patternlayouttest.cpp 29 Jan 2005 17:43:44 -0000 1.14
+++ patternlayouttest.cpp 29 Jan 2005 23:44:53 -0000 1.15
@@ -44,18 +44,18 @@
#define REGEX_STR(x) x
-#define PAT0 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* -
Message [0-9]{1,2}")
+#define PAT0 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* -
Message [0-9]\\{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 [0-9]{1,2}")
-#define PAT6 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
.*patternlayouttest.cpp\\([0-9]{1,4}\\): Message [0-9]{1,3}")
-#define PAT11a REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
log4j.PatternLayoutTest: Message [0-9]{1,2}")
-#define PAT11b REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
root: Message [0-9]{1,2}")
+#define PAT5 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* :
Message [0-9]\\{1,2\\}")
+#define PAT6 REGEX_STR("\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
.*patternlayouttest.cpp\\([0-9]\\{1,4\\}\\): Message [0-9]\\{1,3\\}")
+#define PAT11a REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
log4j.PatternLayoutTest: Message [0-9]\\{1,2\\}")
+#define PAT11b REGEX_STR("^(DEBUG|INFO |WARN |ERROR|FATAL) \\[0x[0-9A-F]*]\\
root: Message [0-9]\\{1,2\\}")
#define PAT12 REGEX_STR("^\\[0x[0-9A-F]*]\\ (DEBUG|INFO |WARN |ERROR|FATAL)
")\
- REGEX_STR(".*patternlayouttest.cpp\\([0-9]{1,4}\\): ")\
- REGEX_STR("Message [0-9]{1,2}")
+ REGEX_STR(".*patternlayouttest.cpp([0-9]\\{1,4\\}): ")\
+ REGEX_STR("Message [0-9]\\{1,2\\}")
#define PAT_MDC_1 REGEX_STR("")
using namespace log4cxx;
@@ -277,15 +277,18 @@
PropertyConfigurator::configure(LOG4CXX_FILE("input/patternLayout8.properties"));
common();
+
ControlFilter filter1;
filter1 << PAT4;
- RelativeTimeFilter filter2;
- ThreadFilter filter3;
+ //
+ // combo of relative time and thread identifier
+ // (the \\\\1 preserve a leading space)
+ Filter filter2(".*0x[0-9A-F]*]", "[main]");
std::vector<Filter *> filters;
+
filters.push_back(&filter1);
filters.push_back(&filter2);
- filters.push_back(&filter3);
try
{
1.18 +12 -10 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- socketservertestcase.cpp 29 Jan 2005 17:43:44 -0000 1.17
+++ socketservertestcase.cpp 29 Jan 2005 23:44:53 -0000 1.18
@@ -60,37 +60,37 @@
// DEBUG T1 [thread] org.apache.log4j.net.SocketAppenderTestCase Message 1
#define PAT1 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T1
\\[0x[0-9A-F]*]\\ ") \
- REGEX_STR(".* Message [0-9]{1,2}")
+ REGEX_STR(".* Message [0-9]\\{1,2\\}")
// DEBUG T2 [thread] patternlayouttest.cpp(?) Message 1
#define PAT2 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T2
\\[0x[0-9A-F]*]\\ ") \
- REGEX_STR(".*socketservertestcase.cpp\\([0-9]{1,4}\\) Message
[0-9]{1,2}")
+ REGEX_STR(".*socketservertestcase.cpp\\([0-9]\\{1,4\\}\\) Message
[0-9]\\{1,2\\}")
// DEBUG T3 [thread] patternlayouttest.cpp(?) Message 1
#define PAT3 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) T3
\\[0x[0-9A-F]*]\\ ") \
- REGEX_STR(".*socketservertestcase.cpp\\([0-9]{1,4}\\) Message
[0-9]{1,2}")
+ REGEX_STR(".*socketservertestcase.cpp\\([0-9]\\{1,4\\}\\) Message
[0-9]\\{1,2\\}")
// DEBUG some T4 MDC-TEST4 [thread] SocketAppenderTestCase - Message 1
// DEBUG some T4 MDC-TEST4 [thread] SocketAppenderTestCase - Message 1
#define PAT4 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some T4 MDC-TEST4
\\[0x[0-9A-F]*]\\") \
- REGEX_STR(" (root|SocketServerTestCase) - Message [0-9]{1,2}")
+ REGEX_STR(" (root|SocketServerTestCase) - Message [0-9]\\{1,2\\}")
#define PAT5 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some5 T5
MDC-TEST5 \\[0x[0-9A-F]*]\\") \
- REGEX_STR(" (root|SocketServerTestCase) - Message [0-9]{1,2}")
+ REGEX_STR(" (root|SocketServerTestCase) - Message [0-9]\\{1,2\\}")
#define PAT6 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some6 T6
client-test6 MDC-TEST6") \
- REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
[0-9]{1,2}")
+ REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
[0-9]\\{1,2\\}")
#define PAT7 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some7 T7
client-test7 MDC-TEST7") \
- REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
[0-9]{1,2}")
+ REGEX_STR(" \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase) - Message
[0-9]\\{1,2\\}")
// DEBUG some8 T8 shortSocketServer MDC-TEST7 [thread] SocketServerTestCase
- Message 1
#define PAT8 \
REGEX_STR("^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some8 T8
shortSocketServer") \
- REGEX_STR(" MDC-TEST8 \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase)
- Message [0-9]{1,2}")
+ REGEX_STR(" MDC-TEST8 \\[0x[0-9A-F]*]\\ (root|SocketServerTestCase)
- Message [0-9]\\{1,2\\}")
class ShortSocketServerLauncher
{
@@ -99,15 +99,17 @@
{
if (!launched)
{
+ //
+ // should be replaced with apr_proc calls
#ifdef WIN32
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
- std::string commandLine("src\\shortsocketserver 8
input/socketServer");
+ char commandLine[] = "src\\shortsocketserver 8
input/socketServer";
- BOOL bResult = ::CreateProcessA(NULL,
commandLine.c_str(), NULL, NULL,
+ BOOL bResult = ::CreateProcessA(NULL, commandLine,
NULL, NULL,
TRUE, 0, NULL, NULL, &si, &pi);
#else
if(!::fork())
1.5 +2 -6 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- filenamefilter.cpp 28 Jan 2005 17:03:37 -0000 1.4
+++ filenamefilter.cpp 29 Jan 2005 23:44:53 -0000 1.5
@@ -20,8 +20,7 @@
using namespace log4cxx::helpers;
FilenameFilter::FilenameFilter(const std::string& actual, const std::string&
expected) {
- std::string pattern(" ");
- pattern += actual;
+ std::string pattern(actual);
size_t backslash = pattern.rfind('\\', pattern.length() - 1);
while (backslash != std::string::npos) {
pattern.replace(backslash, 1, "\\\\", 2);
@@ -32,10 +31,7 @@
}
}
- std::string replacement(1, ' ');
- replacement.append(expected);
-
- patterns.push_back( PatternReplacement(pattern, replacement) );
+ patterns.push_back( PatternReplacement(pattern, expected) );
}
1.14 +4 -4 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- filter.h 29 Jan 2005 17:43:45 -0000 1.13
+++ filter.h 29 Jan 2005 23:44:53 -0000 1.14
@@ -23,11 +23,11 @@
#include <log4cxx/helpers/exception.h>
#define BASIC_PAT "\\[0x[0-9A-F]*] (FATAL|ERROR|WARN|INFO|DEBUG)"
-#define ISO8601_PAT "^[0-9]{4}-[0-9]{2}-[0-9]{2}
[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}"
+#define ISO8601_PAT "[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{3\\}"
#define ABSOLUTE_DATE_AND_TIME_PAT \
- "^[0-9]{1,2} .{2,6}\\.? 200[0-9] [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}"
-#define ABSOLUTE_TIME_PAT "^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}"
-#define RELATIVE_TIME_PAT "^[0-9]{1,10}"
+ "[0-9]\\{1,2\\} .* 200[0-9]
[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{3\\}"
+#define ABSOLUTE_TIME_PAT "[0-2][0-9]:[0-9][0-9]:[0-9][0-9],[0-9][0-9][0-9]"
+#define RELATIVE_TIME_PAT "^[0-9]+"
namespace log4cxx
{
1.9 +1 -1 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linenumberfilter.cpp 29 Jan 2005 17:43:45 -0000 1.8
+++ linenumberfilter.cpp 29 Jan 2005 23:44:53 -0000 1.9
@@ -22,5 +22,5 @@
LineNumberFilter::LineNumberFilter()
{
patterns.push_back( PatternReplacement(" [^ ]*[\\\\]", " "));
- patterns.push_back( PatternReplacement("\\([0-9]{1,4}\\)", "\\(X\\)"));
+ patterns.push_back( PatternReplacement("([0-9]*)", "(X)"));
}
1.9 +84 -67 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- transformer.cpp 29 Jan 2005 17:43:45 -0000 1.8
+++ transformer.cpp 29 Jan 2005 23:44:53 -0000 1.9
@@ -22,8 +22,15 @@
#include <assert.h>
using namespace log4cxx;
-using namespace log4cxx::helpers;
-
+using namespace log4cxx::helpers;
+
+#if !defined(APR_FOPEN_READ)
+#define APR_FOPEN_READ APR_READ
+#define APR_FOPEN_CREATE APR_CREATE
+#define APR_FOPEN_WRITE APR_WRITE
+#define APR_FOPEN_TRUNCATE APR_TRUNCATE
+#define APR_FOPEN_APPEND APR_APPEND
+#endif
void Transformer::transform(const File& in, const File& out,
const std::vector<Filter *>& filters)
@@ -56,52 +63,55 @@
apr_pool_t* pool;
apr_status_t stat = apr_pool_create(&pool, NULL);
- //
- // open the output file
- //
- 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);
- assert(stat == 0);
-
- //
- // fairly naive file copy code
- //
- //
- apr_file_t* in_file;
- stat = apr_file_open(&in_file, in.getOSName().c_str(),
+
+ if (patterns.size() == 0) {
+ //
+ // fairly naive file copy code
+ //
+ //
+ 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);
+ assert(stat == 0);
+
+ apr_file_t* in_file;
+ stat = apr_file_open(&in_file, in.getOSName().c_str(),
APR_FOPEN_READ, APR_OS_DEFAULT, pool);
- assert(stat == 0);
- apr_size_t bufsize = 32000;
- void* buf = apr_palloc(pool, bufsize);
- apr_size_t bytesRead = bufsize;
-
- while(stat == 0 && bytesRead == bufsize) {
- stat = apr_file_read(in_file, buf, &bytesRead);
- if (stat == 0 && bytesRead > 0) {
- stat = apr_file_write(child_out, buf, &bytesRead);
- assert(stat == 0);
- }
- }
- apr_file_close(child_out);
- apr_file_close(in_file);
-
-
- //
- // if there are patterns, invoke sed to execute the replacements
- //
- //
- if (patterns.size() > 0) {
+ assert(stat == 0);
+ apr_size_t bufsize = 32000;
+ void* buf = apr_palloc(pool, bufsize);
+ apr_size_t bytesRead = bufsize;
+
+ while(stat == 0 && bytesRead == bufsize) {
+ stat = apr_file_read(in_file, buf, &bytesRead);
+ if (stat == 0 && bytesRead > 0) {
+ stat = apr_file_write(child_out, buf, &bytesRead);
+ assert(stat == 0);
+ }
+ }
+ } else {
+ //
+ // if there are patterns, invoke sed to execute the replacements
+ //
+ //
apr_procattr_t* attr = NULL;
stat = apr_procattr_create(&attr, pool);
assert(stat == 0);
-
-
+
+ //
+ // find the program on the path
+ //
+ stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM_PATH);
+ assert(stat == 0);
+
+ //
+ // build the argument list
+ // using Q as regex separator on s command
+ //
const char** args = (const char**)
- apr_palloc(pool, (patterns.size()*2 + 4) * sizeof(*args));
+ apr_palloc(pool, (patterns.size()*2 + 3) * sizeof(*args));
int i = 0;
- args[i++] = "-i";
args[i++] = "-r";
std::string tmp;
for (log4cxx::Filter::PatternList::const_iterator iter =
patterns.begin();
@@ -117,39 +127,46 @@
strcpy(arg, tmp.c_str());
args[i++] = arg;
}
-
- args[i++] = out.getOSName().c_str();
+
+ //
+ // specify the input file
+ args[i++] = in.getOSName().c_str();
args[i] = NULL;
-#if 0
- // capture the error stream to diagnose problems
- //
- // open the error file
- //
- apr_file_t* child_err;
- apr_int32_t flags = APR_FOPEN_WRITE | APR_FOPEN_CREATE |
APR_FOPEN_TRUNCATE;
- stat = apr_file_open(&child_err, "sed.log",
- flags, APR_OS_DEFAULT, pool);
- assert(stat == 0);
-
- stat = apr_procattr_child_err_set(attr, child_err, NULL);
- assert(stat == 0);
-#endif
-
-
-
-
+
+ //
+ // set the output stream to go to the out file
+ //
+ apr_file_t* child_out;
+ stat = apr_file_open(&child_out,
+ out.getOSName().c_str(),
+ APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE,
+ APR_OS_DEFAULT,
+ pool);
+ assert(stat == 0);
+
+ stat = apr_procattr_child_out_set(attr, child_out, NULL);
+ assert(stat == 0);
+
+ apr_file_t* child_err;
+ stat = apr_file_open(&child_err,
+ "sed.err",
+ APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_APPEND,
+ APR_OS_DEFAULT,
+ pool);
+ assert(stat == 0);
+
+ stat = apr_procattr_child_err_set(attr, child_err, NULL);
+ assert(stat == 0);
+
apr_proc_t pid;
stat = apr_proc_create(&pid,"sed", args, NULL, attr, pool);
assert(stat == 0);
- int exitcode = -1;
- apr_exit_why_e exitwhy;
- stat = apr_proc_wait(&pid, &exitcode, &exitwhy, APR_WAIT);
- apr_exit_why_e foo = exitwhy;
+ apr_proc_wait(&pid, NULL, NULL, APR_WAIT);
}
+ apr_pool_destroy(pool);
- apr_pool_destroy(pool);
}
1.5 +4 -16 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmlfilenamefilter.cpp 28 Jan 2005 17:03:37 -0000 1.4
+++ xmlfilenamefilter.cpp 29 Jan 2005 23:44:53 -0000 1.5
@@ -20,22 +20,10 @@
using namespace log4cxx::helpers;
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, "\\\\", 2);
- if (backslash == 0) {
- backslash = std::string::npos;
- } else {
- backslash = filename.rfind('\\', backslash - 1);
- }
- }
- pattern += filename;
- pattern += "\"";
+ std::string pattern(" file=\\(.\\).*");
+ pattern += expected;
+ std::string replacement(" file=\\\\1");
replacement += expected;
- replacement += "\"";
- patterns.push_back( PatternReplacement(pattern, replacement) );
+// patterns.push_back( PatternReplacement(pattern, replacement) );
}
1.6 +1 -2 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xmllineattributefilter.cpp 29 Jan 2005 17:43:45 -0000 1.5
+++ xmllineattributefilter.cpp 29 Jan 2005 23:44:53 -0000 1.6
@@ -20,6 +20,5 @@
using namespace log4cxx::helpers;
XMLLineAttributeFilter::XMLLineAttributeFilter() {
- patterns.push_back( PatternReplacement("file=\"[^ ]*[\\\\]",
"file=\""));
- patterns.push_back( PatternReplacement("line=\"[0-9]{1,3}\"",
"line=\"X\""));
+ patterns.push_back( PatternReplacement("line=\\(.+\\)[0-9]+",
"line=\\\\1X"));
}
1.7 +1 -1 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xmlthreadfilter.cpp 28 Jan 2005 17:03:37 -0000 1.6
+++ xmlthreadfilter.cpp 29 Jan 2005 23:44:53 -0000 1.7
@@ -20,5 +20,5 @@
using namespace log4cxx::helpers;
XMLThreadFilter::XMLThreadFilter()
- : Filter("thread=\"0x[0-9A-F]*\"", "thread=\"main\"") {
+ : Filter("0x[0-9A-F]*", "main") {
}
1.7 +1 -1 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xmltimestampfilter.cpp 29 Jan 2005 17:43:45 -0000 1.6
+++ xmltimestampfilter.cpp 29 Jan 2005 23:44:53 -0000 1.7
@@ -20,6 +20,6 @@
using namespace log4cxx::helpers;
XMLTimestampFilter::XMLTimestampFilter()
- : Filter("timestamp=\"[0-9]{10,13}\"", "timestamp=\"XXX\"") {}
+ : Filter("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]*", "XXX") {}
1.8 +1 -1 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- errorhandlertestcase.cpp 29 Jan 2005 17:43:45 -0000 1.7
+++ errorhandlertestcase.cpp 29 Jan 2005 23:44:53 -0000 1.8
@@ -39,7 +39,7 @@
#define TEST1_A_PAT "FALLBACK - test - Message [0-9]"
#define TEST1_B_PAT "FALLBACK - root - Message [0-9]"
#define TEST1_2_PAT \
- "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} " \
+ "^[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{3\\} " \
"\\[main]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message [0-9]"
class ErrorHandlerTestCase : public CppUnit::TestFixture
1.9 +1 -1 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- domtestcase.cpp 29 Jan 2005 17:43:45 -0000 1.8
+++ domtestcase.cpp 29 Jan 2005 23:44:54 -0000 1.9
@@ -45,7 +45,7 @@
#define TEST1_1B_PAT "(DEBUG|INFO |WARN |ERROR|FATAL) root - Message [0-9]"
-#define TEST1_2_PAT "^[0-9]{4}-[0-9]{2}-[0-9]{2}
[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} " \
+#define TEST1_2_PAT "^[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}
[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{3\\} " \
"\\[0x[0-9A-F]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message [0-9]"
class DOMTestCase : public CppUnit::TestFixture
1.11 +10 -7 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- xmllayouttestcase.cpp 28 Jan 2005 17:03:38 -0000 1.10
+++ xmllayouttestcase.cpp 29 Jan 2005 23:44:54 -0000 1.11
@@ -27,7 +27,7 @@
#include "../util/xmltimestampfilter.h"
#include "../util/xmllineattributefilter.h"
#include "../util/xmlthreadfilter.h"
-#include "../util/xmlfilenamefilter.h"
+#include "../util/filenamefilter.h"
#include <iostream>
#include <log4cxx/helpers/stringhelper.h>
#include "../testchar.h"
@@ -115,15 +115,18 @@
common();
XMLTimestampFilter xmlTimestampFilter;
- XMLLineAttributeFilter xmlLineAttributeFilter;
XMLThreadFilter xmlThreadFilter;
- XMLFilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
+ FilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
+ Filter line2XX("[23][0-9][0-9]", "X");
+ Filter line5X("53", "X");
std::vector<Filter *> filters;
filters.push_back(&xmlTimestampFilter);
- filters.push_back(&xmlLineAttributeFilter);
+
filters.push_back(&xmlThreadFilter);
filters.push_back(&xmlFilenameFilter);
+ filters.push_back(&line2XX);
+ filters.push_back(&line5X);
try
{
@@ -153,15 +156,15 @@
LOG4CXX_TEST_STR("Message with embedded
<![CDATA[<hello>hi</hello>]]>."));
XMLTimestampFilter xmlTimestampFilter;
- XMLLineAttributeFilter xmlLineAttributeFilter;
XMLThreadFilter xmlThreadFilter;
- XMLFilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
+ FilenameFilter xmlFilenameFilter(__FILE__,
"xmllayouttestcase.cpp");
+ Filter line1xx("1[0-9][0-9]", "X");
std::vector<Filter *> filters;
filters.push_back(&xmlTimestampFilter);
- filters.push_back(&xmlLineAttributeFilter);
filters.push_back(&xmlThreadFilter);
filters.push_back(&xmlFilenameFilter);
+ filters.push_back(&line1xx);
try
{
1.3 +10 -10 logging-log4cxx/tests/witness/patternLayout.8
Index: patternLayout.8
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/witness/patternLayout.8,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- patternLayout.8 4 Feb 2004 00:52:34 -0000 1.2
+++ patternLayout.8 29 Jan 2005 23:44:54 -0000 1.3
@@ -1,10 +1,10 @@
- [main] DEBUG atternLayoutTest - Message 0
- [main] DEBUG root - Message 0
- [main] INFO atternLayoutTest - Message 1
- [main] INFO root - Message 1
- [main] WARN atternLayoutTest - Message 2
- [main] WARN root - Message 2
- [main] ERROR atternLayoutTest - Message 3
- [main] ERROR root - Message 3
- [main] FATAL atternLayoutTest - Message 4
- [main] FATAL root - Message 4
\ No newline at end of file
+[main] DEBUG atternLayoutTest - Message 0
+[main] DEBUG root - Message 0
+[main] INFO atternLayoutTest - Message 1
+[main] INFO root - Message 1
+[main] WARN atternLayoutTest - Message 2
+[main] WARN root - Message 2
+[main] ERROR atternLayoutTest - Message 3
+[main] ERROR root - Message 3
+[main] FATAL atternLayoutTest - Message 4
+[main] FATAL root - Message 4
\ No newline at end of file