Yes, that was my point earlier. Or make it a transient with lazy creation as
that would be more efficient.
Eelco
On 4/26/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
But if static logs are really a problem:
http://wiki.apache.org/jakarta-commons/Logging/StaticLog
if would do this:
private void doSomething()
{
/// foo
LogFactory.getLog(Xxx.class).debug("blaat")
// bar
}
or
private void doSomething()
{
/// foo
getLog().debug("blaat");
// bar
}
private Log getLog()
{
return LogFactory.getLog(Xxx.class);
}
On 4/26/07, Johan Compagner < [EMAIL PROTECTED]> wrote:
>
> since when does a logger have state?
> I am very interrested to know what it is that a logger isn't thread
> safe.
> You configure it through the constructor (so i guess assign final
> fields)
> you don't set any variables after that on it. And you call only
> info/error with 1 or to params.... that it needs to log!
>
> johan
>
>
> On 4/26/07, Matej Knopp < [EMAIL PROTECTED]> wrote:
> >
> > Yeah, if it really should be a member variable (which makes sense when
> > logger is not thread safe), it probably could be something like this:
> >
> > private transient Logger logger;
> >
> > private Logger getLogger() {
> > if (logger == null) <initializeLogger>;
> > return logger;
> > }
> >
> > On 4/26/07, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
> > >
> > > What's the stack trace you get when you use normal serialization? It
> > > should point you to an offending field.
> > >
> > > If you only get it with JCL, there is probably something in JCL that
> > > isn't serializable. You should consider either making it a static
variable,
> > > getting it only when you need it (don't hold a reference, which is
probably
> > > quite inefficient), or store it as a transient field, and initiatlize it
> > > lazily (check on null) so that it won't be serialized. More work but safe.
> > > If you choose the latter, be sure to always do the null check, as
> > > serializaing/ deserializing will null the reference.
> > >
> > > Eelco
> > >
> > >
> > > On 4/25/07, Bjön Limell < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Maybe I was a bit unclear.
> > > >
> > > > The problem only occurs when you're using jcl104-over-slf4j (JCL's
> > > > Log not slf4j's Logger).
> > > >
> > > > JCL104-over-slf4j just enables you to use old 'Log log =
> > > > LogFactory.getLog ()' with slf4j (without classloading issues etc)
> > > >
> > > > ps. Same problem with Objects.setObjectStreamFactory(...);
> > > >
> > > >
> > > > On 4/25/07, Justin Morgan < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > Just a data point...I am using the Wicket 1.3 snapshot jars
> > > > > along with SLF4J with no problems; my pages log just fine. The
underlying
> > > > > logging implementation I'm using is the Log4J (v1.2) logging
> > > > > system. So far I really like slf4j, BTW.
> > > > >
> > > > > - Justin
> > > > >
> > > > >
> > > > >
> > > > > *"Bjön Limell" <[EMAIL PROTECTED]>*
> > > > > Sent by: [EMAIL PROTECTED]
> > > > >
> > > > > 04/25/2007 11:57 AM Please respond to
> > > > > [email protected]
> > > > >
> > > > > To
> > > > > [email protected] cc
> > > > >
> > > > > Subject
> > > > > Re: [Wicket-user] SLF4J and wicket
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > btw, im using 1.3.0-incubating-SNAPSHOT
> > > > >
> > > > > On 4/25/07, Bjön Limell <[EMAIL PROTECTED]> wrote:
> > > > > > Sure!
> > > > > >
> > > > > > ERROR org.apache.wicket.util.lang.Objects
> > > > > > "Error serializing object class test.page.SignInPage[object=[Page
> > > > > > class = test.page.SignInPage, id = 1, version = 0]]"
> > > > > > org.apache.wicket.util.io.WicketSerializeableException: No
> > > > > > Serializable constructor found for class
> > > > > > org.apache.commons.logging.impl.SLF4JLocationAwareLog
> > > > > > test.page.SignInPage->log
> > > > > > NOTE: if you feel Wicket is at fault with this exception,
> > > > > please
> > > > > > report to the mailing list. You can switch to JDK based
> > > > > serialization
> > > > > > by calling:
> > > > > org.apache.wicket.util.lang.Objects.setObjectStreamFactory(new
> > > > > > IObjectStreamFactory.DefaultObjectStreamFactory()) e.g. in the
> > > > > init
> > > > > > method of your application
> > > > > > at org.apache.wicket.util.io.ClassStreamHandler
> > > > > .<init>(ClassStreamHandler.java:252)
> > > > > > at org.apache.wicket.util.io.ClassStreamHandler.lookup
> > > > > (ClassStreamHandler.java:116)
> > > > > > at
> > > > > org.apache.wicket.util.io.WicketObjectOutputStream.writeObjectOverride
> > > > > (WicketObjectOutputStream.java:752)
> > > > > > at java.io.ObjectOutputStream.writeObject(
> > > > > ObjectOutputStream.java:322)
> > > > > > at
> > > > >
org.apache.wicket.util.io.ClassStreamHandler$ObjectFieldAndIndex.writeField
> > > > > (ClassStreamHandler.java:862)
> > > > > > at
> > > > > org.apache.wicket.util.io.ClassStreamHandler.writeFields(
> > > > > ClassStreamHandler.java:387)
> > > > > > at
> > > > > org.apache.wicket.util.io.WicketObjectOutputStream.writeObjectOverride
> > > > > (WicketObjectOutputStream.java:779)
> > > > > > at java.io.ObjectOutputStream.writeObject(
> > > > > ObjectOutputStream.java:322)
> > > > > > at
> > > > > org.apache.wicket.util.lang.Objects.objectToByteArray(
> > > > > Objects.java:1102)
> > > > > > at
> > > > > org.apache.wicket.protocol.http.FilePageStore.serializePage(
> > > > > FilePageStore.java:651)
> > > > > > at
> > > > > org.apache.wicket.protocol.http.FilePageStore.access$900(
> > > > > FilePageStore.java:49)
> > > > > > at
> > > > >
org.apache.wicket.protocol.http.FilePageStore$PageSerializingThread.run
> > > > > (FilePageStore.java:237)
> > > > > > at java.lang.Thread.run(Thread.java:619)
> > > > > >
> > > > > > ps. thanks for the SUPER quick response!! ;)
> > > > > >
> > > > > > On 4/25/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > > > > > It might be a bug in our custom serialization. Could you
> > > > > please paste
> > > > > > > the full stack trace please?
> > > > > > >
> > > > > > > Eelco
> > > > > > >
> > > > > > > On 4/25/07, Bjön Limell <[EMAIL PROTECTED]> wrote:
> > > > > > > > Hi.
> > > > > > > >
> > > > > > > > Anyone had success with slf4j and wicket pages?
> > > > > > > >
> > > > > > > > Im getting serializeable exceptions with
> > > > > jcl104-over-slf4j-1.3.1.jar:
> > > > > > > > org.apache.wicket.util.io.WicketSerializeableException:
> > > > > No
> > > > > > > > Serializable constructor found for class
> > > > > > > > org.apache.commons.logging.impl.SLF4JLocationAwareLog
> > > > > > > >
> > > > > > > > At the moment I dont need to cluster, but im not sure how
> > > > > its gonna be
> > > > > > > > later on...
> > > > > > > >
> > > > > > > >
> > > > >
-------------------------------------------------------------------------
> > > > > > > > This SF.net email is sponsored by DB2 Express
> > > > > > > > Download DB2 Express C - the FREE version of DB2 express
> > > > > and take
> > > > > > > > control of your XML. No limits. Just data. Click to get it
> > > > > now.
> > > > > > > > http://sourceforge.net/powerbar/db2/
> > > > > > > > _______________________________________________
> > > > > > > > Wicket-user mailing list
> > > > > > > > [email protected]
> > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > >
-------------------------------------------------------------------------
> > > > > > > This SF.net email is sponsored by DB2 Express
> > > > > > > Download DB2 Express C - the FREE version of DB2 express and
> > > > > take
> > > > > > > control of your XML. No limits. Just data. Click to get it
> > > > > now.
> > > > > > > http://sourceforge.net/powerbar/db2/
> > > > > > > _______________________________________________
> > > > > > > Wicket-user mailing list
> > > > > > > [email protected]
> > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
-------------------------------------------------------------------------
> > > > > This SF.net email is sponsored by DB2 Express
> > > > > Download DB2 Express C - the FREE version of DB2 express and
> > > > > take
> > > > > control of your XML. No limits. Just data. Click to get it now.
> > > > > http://sourceforge.net/powerbar/db2/
> > > > > _______________________________________________
> > > > > Wicket-user mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > >
> > > > >
> > > > >
> > > > >
-------------------------------------------------------------------------
> > > > > This SF.net email is sponsored by DB2 Express
> > > > > Download DB2 Express C - the FREE version of DB2 express and
> > > > > take
> > > > > control of your XML. No limits. Just data. Click to get it now.
> > > > > http://sourceforge.net/powerbar/db2/
> > > > > _______________________________________________
> > > > > Wicket-user mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > >
> > > > >
> > > >
> > > >
> > > >
-------------------------------------------------------------------------
> > > > This SF.net email is sponsored by DB2 Express
> > > > Download DB2 Express C - the FREE version of DB2 express and take
> > > > control of your XML. No limits. Just data. Click to get it now.
> > > > http://sourceforge.net/powerbar/db2/
> > > > _______________________________________________
> > > > Wicket-user mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > > >
> > >
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user