You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Antony Paul <an...@hotmail.com> on 2004/09/15 12:24:54 UTC

Serializable Logging implementation

Hi,
    I used Log4J and commons logging in an ActionForm which is stored in the
session. When I reload the context it is invalidating the session because it
is non serializable. Is there any work around for this ?. Or do I have to
use any other Logger.

rgds
Antony Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serializable Logging implementation

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Tim Funk <fu...@joedog.org>:

> logging instances should be static to the class.
>
> // Commons logging example but a log4j equiv should be easy to find
>      private static Log log = LogFactory.getLog(MyClass.class);
>

or
private transient Log log = LogFactory.getLog(MyClass.class);

Although this would mean a new instance of the log variable for every instance
of the class.  The static version is the better idea in most cases.

Jake

>
> -Tim
>
> Antony Paul wrote:
>
> > Hi,
> >     I used Log4J and commons logging in an ActionForm which is stored in
> the
> > session. When I reload the context it is invalidating the session because
> it
> > is non serializable. Is there any work around for this ?. Or do I have to
> > use any other Logger.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serializable Logging implementation

Posted by Antony Paul <an...@hotmail.com>.
I extend a base form which gets the Log as
LogFactory.getLog(this.getClass());
So that no need to define and get a Log instance in subclass. Is there any
way so that I can follow this pattern.

rgds
Antony Paul

----- Original Message -----
From: "Tim Funk" <fu...@joedog.org>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, September 15, 2004 4:38 PM
Subject: Re: Serializable Logging implementation


> logging instances should be static to the class.
>
> // Commons logging example but a log4j equiv should be easy to find
>      private static Log log = LogFactory.getLog(MyClass.class);
>
>
> -Tim
>
> Antony Paul wrote:
>
> > Hi,
> >     I used Log4J and commons logging in an ActionForm which is stored in
the
> > session. When I reload the context it is invalidating the session
because it
> > is non serializable. Is there any work around for this ?. Or do I have
to
> > use any other Logger.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Serializable Logging implementation

Posted by Tim Funk <fu...@joedog.org>.
logging instances should be static to the class.

// Commons logging example but a log4j equiv should be easy to find
     private static Log log = LogFactory.getLog(MyClass.class);


-Tim

Antony Paul wrote:

> Hi,
>     I used Log4J and commons logging in an ActionForm which is stored in the
> session. When I reload the context it is invalidating the session because it
> is non serializable. Is there any work around for this ?. Or do I have to
> use any other Logger.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org