See below for error, log4j.properties entries, etc. ClassNotFoundException is thrown in chainsaw when trying to use a default SocketAppender and SimpleListener. Chainsaw v2.0alpha loaded via WebStart on JDK 1.4.2 IE 6 Windows XP SP2, log4j version 1.2.8 Tried reinstall of jdk, jvm and chainsaw Exception thrown: ----------------- Level ERROR Logger org.apache.log4j.net.SocketNode Time 2004-09-11 11:09:18,046 Thread Thread-10 Message Unexpected exception. Closing connection. NDC null Class Method Line File Properties {{log4jid,1}} Throwable java.lang.ClassNotFoundException: org.apache.log4j.spi.LocationInfo at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.io.ObjectInputStream.resolveClass(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.defaultReadObject(Unknown Source) at org.apache.log4j.spi.LoggingEvent.readObject(LoggingEvent.java:848) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.apache.log4j.net.SocketNode.run(SocketNode.java:134) at java.lang.Thread.run(Unknown Source) Properties file: ---------------- # Set root logger level to DEBUG and its appenders to stdout and R. log4j.rootLogger=debug, stdout, R, Socket log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%c\:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=c:/spl_log4j.log log4j.appender.R.MaxFileSize=512KB log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.appender.Socket=org.apache.log4j.net.SocketAppender log4j.appender.Socket.RemoteHost=localhost log4j.appender.Socket.Port=4445 Test class for debugging: ------------------------- public class test { public static void main( String[] args ) { org.apache.log4j.Logger.getLogger("test class").debug("Testing logging"); } } (Class being compiled & run with just log4j in the classpath) (log4j.properties is being read correctly) Output in file that is logged (works as expected) ----------------------------- DEBUG main test class - Testing logging
This would be because of a package reshuffle in the core log4j library. It has been recently resovled. The new web start version uploaded as of 2004-09-13 08:30 GMT+10 should have this fixed.
Doesn't work on the version on the site as of 1600 GMT-8
Working for me... Has your webstart loaded the new version? (sometimes it only checks every other launch).
The version I have (and that installed cleanly for the first time on a virgin system) is 1.99.99 (According to the release notes) I see the error on both machines.
As a workaround, you can take the 'locationinfo' param out of the layout and events should load correctly in Chainsaw.
If I understand correctly, org.apache.log4j.net.SocketAppender doesn't use a layout, right? If so, how do I remove locationInfo?
LocationInfo should be off by default. To explicitly disable, add a locationInfo param to the socketappender config: <param name="LocationInfo" value="false"/>
I have tried setting locationInfo=false and I still see this problem. This is only after webstart updated from the previous version to 2.0alpha
The setting of locationInfo on the appender sets a boolean. Are you using log4j 1.2.8? I've tested and verified that if you using a SocketAppender from log4j1.2.8 you can send events to Chainsaw V2. I was able to reproduce the classnotfoundexception only by explicitly setting the LocationInfo param to true. Setting this param explicitly to false, while unnecessary, resulted in the events successfully getting loaded by Chainsaw V2. Here is a link to the source (this is a link to the 1.2.7 tagged version): http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/net/SocketAppender.java?rev=1.12.2.1&view=markup Note that the locationInfo boolean is used in the 'append' method. If you are not using log4j 1.2.8 on the appender side, give us more information on your configuration and we can reopen.
This is actually a workaround and probably shouldn't be marked as closed without discussing whether or not we want to provide serial backward-compatibility with log4j 1.2.8.
Not only is this a workaround, it's also broken against the current stable release of its parent product. Some testing of the log4j version must be done before this bug can be closed at least until log4j 1.2.8 becomes an archive rather than production / stable release.
As I mentioned, I can use the log4j 1.2.8 SocketAppender to send events to Chainsaw V2 - it is only when I explicitly set the locationInfo parameter to false that I get the error. Would you mind attaching your appender configuration file? I would like to ensure we can at least provide a temporary solution to folks using log4j1.2.8 and SocketAppender with Chainsaw V2 while we work through compatibility issues.
correction of previous entry - I am able to reproduce the problem only when explicitly setting the locationInfo param on SocketAppender to TRUE
The properties file is included in my original report (I'm not yet using XML configuration)
I am having the same problem. I am using log4j1.2.8 on the appender side. Leaving out locationInfo or setting it to false has no affect. The test case supplied with this bug proves it very nicely. It appears that if I remove the stdout conversionPattern property, the locationinfo exception goes away. %L seems to be the offending parameter in the conversion pattern.
Nice work. One easier workaround (since appenders are processed in order), is set the SocketAppender as the first appender - the LocationInfo won't be set until the FileAppender is processed, so the SocketAppender will work fine but not have the LocationInfo: log4j.rootLogger=debug, stdout, Socket, R
Doing this works just fine for me. Thanks for your support guys, and I hope a fix gets added soon!
I just want to let you know that this problem is still active, I've taken the latest chainsaw code (using install-chainsaw.xml) + WebStart, tested with jdk 1.4.2. For SocketAppender I tested with log4j 1.2.8, 1.2.9, 1.3alpha. I had beside the SocketApender an XMLLayot with locationInfo set log4j.appender.fileXMLTARGET.layout=org.apache.log4j.xml.XMLLayout log4j.appender.fileXMLTARGET.layout.LocationInfo=true log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender log4j.appender.CHAINSAW_CLIENT.RemoteHost=127.0.0.1 log4j.appender.CHAINSAW_CLIENT.Port=4445 log4j.appender.CHAINSAW_CLIENT.LocationInfo=false Changing the order (placing fileXMLTARGET after CHAINSAW_CLIENT) solved the problem, any location information before the Appender will generate this exception. As an ideea check where org.apache.log4j.spi.LocationInfo is refered and try to fix it, so it would refer to org.apache.log4j.spi.location.LocationInfo. Thanks for the great job :).
Is this bug still a problem? I have used chainsaw a bit recently and not seen this issue?