I threw an

        if(log != null)
        {       
                log.info("Turbine: Done shutting down!");
        }

around it but didn't include that in the patch since it seems more like a
hack

That'll help your test error...

Everything else I think the assertion is that it is initialized...



-----Original Message-----
From: David Wynter [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 29, 2003 9:11 AM
To: Turbine Users List
Subject: RE: log4j DEBUG output at Turbine 2.3 startup


Hi Brad,

I applied the patch and ran maven and it failed the DestroyTest with a NPE.
See line 665 of Turbine.java, log is null here  because of the test. See
below

    public void testDestroy()
        throws Exception
    {
        Turbine t = new Turbine();
        t.destroy();
    }

    public void testInitAndDestroy()
        throws Exception
    {
        tc.initialize();
        tc.dispose();
    }

Because it does not call initialize() in the testDestroy the variable log is
not initialized.

I just removed the test until the Turbine developers decide what to do for a
permanent solution.

Thanks for solving the problem, it has been a real pain trying to debug my
app.

David

> -----Original Message-----
> From: Folkens, Brad [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2003 14:39
> 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/Turb
> ine.java,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]

Reply via email to