Hey Y'all, So here's my little story... We're building a fairly large app Servlet/Applet Our servlet classes all uses log4j with no problems. obviously this couldn't be that perfect so when I tried to do some RMI call to the classes on the Server the Log4J class aren't found. I'm pretty sure that I have a classpath problem, but I have no idea where to set it to get the Deamon to see my log4j.jar. I tried the Env classpath. I tried to put a -classpath on the rmid call. Nothing seems to work and I'm getting pretty desparate. Please somebody heeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp.
you will have to use the socketAppender on ur client side. On the server side you will run a socketserver (e.g. SimpleSocketServer) to listen for the messages logged from the client. And use a file/console appender to log those messages. Since they are in different JVMs they will have diff setups. The socketAppender will send the messages to the server side.
posted 18 years ago
I am using Log4J with my RMI application, where my applet uses RMI to communicate with the server. The applet uses the log4J package, and the server also uses it. I found 2 ways, one was to unjar the log4j.jar, then include it in the .jar for your applet. A better approach was to build the classpath into the manifest of your applet's .jar. Then specify it in your HTML, such as the following Plug-In Object tag: <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"<br /> WIDTH = 612 HEIGHT = 393<br /> codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"> <PARAM NAME = CODE VALUE = spi.client.gui.LicenseeApplet.class > <PARAM NAME="scriptable" VALUE="true"> <PARAM NAME="MAYSCRIPT" VALUE="true"> <PARAM NAME = ARCHIVE VALUE = log4j.jar,licenseApp.jar > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2"> <PARAM NAME="cache_option" VALUE="Plugin"> <PARAM NAME="cache_archive" VALUE="licenseApp.jar, log4j.jar"> ..... This allows my applet to use the log4j classes to log to the client's machine. I also created an RMI class to pass strings from the client to the server, then the server implementation of the class calls the Log4J classes to get the Strings logged. This allows my applet to log to the server's log. Hope that helps.