You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by "Wilfong, Paul" <pa...@ngc.com> on 2007/09/07 01:30:45 UTC
Segmentation Fault problem using XMLSocketAppender under Linux & Solaris
Hi,
I am getting a segmentation fault when trying to set up for output to a
XMLSocketAppender.
This problem does not occur using Windows. But it does occur using both
Solaris (version 5) and Redhat Linux. I am using log4cxx 0.10.0 which I
got from the overnight build web-site.
I used the autogen/configure/make/makeinstall approach to build. I
first built and installed the apr stuff (apr 1.2.9 and apr-util 1.2.8).
Here is my properties file...
----------------------------------------------------------------
# Set DEBUG
log4j.debug=DEBUG
log4j.rootCategory=DEBUG, CONSOLE1, SOCKET1
# CONSOLE1
log4j.appender.CONSOLE1=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE1.layout=org.apache.log4j.TTCCLayout
# SOCKET1
# Writes to a port. If another application is reading from the port, it
should see the
# log messages coming in.
log4j.appender.SOCKET1=org.apache.log4j.net.XMLSocketAppender
log4j.appender.SOCKET1.remoteHost=10.10.52.99
#log4j.appender.SOCKET1.remoteHost=127.0.0.1
log4j.appender.SOCKET1.port=7776
log4j.appender.SOCKET1.locationInfo=true
------------------------------------------------------------------
I did some investigation on the Solaris machine. I added a debug line
in routine setProperty, after the setOption call, as follows:
------------------------------------------------------------------
void PropertySetter::setProperty(const LogString& option,
const LogString& value,
Pool&)
{
if (value.empty())
return;
if (obj->instanceof(OptionHandler::getStaticClass()))
{
LogLog::debug(LOG4CXX_STR("Setting option name=[") +
option + LOG4CXX_STR("], value=[") + value +
LOG4CXX_STR("]"));
OptionHandlerPtr(obj)->setOption(option, value);
LogLog::debug(LOG4CXX_STR("set option done, returning from
propertysetter...") ); //added this line...
}
}
---------------------------------------------------------------------
If I set the remoteHost value to 10.10.52.99 (the IP of one of our PCs),
here is the output...
---------------------------------------------------------------------
...
log4cxx: Parsing for [root] with value=[DEBUG, CONSOLE1, SOCKET1].
log4cxx: Level token is [DEBUG].
log4cxx: OptionConverter::toLevel: no class name specified,
level=[DEBUG]
log4cxx: Logger root set to DEBUG
log4cxx: Parsing appender named
CONSOLE1".
log4cxx: Parsing layout options for "CONSOLE1".
log4cxx: End of parsing for "CONSOLE1".
log4cxx: Parsed "CONSOLE1" options.
log4cxx: Parsing appender named
SOCKET1".
log4cxx: Setting option name=[locationInfo], value=[true]
log4cxx: set option done, returning from propertysetter...
log4cxx: Setting option name=[port], value=[7776]
log4cxx: set option done, returning from propertysetter...
log4cxx: Setting option name=[remoteHost], value=[10.10.52.99]
Segmentation Fault (core dumped)
------------------------------------------------------------------------
----
So my debug line doesn't get executed after the remoteHost set.
If I set remoteHost in the properties file to 127.0.0.1 (localhost),
however, things work as I expect, as the following output shows...
------------------------------------------------------------------------
----
...
log4cxx: Parsing for [root] with value=[DEBUG, CONSOLE1, SOCKET1].
log4cxx: Level token is [DEBUG].
log4cxx: OptionConverter::toLevel: no class name specified,
level=[DEBUG]
log4cxx: Logger root set to DEBUG
log4cxx: Parsing appender named
CONSOLE1".
log4cxx: Parsing layout options for "CONSOLE1".
log4cxx: End of parsing for "CONSOLE1".
log4cxx: Parsed "CONSOLE1" options.
log4cxx: Parsing appender named
SOCKET1".
log4cxx: Setting option name=[locationInfo], value=[true]
log4cxx: set option done, returning from propertysetter...
log4cxx: Setting option name=[port], value=[7776]
log4cxx: set option done, returning from propertysetter...
log4cxx: Setting option name=[remoteHost], value=[127.0.0.1]
log4cxx: set option done, returning from propertysetter...
log4cxx: Entering Socketappenderskeleton --- Note - This is another
debug line I added in one of the other log4cxx routines...
log4cxx: closing socket
log4cxx: Could not connect to remote log4cxx server at [localhost]. We
will try again later.
...
------------------------------------------------------------------------
-
I am going to try to drill down further but I am not a C++ expert so
putting debug into the setOption call is going to be harder for me to
figure out how to do.
Any advice would be appreciated.
RE: Segmentation Fault problem using XMLSocketAppender under Linux & Solaris
Posted by "Wilfong, Paul" <pa...@ngc.com>.
Applying the patch indicated (to the inetaddress.cpp file only) fixed
the original segment fault problem, on all three platforms.
------------------------------------------------------------------------
----------
On Thursday, September 06, 2007 4:31 PM Paul Wilfong wrote:
>>> I am getting a segmentation fault when trying to set up for output
to an XMLSocketAppender.
After investigating this, it appears to be caused by trying to use a
remote host that is unreachable.
I believe it is directly related to a recent bug report (LOGCXX-191):
https://issues.apache.org/jira/browse/LOGCXX-191
A patch for this problem is provided in the LOGCXX_191 bug report, for
files inetaddress.cpp and syslogwriter.cpp.
RE: Segmentation Fault problem using XMLSocketAppender under Linux & Solaris
Posted by "Wilfong, Paul" <pa...@ngc.com>.
On Thursday, September 06, 2007 4:31 PM Paul Wilfong wrote:
>>> I am getting a segmentation fault when trying to set up for output
to an XMLSocketAppender.
After investigating this, it appears to be caused by trying to use a
remote host that is unreachable.
I believe it is directly related to a recent bug report (LOGCXX-191):
https://issues.apache.org/jira/browse/LOGCXX-191
A patch for this problem is provided in the LOGCXX_191 bug report, for
files inetaddress.cpp and syslogwriter.cpp.