You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by la...@apache.org on 2005/12/01 04:56:38 UTC

svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Author: laurieh
Date: Wed Nov 30 19:56:35 2005
New Revision: 350142

URL: http://svn.apache.org/viewcvs?rev=350142&view=rev
Log:
Fix non-static Log instance, which was breaking serializability.

Modified:
    struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Modified: struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java?rev=350142&r1=350141&r2=350142&view=diff
==============================================================================
--- struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java (original)
+++ struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java Wed Nov 30 19:56:35 2005
@@ -49,7 +49,7 @@
 
 public class DynaActionFormClass implements DynaClass, Serializable {
 
-    private Log log = LogFactory.getLog(DynaActionFormClass.class);
+    private static Log log = LogFactory.getLog(DynaActionFormClass.class);
 
     // ----------------------------------------------------------- Constructors
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Posted by Craig McClanahan <cr...@apache.org>.
On 11/30/05, Martin Cooper <ma...@apache.org> wrote:
>
> On 11/30/05, Laurie Harper <la...@holoweb.net> wrote:
> >
> > Wendy Smoak wrote:
> > > On 11/30/05, Martin Cooper <ma...@apache.org> wrote:
> > >
> > >> There was a thread somewhere recently (I'm afraid I don't recall
> where)
> > >> about going in the opposite direction, for a good reason that I don't
> > >> recall. I'm hoping someone else here saw the same thing and has a
> > better
> > >> memory. ;-) IIRC, the solution was to make the log instance transient
> > and
> > >> access it through a getter.
> > >
> > > Possibly...
> > >
> >
> http://www.nabble.com/-logging-Advice-on-static-instance-transient-Log-variables-t602568.html
>
>
> Yep, that's the one. Wendy, you are now officially my memory. ;-)


How does she *do* that ... :-)

Thanks for the link. If I understand the issue correctly, it would only
> > be a problem is you had a logging implementation in the application
> > classpath (WEB-INF/lib) but struts-action.jar in a shared classpath
> > ($TOMCAT_HOME/common/lib or similar).
> >
> > If I recall correctly, putting Struts in a shared classpath like that is
> > strongly discouraged and/or won't work anyway, so do we need to worry
> > about this?
>
>
> Actually, it's not just strongly discouraged - we officially claim to not
> support such a scenario (or at least we used to). So you're right, we
> shouldn't worry about it. Sorry for the false alarm.


I was the author of that original warning that's still in the user guide:


http://struts.apache.org/struts-action/userGuide/configuration.html#config_add

This statement was originally written in the 1.0 days when servlet container
class loaders were all over the map in their functionality, and it was very
difficult to support a shared installation environment cleanly.

But that was then and this is now ... I think it's probably reasonable to
consider "install struts jars in a server's shared class loader" as a use
case that we want to officially support, in all our framework projects.  I'm
gonna start fixing the Shale references to static Log instances (quite a few
of them) and then run some experiments to see if there are still memory
leaks.

--
> Martin Cooper


Craig

Re: svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Posted by Martin Cooper <ma...@apache.org>.
On 11/30/05, Laurie Harper <la...@holoweb.net> wrote:
>
> Wendy Smoak wrote:
> > On 11/30/05, Martin Cooper <ma...@apache.org> wrote:
> >
> >> There was a thread somewhere recently (I'm afraid I don't recall where)
> >> about going in the opposite direction, for a good reason that I don't
> >> recall. I'm hoping someone else here saw the same thing and has a
> better
> >> memory. ;-) IIRC, the solution was to make the log instance transient
> and
> >> access it through a getter.
> >
> > Possibly...
> >
> http://www.nabble.com/-logging-Advice-on-static-instance-transient-Log-variables-t602568.html


Yep, that's the one. Wendy, you are now officially my memory. ;-)

Thanks for the link. If I understand the issue correctly, it would only
> be a problem is you had a logging implementation in the application
> classpath (WEB-INF/lib) but struts-action.jar in a shared classpath
> ($TOMCAT_HOME/common/lib or similar).
>
> If I recall correctly, putting Struts in a shared classpath like that is
> strongly discouraged and/or won't work anyway, so do we need to worry
> about this?


Actually, it's not just strongly discouraged - we officially claim to not
support such a scenario (or at least we used to). So you're right, we
shouldn't worry about it. Sorry for the false alarm.

--
Martin Cooper


Or did I mis-understand the problem?
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Re: svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Posted by Laurie Harper <la...@holoweb.net>.
Wendy Smoak wrote:
> On 11/30/05, Martin Cooper <ma...@apache.org> wrote:
> 
>> There was a thread somewhere recently (I'm afraid I don't recall where)
>> about going in the opposite direction, for a good reason that I don't
>> recall. I'm hoping someone else here saw the same thing and has a better
>> memory. ;-) IIRC, the solution was to make the log instance transient and
>> access it through a getter.
> 
> Possibly...
> http://www.nabble.com/-logging-Advice-on-static-instance-transient-Log-variables-t602568.html

Thanks for the link. If I understand the issue correctly, it would only 
be a problem is you had a logging implementation in the application 
classpath (WEB-INF/lib) but struts-action.jar in a shared classpath 
($TOMCAT_HOME/common/lib or similar).

If I recall correctly, putting Struts in a shared classpath like that is 
strongly discouraged and/or won't work anyway, so do we need to worry 
about this?

Or did I mis-understand the problem?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/30/05, Martin Cooper <ma...@apache.org> wrote:

> There was a thread somewhere recently (I'm afraid I don't recall where)
> about going in the opposite direction, for a good reason that I don't
> recall. I'm hoping someone else here saw the same thing and has a better
> memory. ;-) IIRC, the solution was to make the log instance transient and
> access it through a getter.

Possibly...
http://www.nabble.com/-logging-Advice-on-static-instance-transient-Log-variables-t602568.html

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: svn commit: r350142 - /struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java

Posted by Martin Cooper <ma...@apache.org>.
On 11/30/05, laurieh@apache.org <la...@apache.org> wrote:
>
> Author: laurieh
> Date: Wed Nov 30 19:56:35 2005
> New Revision: 350142
>
> URL: http://svn.apache.org/viewcvs?rev=350142&view=rev
> Log:
> Fix non-static Log instance, which was breaking serializability.


There was a thread somewhere recently (I'm afraid I don't recall where)
about going in the opposite direction, for a good reason that I don't
recall. I'm hoping someone else here saw the same thing and has a better
memory. ;-) IIRC, the solution was to make the log instance transient and
access it through a getter.

--
Martin Cooper


Modified:
>
>     struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
>
> Modified:
> struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
> URL:
> http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java?rev=350142&r1=350141&r2=350142&view=diff
>
> ==============================================================================
> ---
> struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
> (original)
> +++
> struts/action/trunk/src/java/org/apache/struts/action/DynaActionFormClass.java
> Wed Nov 30 19:56:35 2005
> @@ -49,7 +49,7 @@
>
> public class DynaActionFormClass implements DynaClass, Serializable {
>
> -    private Log log = LogFactory.getLog(DynaActionFormClass.class);
> +    private static Log log = LogFactory.getLog(DynaActionFormClass.class
> );
>
>      // -----------------------------------------------------------
> Constructors
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>