Search in archives did not reveal anything on the issue.
in my case log4j is configured with XMLLayout and Debug level. i have a service implementation that throws an exception. test case could be as simple as
public String[] getItems() throws RemoteException {
logger.info("Entering getItems.");
throw new RemoteException( "test");
//return itemList;
}when log.xml file is open chainsaw complains that log.xml is malformed and log.xml file looks rather strange. it turned out that format method of XmlLayout is not reenterable and could not be used recursively. however when AxisFault is logged format method used recursively to trace how logging is done. Commons Logging maps trace to log4j debug so recursion happens with debug enabled.
it looks that recursion is only one level deep. and quick look at the code of other layouts shows that they could have similar problem. i have found two workarounds with different tradeoffs.
1. use different appender for org.apache.axis.EXCEPTIONS; see sample log4j.properties file at the end of this message.
2. modify AxisFault and AxisServlet classes to get rid of recursive calls to log4j, just rearrange the order of statements and cache one expression, probably modification is needed in classes other than AxisServlet when transport is other than http like in org.apache.axis.transport.mail.MailWorker class.
in the first case you need to remember to use different appender for exceptions, but no changes in Axis.
in the second case modification in Axis code are needed but no changes in log4j.properties are required. i will submit a patch.
all this was for log4j 1.2.8, then i co latest cvs version and discovered that there is log4j 1.3 with significant changes. in the 1.3 code there is a check if the call is recursive, and if it is recursive - do nothing. when i run Axis with log4j 1.3 the recursive logs were ignored, there were no corrupted messages anymore but some messages were lost. workarounds described above worked for log4j 1.3 too.
oleg
============================================
log4j.properties file
================================================
log4j.debug=true
log4j.rootLogger=DEBUG, A1 log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.File=c:/log/log4jLogServer.xml log4j.appender.A1.layout=org.apache.log4j.xml.XMLLayout
!--------------------org.apache.axis.EXCEPTIONS logger with differen appender-----------!
log4j.logger.org.apache.axis.EXCEPTIONS=DEBUG, EXCEPT
log4j.appender.EXCEPT=org.apache.log4j.RollingFileAppender
log4j.appender.EXCEPT.File=c:/log/log4jException.xml
log4j.appender.EXCEPT.layout=org.apache.log4j.xml.XMLLayout
