Interestingly the problem is solved when I removed the
LogManager.shutdown(); from contextDestroyed() method. Now it works even if
the Logger is static.
    This is how the Log4J is configured.
public void contextInitialized(ServletContextEvent event){

PropertyConfigurator.configure(event.getServletContext().getRealPath("/")+"W
EB-INF"+System.getProperty("file.separator")+"classes"+System.getProperty("f
ile.separator")+"log4j.properties");
}

Is there anything wrong with it.

Thanks for the help.

Antony Paul.

----- Original Message -----
From: "Antony Paul" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, March 24, 2004 12:02 PM
Subject: Re: AW: No appenders could be found for logger()


> Yes it is calling this
> public void contextDestroyed(ServletContextEvent event){
>   LogManager.shutdown();
>  }
>
> Antony Paul
>
> ----- Original Message -----
> From: "Jacob Kjome" <[EMAIL PROTECTED]>
> To: "Log4J Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, March 24, 2004 10:10 AM
> Subject: RE: AW: No appenders could be found for logger()
>
>
> At 01:41 PM 3/23/2004 +0000, you wrote:
> >I am posting my last mail again. I think last mail I send to some one
else.
> >
> >This is the log4j.properties file
> >
> >log4j.rootCategory=debug, file
> >log4j.category.your.category.name=WARN
> >#log4j.category.your.category.name=INHERITED
> >log4j.appender.file=org.apache.log4j.FileAppender
> >log4j.appender.file.File=E:/Projects/error.log
> >log4j.appender.file.layout=org.apache.log4j.PatternLayout
> >log4j.appender.file.layout.ConversionPattern=(%F:%L) %-5p %c %x - %m
%d{dd
> >MMM yyyy HH:mm:ss,SSS}%n
> >
> >There is only one class with this name and I tested it with another class
> >and the problem persists. I think the problem is with Tomcat serialising
> >the class when it is reloaded.
>
> You are using a static logger.  Static variables aren't serialized.  BTW,
> you say you are using a servlet context listener to do initialization.
How
> about destruction?  Try adding LogManager.shutdown() in
contextDestroyed().
>
> Jake
>
>
> >One more thing can any one access hotmail from Outlook Express today.
> >
> >Antony Paul
> >
> >
> >
> >>From: <[EMAIL PROTECTED]>
> >>To: <[EMAIL PROTECTED]>
> >>Subject: AW: No appenders could be found for logger()
> >>Date: Tue, 23 Mar 2004 09:32:58 +0100
> >>
> >>Since you didn't supply a stack trace of the error nor the configuration
> >>file and moreover changed basics of the code (the name of the class)
when
> >>posting the problem, it is very difficult to find the reasons for the
> >>problem. One reason could be that for some reaosns there are two classes
> >>named BasicTimerTask in your environment, one you wrote, and another one
> >>out of a package you use. After the reload of the Application
> >>BasicTimerTask might somehow refer to the other class, for which no
> >>appender has been set up in your configuration file. Just to make sure
> >>that that is not the case, could you just use the fully qualified name
of
> >>the class, when retrieving the logger for the class ?
> >>
> >>Regards
> >>
> >>Gyoergy
> >>
> >>-----Urspr�ngliche Nachricht-----
> >>Von: Antony Paul [mailto:[EMAIL PROTECTED]
> >>Gesendet: Montag, 22. M�rz 2004 15:00
> >>An: Log4J Users List
> >>Betreff: Re: No appenders could be found for logger()
> >>
> >>
> >>The name of the class is BasicTimerTask. I renamed it for posting. It
> works
> >>fine before the web application is reloaded. All other servlets and JSPs
> >>work even after reloading. Also Log4J is initialised in a
> >>ServletContextListener with PropertyConfigurator.configure() method. I
> think
> >>there is nothing wrong with log4j.properties because everything else
works
> >>fine.
> >>
> >>Antony Paul
> >>
> >>----- Original Message -----
> >>From: "Jacob Kjome" <[EMAIL PROTECTED]>
> >>To: "Log4J Users List" <[EMAIL PROTECTED]>
> >>Sent: Monday, March 22, 2004 7:13 PM
> >>Subject: Re: No appenders could be found for logger()
> >>
> >>
> >> > What does your properties file look like?  Did you provide an
appender
> in
> >> > the root logger or did you just define a logger for BasicTimerTask
and
> >>give
> >> > it an appender?  Actually, shouldn't that logger be named
"MyTimeTask",
> >>not
> >> > "BasicTimerTask" or was that a typo?
> >> >
> >> > Jake
> >> >
> >> > At 03:23 PM 3/22/2004 +0530, you wrote:
> >> > >Hi all,
> >> > >     No appenders could be found for logger. This error is show when
a
> >>web
> >> > >application is reloaded. It is emitted only for a class.
> >> > >     I am using Log4J for logging in my web application and it runs
on
> >>JDK
> >> > >1.4.1. It have the log4j jar in web-inf\lib and log4j.properties in
> >> > >web-inf\classes. These two files are nowhere else in Tomcat. I am
> almost
> >> > >satisfied with it. Now I have a problem when Logger is used in a
class
> >>which
> >> > >extends a java.util.TimerTask(It is only experimental). After
> reloading
> >>the
> >> > >application the error message is printed only for this particular
> class.
> >> > >This is the code I am using to get a Logger.
> >> > >
> >> > >public class MyTimerTask extends TimerTask{
> >> > >  private static Logger logger =
> Logger.getLogger(BasicTimerTask.class);
> >> > >}
> >> > >     What is wrong with it ?.
> >> > >
> >> > >Antony Paul
> >> > >
> >> >
>---------------------------------------------------------------------
> >> > >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]
> >
> >_________________________________________________________________
> >All the action. All the drama. Get NCAA hoops coverage at MSN Sports by
> >ESPN. http://msn.espn.go.com/index.html?partnersite=espn
> >
> >
> >---------------------------------------------------------------------
> >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