You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by Jostein Tveit <jo...@pvv.ntnu.no> on 2007/01/16 22:51:13 UTC

XMLLayoutTestCase fails on Solaris

Hello log4cxx developers!

Latest log4cxx from trunk fails unit testing with the error
messages below.

Last time I compiled and tested from trunk (~May 2006) all unit
tests passed.

Do you have any idea why the class and method elements of the XML
are missing? Any recent changes that could possibly affect this
part of log4cxx?

System is Solaris 8 with Sun Studio 11 compiler (32 bit
compilation).

Regards,
Jostein Tveit.

[...]
.....Files [output/filtered.xmlLayout.2] and [witness/xmlLayout.2] differ on line 3
One reads:  [<log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>].
Other reads:[<log4j:locationInfo class="X" method="X" file="xmllayouttestcase.cpp" line="X"/>].
--------------------------------
Contents of output/filtered.xmlLayout.2:
1   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
2   : <log4j:message><![CDATA[in X() constructor]]></log4j:message>
3   : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
4   : </log4j:event>
5   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
6   : <log4j:message><![CDATA[Message 0]]></log4j:message>
7   : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
8   : </log4j:event>
9   : <log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
10  : <log4j:message><![CDATA[Message 0]]></log4j:message>
11  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
12  : </log4j:event>
13  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
14  : <log4j:message><![CDATA[Message 1]]></log4j:message>
15  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
16  : </log4j:event>
17  : <log4j:event logger="root" timestamp="XXX" level="INFO" thread="main">
18  : <log4j:message><![CDATA[Message 1]]></log4j:message>
19  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
20  : </log4j:event>
21  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
22  : <log4j:message><![CDATA[Message 2]]></log4j:message>
23  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
24  : </log4j:event>
25  : <log4j:event logger="root" timestamp="XXX" level="WARN" thread="main">
26  : <log4j:message><![CDATA[Message 2]]></log4j:message>
27  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
28  : </log4j:event>
29  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
30  : <log4j:message><![CDATA[Message 3]]></log4j:message>
31  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
32  : </log4j:event>
33  : <log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
34  : <log4j:message><![CDATA[Message 3]]></log4j:message>
35  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
36  : </log4j:event>
37  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
38  : <log4j:message><![CDATA[Message 4]]></log4j:message>
39  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
40  : </log4j:event>
41  : <log4j:event logger="root" timestamp="XXX" level="FATAL" thread="main">
42  : <log4j:message><![CDATA[Message 4]]></log4j:message>
43  : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
44  : </log4j:event>
--------------------------------
Contents of witness/xmlLayout.2:
1   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
2   : <log4j:message><![CDATA[in X() constructor]]></log4j:message>
3   : <log4j:locationInfo class="X" method="X" file="xmllayouttestcase.cpp" line="X"/>
4   : </log4j:event>
5   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
6   : <log4j:message><![CDATA[Message 0]]></log4j:message>
7   : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
8   : </log4j:event>
9   : <log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
10  : <log4j:message><![CDATA[Message 0]]></log4j:message>
11  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
12  : </log4j:event>
13  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
14  : <log4j:message><![CDATA[Message 1]]></log4j:message>
15  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
16  : </log4j:event>
17  : <log4j:event logger="root" timestamp="XXX" level="INFO" thread="main">
18  : <log4j:message><![CDATA[Message 1]]></log4j:message>
19  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
20  : </log4j:event>
21  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
22  : <log4j:message><![CDATA[Message 2]]></log4j:message>
23  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
24  : </log4j:event>
25  : <log4j:event logger="root" timestamp="XXX" level="WARN" thread="main">
26  : <log4j:message><![CDATA[Message 2]]></log4j:message>
27  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
28  : </log4j:event>
29  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
30  : <log4j:message><![CDATA[Message 3]]></log4j:message>
31  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
32  : </log4j:event>
33  : <log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
34  : <log4j:message><![CDATA[Message 3]]></log4j:message>
35  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
36  : </log4j:event>
37  : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
38  : <log4j:message><![CDATA[Message 4]]></log4j:message>
39  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
40  : </log4j:event>
41  : <log4j:event logger="root" timestamp="XXX" level="FATAL" thread="main">
42  : <log4j:message><![CDATA[Message 4]]></log4j:message>
43  : <log4j:locationInfo class="XMLLayoutTestCase" method="common" file="xmllayouttestcase.cpp" line="X"/>
44  : </log4j:event>
F.Files [output/filtered.xmlLayout.3] and [witness/xmlLayout.3] differ on line 3
One reads:  [<log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>].
Other reads:[<log4j:locationInfo class="XMLLayoutTestCase" method="testCDATA" file="xmllayouttestcase.cpp" line="X"/>].
--------------------------------
Contents of output/filtered.xmlLayout.3:
1   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
2   : <log4j:message><![CDATA[Message with embedded <![CDATA[<hello>hi</hello>]]>]]&gt;<![CDATA[.]]></log4j:message>
3   : <log4j:locationInfo class="" method="" file="xmllayouttestcase.cpp" line="X"/>
4   : </log4j:event>
--------------------------------
Contents of witness/xmlLayout.3:
1   : <log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
2   : <log4j:message><![CDATA[Message with embedded <![CDATA[<hello>hi</hello>]]>]]&gt;<![CDATA[.]]></log4j:message>
3   : <log4j:locationInfo class="XMLLayoutTestCase" method="testCDATA" file="xmllayouttestcase.cpp" line="X"/>
4   : </log4j:event>
F.................................log4cxx: No appender could be found for logger (x).
log4cxx: Please initialize the log4cxx system properly.
............................................


!!!FAILURES!!!
Test Results:
Run:  263   Failures: 2   Errors: 0


1) test: XMLLayoutTestCase::locationInfo (F) line: 150 xml/xmllayouttestcase.cpp
assertion failed
- Expression: Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.2"))


2) test: XMLLayoutTestCase::testCDATA (F) line: 194 xml/xmllayouttestcase.cpp
assertion failed
- Expression: Compare::compare(filteredFile, LOG4CXX_FILE("witness/xmlLayout.3"))


make[1]: *** [run-unittest] Error 1
make[1]: Leaving directory `/opt/home/jtv/test/logging-log4cxx/tests'
make: *** [check-recursive] Error 1


Re: XMLLayoutTestCase fails on Solaris

Posted by Curt Arnold <ca...@apache.org>.
Logged as LOGCXX-169 (https://issues.apache.org/jira/browse/ 
LOGCXX-169) and resolved.  Basically isolated XMLLayoutTestCase from  
the implementation of __LOG4CXX_FUNC__.

I added LOGCXX-170 as a distinct bug which would move the sniffing of  
method name macros to the configure step and add sniffing of __func__  
to the list of potential sources for location info.  If anyone is  
interested in taking a shot, please feel free to attach a patch.

I've set up a Solaris build environment and have been doing a little  
more digging on wchar_t on the platform.  wchar_t on Solaris is  
locale dependent.  It is UTF-32 when the locale uses UTF-8, but can  
vary on other locales.  On Mac's, it is never explicitly defined.   
Currently the lack of a defined transform from wchar_t to UTF-8 is  
reflected by a link failure when attempting to compile log4cxx with  
wchar_t support on those platforms.  While it is less than ideal, the  
only way I see forward is to use wcstombs to convert from wchar_t to  
the current multibyte set and then use apr_xlate to convert from the  
current multibyte set to UTF-8.  If the current multibyte set is  
UTF-8, then last step is redundant.  If it is not, then some wchar_t  
values might not be convertable to the current multibyte set and  
would be replaced with a "?" even though they could be represented in  
UTF-8 if a single step translation was available.

Re: XMLLayoutTestCase fails on Solaris

Posted by Jostein Tveit <jo...@pvv.ntnu.no>.
Curt Arnold <ca...@apache.org> writes:

> The offending code is very likely the tail end of
> include/log4cxx/spi/ location/locationinfo.h.  That fragment
> attempts to detect Microsoft C ++ and use its __FUNCSIG__
> predefined macro or gcc and use its   __PRETTY_FUNCTION__ macro.
> Any other compiler will get blank class  and method names.
> Likely using __func__ in the fallback case would  be better, but
> it would likely give you a mangled name and not a  clearly
> distinguishable class and method name. See
> http://durgaprasad.wordpress.com/2006/11/

Seems like this is the case, yes.

> I don't think the locationinfo.h file has changed in the period
> that  you mentioned, but maybe those tests were enabled since
> then.

That is probably true.

> I'll take a shot at making the code behave okay with __func__
> tomorrow (using gcc as a test bed). 

That would be great. Please update the unit test also.
Thanks in advance.

> I have OpenSolaris (nvd49)
> and  Sun Studio 11 on a VM, but haven't installed Subversion any
> other  tools or gotten a build going yet.  So any hints would be
> appreciated.

On my Solaris 8 SPARC I had to install the following packages to
get Subversion working, but this may of course differ from your
system:
db-4.2.52.NC-sol8-sparc-local
gdbm-1.8.3-sol8-sparc-local
libiconv-1.8-sol8-sparc-local
openssl-0.9.8a-sol8-sparc-local
expat-1.95.5-sol8-sparc-local
libgcc-3.3-sol8-sparc-local
libxml2-2.6.16-sol8-sparc-local
subversion-1.2.3-sol8-sparc-local

Regarding the compilation on Solaris 8, the following HOWTO still
works. (Skip step 1).
<URL: http://article.gmane.org/gmane.comp.apache.logging.log4cxx.user/1271 >

-- 
Jostein Tveit <jo...@pvv.ntnu.no>

Re: XMLLayoutTestCase fails on Solaris

Posted by Curt Arnold <ca...@apache.org>.
On Jan 16, 2007, at 3:51 PM, Jostein Tveit wrote:

> Hello log4cxx developers!
>
> Latest log4cxx from trunk fails unit testing with the error
> messages below.
>
> Last time I compiled and tested from trunk (~May 2006) all unit
> tests passed.
>
> Do you have any idea why the class and method elements of the XML
> are missing? Any recent changes that could possibly affect this
> part of log4cxx?
>
> System is Solaris 8 with Sun Studio 11 compiler (32 bit
> compilation).
>
> Regards,
> Jostein Tveit.
>

The offending code is very likely the tail end of include/log4cxx/spi/ 
location/locationinfo.h.  That fragment attempts to detect Microsoft C 
++ and use its __FUNCSIG__ predefined macro or gcc and use its   
__PRETTY_FUNCTION__ macro.  Any other compiler will get blank class  
and method names.  Likely using __func__ in the fallback case would  
be better, but it would likely give you a mangled name and not a  
clearly distinguishable class and method name.  See http:// 
durgaprasad.wordpress.com/2006/11/

I don't think the locationinfo.h file has changed in the period that  
you mentioned, but maybe those tests were enabled since then.

I'll take a shot at making the code behave okay with __func__  
tomorrow (using gcc as a test bed).  I have OpenSolaris (nvd49) and  
Sun Studio 11 on a VM, but haven't installed Subversion any other  
tools or gotten a build going yet.  So any hints would be appreciated.