I'm not too familiar with Commons, but I'm sure there is some way to force the property setting before it initializes (mind you, I have tried initializing the parameter in a static initializer block in Turbine.java, which I hoped would catch it, but it doesn't)
Brad -----Original Message----- From: Eric Pugh [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 5:49 AM To: 'Turbine Users List' Subject: RE: log4j DEBUG output at Turbine 2.3 startup Is there a better way by changing the code in Turbine.java? Eric > -----Original Message----- > From: Folkens, Brad [mailto:[EMAIL PROTECTED] > Sent: Monday, November 10, 2003 7:24 PM > To: 'Turbine Users List' > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > To all the followers of the "logging" problem: > > Found some insight into this... > > Apparently there are several lines of code that attempt to set the > System property for log4j to the following in the configure() method: > > org.apache.commons.logging.LogFactory=org.apache.commons.loggi > ng.impl.Lo > g4jF > actory > > Lines approx: 266-270 > // > // Set up Commons Logging to use the Log4J Logging // > System.getProperties().setProperty(LogFactory.class.getName(), > Log4jFactory.class.getName()); > > This does not work and LogFactory uses the SimpleLogger instead, > piping all INFO and above logging statements to the console. I've > tried to relocate the code to a static initializer block and that does > not work either. > > The best workaround I've found so far, if using Tomcat (translate > these directions for other containers), is to add the following to the > JAVA_OPTS environment variable: > -Dorg.apache.commons.logging.LogFactory=org.apache.commons.log > ging.impl. > Log4 > jFactory > > And make sure the Log4J libraries are in the "common" directory for > Tomcat. > > Keep me posted - I hope this helps those frustrated commons-turbine > users out there :) > > Brad Folkens > [EMAIL PROTECTED] > > -----Original Message----- > From: Eric Pugh [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 29, 2003 10:51 AM > To: 'Turbine Users List' > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > Also, if you are digging through the source.. anywhere a debug > happens we should have the check to see if debugging is on or off as > well! > > > -----Original Message----- > > From: Folkens, Brad [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 29, 2003 5:29 PM > > To: 'Turbine Users List' > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > Eric (and David) (and anyone else who's been following this thread), > > > > I'm actually having more issues with logging now, it seems like the > > configuration isn't getting picked up correctly every single time > > (before / after init or re-init). i.e., that patch I > submitted just > > all of a sudden > > "stopped" working right - lol... I'm going to study the > code to see > > what > > the developers intend and see what it is with our configuration that > > is making it behave so unusually. > > > > I've got this all setup in eclipse too and yes, I have noticed the > > deprecation warnings. > > > > I'll continue to look into this issue - the DEBUG messages > coming out > > of our > > app are slowing our production app way down. > > > > If anyone has any other insight into this issue - let me know ;) > > > > Brad > > > > -----Original Message----- > > From: Eric Pugh [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 29, 2003 10:30 AM > > To: 'Turbine Users List' > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > Brad, > > > > Why would the log be null in that destroy test? And, while you are > > digging into it, figure out what we should be using for > > commons-logging, I know that eclipse mentions that the Log4jFactory > > (sp?) is > deprecated.. It would > > be > > nice to apply a single patch that fixes the logging > problem, and gets > > rid of > > the deprecated class. > > > > I think we are supposed to set some sort of system property or > > something, but I'm not a logging guru. If you can submit a > patch that > > > would be great > > that fixes the deprecated class as well as whatever is > needed for the > > DestroyTest, that would be great. > > > > Eric > > > > > -----Original Message----- > > > From: Folkens, Brad [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, October 29, 2003 3:39 PM > > > To: 'Turbine Users List' > > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > I think I got it figured out - not sure how the Turbine > developers > > > want to fix this, but this is how I got it to work. I basically > > > changed the Log variable from statically initialized to non-static > > > - and then I initialized it after the config(...,...) call. Also, > > > there was one static reference in it, so I just initialized that > > > separately. > > > > > > See below... > > > > > > > > > > > > Index: Turbine.java > > > > =================================================================== > > > RCS file: > > > /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/ > > > Turbine.ja > > > va,v > > > retrieving revision 1.45 > > > diff -u -r1.45 Turbine.java > > > --- Turbine.java 2 Jul 2003 16:52:24 -0000 1.45 > > > +++ Turbine.java 29 Oct 2003 14:43:12 -0000 > > > @@ -197,7 +197,7 @@ > > > private RunDataService rundataService = null; > > > > > > /** Logging class from commons.logging */ > > > - private static Log log = LogFactory.getLog(Turbine.class); > > > + private Log log = null; > > > > > > /** > > > * This init method will load the default resources > from a @@ > > > -228,6 +228,7 @@ > > > ServletContext context = > > config.getServletContext(); > > > > > > configure(config, context); > > > + log = LogFactory.getLog(Turbine.class); > > > > > > templateService = TurbineTemplate.getService(); > > > rundataService = > TurbineRunDataFacade.getService(); > > > @@ -600,6 +601,7 @@ > > > { > > > if(serverData == null) > > > { > > > + Log log = LogFactory.getLog(Turbine.class); > > > log.error("ServerData Information requested > > from Turbine > > > before first request!"); > > > // Will be overwritten once the first request is run; > > > serverData = new ServerData(null, > > > URIConstants.HTTP_PORT, > > > > > > > > > > > > > > > > > > -----Original Message----- > > > From: David Wynter [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, October 28, 2003 5:10 PM > > > To: Turbine Users List > > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > Made no difference doing the LogFactory call first a > > followed by the > > > PropertyConfigurator call. Very frustrating as I have > seperate logs > > > for my app and the quartz scheduler, cannot find a thing > in the logs > > > > as the quartz > > > scheduler spews out stuff all the time. > > > > > > David > > > > > > > -----Original Message----- > > > > From: David Wynter [mailto:[EMAIL PROTECTED] > > > > Sent: 28 October 2003 23:00 > > > > To: Turbine Users List > > > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > > > > I just noticed something. The examples for log4j have the > > > LogFactory > > > > call before the PropertyConfigurator call. Turbine.java > > has it the > > > > other way around. For some reason maven fails to build the > > > T2.3 I have > > > > > > > source for so if I can work out how to build it without > > maven I'll > > > > swap them around and try it out, tomorrow now, too late now. > > > > > > > > David > > > > > > > > > -----Original Message----- > > > > > From: Folkens, Brad [mailto:[EMAIL PROTECTED] > > > > > Sent: 28 October 2003 22:40 > > > > > To: 'Turbine Users List' > > > > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > > > > > > > David, > > > > > > > > > > Yeah - weird problem huh? > > > > > > > > > > What I meant by reloading is - I use tomcat in standalone for > > > > development > > > > > (and then eclipse for all the coding, compiling, etc). > > So tomcat > > > > > runs separately, basically. When I "reload" the web-app > > > in tomcat > > > > > using the admin tools provided with it, all the messages > > > get logged > > > > correctly. The > > > > > first time I start tomcat though, nothing works right. > > > > > > > > > > What's weird is that this happens in Caucho's Resin > > container as > > > > > well. So I know it must have something to do with Turbine. > > > > > > > > > > (BTW - It took me a while to actually get it to read the > > > > log4j.properties > > > > > file as well, just make sure all your paths are set > > > correctly, and > > > > > you have the right tags in your web.xml file if you're using > > > > > relative > > > > paths for the > > > > > logs (I think it reads the application directory out > of that) - > > > > Turbine is > > > > > good about giving you messages if the file is read > > > correctly, etc, > > > > > so see if those messages are getting displayed on the > console or > > > > > wherever.) > > > > > > > > > > Brad > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: David Wynter [mailto:[EMAIL PROTECTED] > > > > > Sent: Tuesday, October 28, 2003 4:41 PM > > > > > To: Turbine Users List > > > > > Subject: RE: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > > > > > > > Hi Brad, > > > > > > > > > > I am glad you posted this because it shows I am not > > going mad. I > > > > > experience the same problem, except I have not got it to > > > every read > > > > > the log4j.properties. What do you mean by 'reload' the > > > app? Are you > > > > > running it > > > > > under Eclipse or another IDE? > > > > > > > > > > Thanks > > > > > > > > > > David > > > > > > > > > > > -----Original Message----- > > > > > > From: Folkens, Brad > [mailto:[EMAIL PROTECTED] > > > > > > Sent: 28 October 2003 22:25 > > > > > > To: '[EMAIL PROTECTED]' > > > > > > Subject: log4j DEBUG output at Turbine 2.3 startup > > > > > > > > > > > > > > > > > > For some reason the log4j output always defaults to > > > DEBUG and to > > > > > > the console the first time Turbine 2.3 starts up. If I > > > "reload" > > > > > > the app, it uses the defaults in the log4j.properties file > > > > > > correctly. What's interesting is, the first time > > over (when it > > > > > > outputs all the DEBUG info to the console), it does > actually > > > > > > mention that it is reading the log4j.properties file. > > > > > > > > > > > > I used the log4j.properties file as it comes in the 2.3 > > > CVS, and > > > > > > have also played around with it a bunch... > > > > > > > > > > > > Any ideas? > > > > > > > > > > > > Thanks, > > > > > > Brad > > > > > > > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > - > > > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
