Closed MehdiChinoune closed 4 months ago
Coul you please post versions of mingw environments and compilers you have tested this PR with?
Coul you please post versions of mingw environments and compilers you have tested this PR with?
UCRT64: GCC 14.1.0 + Binutils 2.42 CLANG64: Clang 18.1.8
CMake: 3.30.0 Ninja: 1.12.1
APR 1.7.4 APR-UTIL 1.6.3 FMT 10.2.1 Qt5: 5.15.14
Tests: 61/64
Tests: 61/64
Could you post output of the tests that are failing?
Could you post output of the tests that are failing?
$ ctest --output-on-failure
Test project D:/dev/build
Start 1: autoconfiguretestcase
1/64 Test #1: autoconfiguretestcase ............... Passed 3.55 sec
Start 2: asyncappendertestcase
2/64 Test #2: asyncappendertestcase ...............Exit code 0xc0000374
***Exception: 3.38 sec
LC_CTYPE: Arabic_Saudi Arabia.1256
asyncappendertestcase.:
testDefaultThreshold
testSetOptionThreshold
closeTest
log4cxx: Attempted to append to closed appender named [async-CloseTest].
test2
log4cxx: Attempted to append to closed appender named [async-test2].
testEventFlush
log4cxx: Attempted to append to closed appender named [async-testEventFlush].
testMultiThread
Start 3: consoleappendertestcase
3/64 Test #3: consoleappendertestcase ............. Passed 0.03 sec
Start 4: decodingtest
4/64 Test #4: decodingtest ........................ Passed 0.03 sec
Start 5: encodingtest
5/64 Test #5: encodingtest ........................ Passed 0.04 sec
Start 6: fileappendertest
6/64 Test #6: fileappendertest .................... Passed 0.03 sec
Start 7: filetestcase
7/64 Test #7: filetestcase ........................ Passed 0.03 sec
Start 8: hexdumptestcase
8/64 Test #8: hexdumptestcase ..................... Passed 0.03 sec
Start 9: hierarchytest
9/64 Test #9: hierarchytest ....................... Passed 0.03 sec
Start 10: hierarchythresholdtestcase
10/64 Test #10: hierarchythresholdtestcase .......... Passed 0.05 sec
Start 11: jsonlayouttest
11/64 Test #11: jsonlayouttest ...................... Passed 0.03 sec
Start 12: l7dtestcase
12/64 Test #12: l7dtestcase ......................... Passed 0.04 sec
Start 13: leveltestcase
13/64 Test #13: leveltestcase ....................... Passed 0.03 sec
Start 14: levelchangetestcase
14/64 Test #14: levelchangetestcase ................. Passed 0.03 sec
Start 15: loggertestcase
15/64 Test #15: loggertestcase ...................... Passed 0.04 sec
Start 16: mdctestcase
16/64 Test #16: mdctestcase ......................... Passed 0.03 sec
Start 17: minimumtestcase
17/64 Test #17: minimumtestcase ..................... Passed 0.03 sec
Start 18: ndctestcase
18/64 Test #18: ndctestcase ......................... Passed 0.03 sec
Start 19: patternlayouttest
19/64 Test #19: patternlayouttest ...................***Failed 1.00 sec
LC_CTYPE: Arabic_Saudi Arabia.1256
patternlayouttest.:
test1
test2
test3
test4
test5
test6
test7
test8
test9
test10
test11
test12
test13
test14
Line 439: Compare::compare(TEMP, LOG4CXX_FILE("witness/patternLayout.14")) was expected to be true, was false.
Files [output/patternlayout] and [witness/patternLayout.14] differ on line 1
One reads: [DEBUG D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 0].
Other reads:[DEBUG patternlayouttest.cpp: Message 0].
--------------------------------
Contents of output/patternlayout:
1 : DEBUG D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 0
2 : DEBUG D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 0
3 : INFO D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 1
4 : INFO D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 1
5 : WARN D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 2
6 : WARN D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 2
7 : ERROR D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 3
8 : ERROR D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 3
9 : FATAL D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 4
10 : FATAL D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 4
--------------------------------
Contents of witness/patternLayout.14:
1 : DEBUG patternlayouttest.cpp: Message 0
2 : DEBUG patternlayouttest.cpp: Message 0
3 : INFO patternlayouttest.cpp: Message 1
4 : INFO patternlayouttest.cpp: Message 1
5 : WARN patternlayouttest.cpp: Message 2
6 : WARN patternlayouttest.cpp: Message 2
7 : ERROR patternlayouttest.cpp: Message 3
8 : ERROR patternlayouttest.cpp: Message 3
9 : FATAL patternlayouttest.cpp: Message 4
10 : FATAL patternlayouttest.cpp: Message 4
testMDC1
testMDC2
FAILED 1 of 16
Failed Tests Total Fail Failed %
=======================================================================
patternlayouttest. 16 1 6.25%
test14
Start 20: propertyconfiguratortest
20/64 Test #20: propertyconfiguratortest ............ Passed 0.02 sec
Start 21: rollingfileappendertestcase
21/64 Test #21: rollingfileappendertestcase ......... Passed 0.03 sec
Start 22: streamtestcase
22/64 Test #22: streamtestcase ...................... Passed 0.04 sec
Start 23: locationtest
23/64 Test #23: locationtest ........................***Failed 0.03 sec
LC_CTYPE: Arabic_Saudi Arabia.1256
locationtest.:
test1
Line 53: Compare::compare(LOG4CXX_STR("output/location-good-test"), LOG4CXX_FILE("witness/location1-good")) was expected to be true, wa
s false.
Files [output/location-good-test] and [witness/location1-good] differ on line 1
One reads: [DEBUG(D:/dev/logging-log4cxx/src/test/cpp/locationtest.cpp) - Message -1].
Other reads:[DEBUG(locationtest.cpp) - Message -1].
--------------------------------
Contents of output/location-good-test:
1 : DEBUG(D:/dev/logging-log4cxx/src/test/cpp/locationtest.cpp) - Message -1
--------------------------------
Contents of witness/location1-good:
1 : DEBUG(locationtest.cpp) - Message -1
FAILED 1 of 1
Failed Tests Total Fail Failed %
=======================================================================
locationtest. 1 1 100.00%
test1
Start 24: locationdisabledtest
24/64 Test #24: locationdisabledtest ................ Passed 0.02 sec
Start 25: terminationtestcase
25/64 Test #25: terminationtestcase ................. Passed 0.06 sec
Start 26: fmttest
26/64 Test #26: fmttest ............................. Passed 0.12 sec
Start 27: absolutetimedateformattestcase
27/64 Test #27: absolutetimedateformattestcase ...... Passed 0.03 sec
Start 28: cacheddateformattestcase
28/64 Test #28: cacheddateformattestcase ............ Passed 0.03 sec
Start 29: casttestcase
29/64 Test #29: casttestcase ........................ Passed 0.03 sec
Start 30: charsetdecodertestcase
30/64 Test #30: charsetdecodertestcase .............. Passed 0.03 sec
Start 31: charsetencodertestcase
31/64 Test #31: charsetencodertestcase .............. Passed 0.20 sec
Start 32: cyclicbuffertestcase
32/64 Test #32: cyclicbuffertestcase ................ Passed 0.06 sec
Start 33: datetimedateformattestcase
33/64 Test #33: datetimedateformattestcase .......... Passed 0.04 sec
Start 34: filewatchdogtest
34/64 Test #34: filewatchdogtest .................... Passed 0.08 sec
Start 35: inetaddresstestcase
35/64 Test #35: inetaddresstestcase ................. Passed 4.71 sec
Start 36: iso8601dateformattestcase
36/64 Test #36: iso8601dateformattestcase ........... Passed 0.02 sec
Start 37: messagebuffertest
37/64 Test #37: messagebuffertest ................... Passed 0.02 sec
Start 38: optionconvertertestcase
38/64 Test #38: optionconvertertestcase ............. Passed 0.03 sec
Start 39: propertiestestcase
39/64 Test #39: propertiestestcase .................. Passed 0.03 sec
Start 40: relativetimedateformattestcase
40/64 Test #40: relativetimedateformattestcase ...... Passed 0.03 sec
Start 41: stringhelpertestcase
41/64 Test #41: stringhelpertestcase ................ Passed 0.02 sec
Start 42: stringtokenizertestcase
42/64 Test #42: stringtokenizertestcase ............. Passed 0.02 sec
Start 43: timezonetestcase
43/64 Test #43: timezonetestcase .................... Passed 0.02 sec
Start 44: transcodertestcase
44/64 Test #44: transcodertestcase .................. Passed 0.02 sec
Start 45: threadutilitytestcase
45/64 Test #45: threadutilitytestcase ............... Passed 0.03 sec
Start 46: syslogwritertest
46/64 Test #46: syslogwritertest .................... Passed 0.50 sec
Start 47: xloggertestcase
47/64 Test #47: xloggertestcase ..................... Passed 0.05 sec
Start 48: xmltests
48/64 Test #48: xmltests ............................ Passed 0.71 sec
Start 49: defaultinittestcase
49/64 Test #49: defaultinittestcase ................. Passed 0.03 sec
Start 50: filtertests
50/64 Test #50: filtertests ......................... Passed 0.02 sec
Start 51: syslogappendertestcase
51/64 Test #51: syslogappendertestcase .............. Passed 0.02 sec
Start 52: telnetappendertestcase
52/64 Test #52: telnetappendertestcase ..............***Timeout 120.04 sec
LC_CTYPE: Arabic_Saudi Arabia.1256
telnetappendertestcase.:
testDefaultThreshold
testSetOptionThreshold
testActivateClose
testActivateSleepClose
testActivateWriteClose
testActivateWriteNoClose
SUCCESS
Start 53: xmlsocketappendertestcase
53/64 Test #53: xmlsocketappendertestcase ........... Passed 0.03 sec
Start 54: eventlogtests
54/64 Test #54: eventlogtests ....................... Passed 0.03 sec
Start 55: patternparsertestcase
55/64 Test #55: patternparsertestcase ............... Passed 0.03 sec
Start 56: filenamepatterntestcase
56/64 Test #56: filenamepatterntestcase ............. Passed 0.03 sec
Start 57: filterbasedrollingtest
57/64 Test #57: filterbasedrollingtest .............. Passed 0.07 sec
Start 58: manualrollingtest
58/64 Test #58: manualrollingtest ................... Passed 0.25 sec
Start 59: sizebasedrollingtest
59/64 Test #59: sizebasedrollingtest ................ Passed 0.49 sec
Start 60: timebasedrollingtest
60/64 Test #60: timebasedrollingtest ................ Passed 0.84 sec
Start 61: rollingfileappenderpropertiestest
61/64 Test #61: rollingfileappenderpropertiestest ... Passed 11.05 sec
Start 62: errorhandlertestcase
62/64 Test #62: errorhandlertestcase ................ Passed 0.29 sec
Start 63: levelmatchfiltertestcase
63/64 Test #63: levelmatchfiltertestcase ............ Passed 0.04 sec
Start 64: levelrangefiltertestcase
64/64 Test #64: levelrangefiltertestcase ............ Passed 0.03 sec
94% tests passed, 4 tests failed out of 64
Total Test time (real) = 149.03 sec
The following tests FAILED:
2 - asyncappendertestcase (Exit code 0xc0000374
)
19 - patternlayouttest (Failed)
23 - locationtest (Failed)
52 - telnetappendertestcase (Timeout)
Errors while running CTest
Line 439: Compare::compare(TEMP, LOG4CXX_FILE("witness/patternLayout.14")) was expected to be true, was false. Files [output/patternlayout] and [witness/patternLayout.14] differ on line 1 One reads: [DEBUG D:/dev/logging-log4cxx/src/test/cpp/patternlayouttest.cpp: Message 0]. Other reads:[DEBUG patternlayouttest.cpp: Message 0].
Could you also change locationinfo.h
The following tests FAILED: 2 - asyncappendertestcase (Exit code 0xc0000374
With the following change to add some debug statements:
diff --git a/src/test/cpp/asyncappendertestcase.cpp b/src/test/cpp/asyncappendertestcase.cpp index 0b6cf794..5ee0e667 100644 --- a/src/test/cpp/asyncappendertestcase.cpp +++ b/src/test/cpp/asyncappendertestcase.cpp @@ -246,23 +246,35 @@ class AsyncAppenderTestCase : public AppenderSkeletonTestCase std::vector<std::thread> threads; for ( int x = 0; x < threadCount; x++ ) { - std::thread thr([root, LEN]() + threads.emplace_back([root, LEN]() { + std::stringstream ss; + ss << std::this_thread::get_id(); + LOG4CXX_ENCODE_CHAR(msg1, "Starting thread " + ss.str()); + helpers::LogLog::debug(msg1); for (size_t i = 0; i < LEN; i++) { LOG4CXX_DEBUG(root, "message" << i); } + LOG4CXX_ENCODE_CHAR(msg2, "Finished thread " + ss.str()); + helpers::LogLog::debug(msg2); }); - threads.push_back( std::move(thr) ); }
for ( auto& thr : threads )
{
helpers::LogLog::debug(LOG4CXX_STR("Closing asyncAppender")); asyncAppender->close();
const std::vector<spi::LoggingEventPtr>& v = vectorAppender->getVector();
The following stack trace suggests there is a bug in the ucrt64 runtime:
steph@WEBB-HOME-LAPTOP UCRT64 ~/logging-log4cxx/build $ LOG4CXX_DEBUG=true gdb ./src/test/cpp/asyncappendertestcase.exe GNU gdb (GDB) 15.1 Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-w64-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./src/test/cpp/asyncappendertestcase.exe... (gdb) r -v Starting program: C:\msys64\home\steph\logging-log4cxx\build\src\test\cpp\asyncappendertestcase.exe -v [New Thread 23488.0x5a88] [New Thread 23488.0x12a0] [New Thread 23488.0x6700] LC_CTYPE: English_Australia.utf8 asyncappendertestcase.:
log4cxx: Starting thre[New Thread 23488.0x6068] ad 6 log4cxx: Waiting for thread 5 log4cxx: Starting thread 7 log4cxx: Starting thread 8 log4cxx: Starting thread 9 log4cxx: Starting thread 10 log4cxx: Finished thread 9 log4warning: Critical error detected c0000374 c Thread 12 received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 23488.0x6c70] 0x00007ff8b253c883 in ntdll!RtlIsZeroMemory () from C:\WINDOWS\SYSTEM32\ntdll.dll (gdb) thread apply all backtrace
Thread 14 (Thread 23488.0x6068):
Thread 13 (Thread 23488.0xe4c):
--Type
Thread 12 (Thread 23488.0x6c70):
Thread 11 (Thread 23488.0x59e8):
Thread 10 (Thread 23488.0x6060):
Thread 9 (Thread 23488.0x11f0):
Thread 8 (Thread 23488.0xf20):
Thread 4 (Thread 23488.0x6700):
Thread 3 (Thread 23488.0x12a0):
Thread 2 (Thread 23488.0x5a88):
Thread 1 (Thread 23488.0x617c):
(gdb)
UCRT runtime comes from Windows OS, We could do nothing about. Could we keep this PR about "Fix building" instead of "Fix running"?
Also MinGW apps are native Windows and shouldn't have any issue with \
used in paths.
Also MinGW apps are native Windows and shouldn't have any issue with \ used in paths.
I believe locationinfo.h needs to set LOG4CXX_SHORT_FILENAME_SPLIT_CHAR based on the compiler, not the system
The following change fixes patternlayouttest
failure
diff --git a/src/main/include/log4cxx/spi/location/locationinfo.h b/src/main/include/log4cxx/spi/location/locationinfo.h
index 3b68d531..c4af54e4 100644
--- a/src/main/include/log4cxx/spi/location/locationinfo.h
+++ b/src/main/include/log4cxx/spi/location/locationinfo.h
@@ -22,7 +22,7 @@
#include <string>
#include <string.h>
-#if defined(_WIN32)
+#if defined(_MSC_VER)
#define LOG4CXX_SHORT_FILENAME_SPLIT_CHAR '\\'
#else
#define LOG4CXX_SHORT_FILENAME_SPLIT_CHAR '/'
Before using gdb, you need to ensure the directory contain log4cxx.dll is named on the path. For example,
�
export PATH=/home/steph/logging-log4cxx/buildsrc/main/cpp:$PATH
�
�
From: مهدي شينون (Mehdi Chinoune) @.> Sent: Friday, July 12, 2024 11:24 PM To: apache/logging-log4cxx @.> Cc: Stephen Webb @.>; Mention @.> Subject: Re: [apache/logging-log4cxx] Fix building with mingw-w64-gcc (PR #389)
�
@swebb2066 https://github.com/swebb2066 What did you to debug. I built it with CMAKE_BUILD_TYPE=Debug with no luck!
— Reply to this email directly, view it on GitHub https://github.com/apache/logging-log4cxx/pull/389#issuecomment-2225583980 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJDRC3LQBDBUMCH23J7V4LZL7KF7AVCNFSM6AAAAABKTCSG3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRVGU4DGOJYGA . You are receiving this because you were mentioned.Message ID: @.***>
-- This email has been checked for viruses by Avast antivirus software. www.avast.com
The following tests FAILED: 52 - telnetappendertestcase (Timeout)
When telnet appender is not explictly closed, the onexit processing chain does not terminate.
The following change will at least fix the test.
diff --git a/src/test/cpp/net/telnetappendertestcase.cpp b/src/test/cpp/net/telnetappendertestcase.cpp
index b7aebbe5..1268c227 100644
--- a/src/test/cpp/net/telnetappendertestcase.cpp
+++ b/src/test/cpp/net/telnetappendertestcase.cpp
@@ -118,6 +118,7 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
#endif
LOG4CXX_INFO(root, "Hello, World " << i);
}
+ appender->close();
}
};
Fixes #388