Yes, my suggestion is for all wars on the server side, but if the same config file is required on the client side using a FileSerializer(or a StreamSerializer) and a get method is enough to send/request the file (using the same system property to recover the file on the server side) and setup Log4J as needed.
Alejandro -----Original Message----- From: Greg Brown [mailto:[email protected]] Sent: Martes, 22 de Junio de 2010 04:28 p.m. To: [email protected] Subject: Re: Help understanding classpaths/codebase with applets I may be misunderstanding your suggestion, but I think that would only work for code running on the Tomcat server itself. I believe that John is trying to use Log4J on the client as well as the server. On Jun 22, 2010, at 4:23 PM, Alejandro Vilar wrote: > Hi John, > > I'm not sure if this could be helpful for you(Plan A), but to use a unique > configuration file for Log4j in your wars you could set a system property. > If you are booting tomcat from startup.bat script edit catalina.bat script > and put something like this: > > set JAVA_OPTS=%JAVA_OPTS% > -Dlog4j.configuration="path-to-your-configuration-file" > > Or if is running as a service run TOMCAT_PATH/bin/tomca5tw.exe and setup a > system property for your configuration file. > Doing this you can retrieve this property in all your wepApps. > > Note that my suggestion is only for Windows OS, I didn't check it in other > platforms but I guess you could do some similar modifications. > > (http://logging.apache.org/log4j/1.2/manual.html#defaultInit) > > Hope this helps, > Alejandro > > -----Original Message----- > From: JohnRodey [mailto:[email protected]] > Sent: Martes, 22 de Junio de 2010 02:47 p.m. > To: [email protected] > Subject: Help understanding classpaths/codebase with applets > > > So I'm still tryin to get Log4j all setup but keep running into road blocks. > > Now I'm running into issues where my knowledge of applets is lacking and was > hoping I could find some help. > > Plan A) What I would like to do is have one log4j.xml configuration file > stored directly under my tomcat directory (In other words I don't want a > seperate log4j.xml file for each war that I have, I just want them all to > share one config file). However I don't know how to give my applet access > to something thats not in the directory for the applet. > So directory structure like this: > tomcat > ..log4j.xml > ..webapps > ....mypivotapp > ....someotherapp > > Plan B) If I can't do (A) then my startup script can make a copy of the > log4j.xml and put it directly in the mypivotapp directory. Although looks > like by default the applet can't see it there. Looking into the > codebase_lookup property shows that when this is false applets only use the > jars in their classpath. Will enabling this help, documentation says that > there is a performance hit for doing so, which leads me to believe there are > better ways. > > Plan C) My startup script could import my log4j.xml file into my jar file on > my classpath. ex. tomcat/webapps/mypivotapp/lib/mylib.jar > > The goal is to just need to edit one file to alter all logging. > > Thanks! > -- > View this message in context: > http://apache-pivot-users.399431.n3.nabble.com/Help-understanding-classpaths > -codebase-with-applets-tp914940p914940.html > Sent from the Apache Pivot - Users mailing list archive at Nabble.com. >
