commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject RE: Why Log implementation is Serialized?
Date Thu, 04 May 2006 09:52:35 GMT
Hi Mehta,

I agree with Tahir's recommendation.

If you're writing an application, then just use log4j or
java.util.logging, or whatever you prefer. It's simpler, faster, and
less confusing to just call the specific logging API directly.

If you're writing a library that will be used in some other application,
and you have no right to dictate what logging library that other
application will use, then use commons-logging. This is the case for all
"jakarta commons" libraries for example (which is why any commons lib
that does logging uses commons-logging).

Regarding your original question, as Robert's email pointed out some
user objects that have Log members may need to be serialized. In
particular, EJB servers can "passivate" objects, and servlet engines can
serialize web sessions to disk. In either case, any object that has a
Log member would fail to serialize if the Log implementation was not
serializable.

Note that there is a potential issue with Log serialization. On
deserialize, the exact same concrete Log implementation class is
created. This means that if you serializing an object in an app using
log4j, and deserialize it in an app using java.util.logging then things
will not go well. It would have been better to have some mechanism that
just serialized the log category, and recreated the appropriate object
from whatever logging library the deserialization occurred in, but
that's not likely to be fixed until the 2.x series (if then). Not many
apps face this issue though.

Cheers,

Simon

On Wed, 2006-05-03 at 21:44 -0700, Meera Mehta wrote:
> Thanks Tahir,
> 
> Surely i will go threw that discussion.
> 
> Thank you very much for quick reply.
> 
> Mehta
> 
> --- Tahir Akhtar <tahir@spectrum-tech.com> wrote:
> 
> > Hi Mehta,
> > 
> > I hope you have done a thorough comparison of
> > commons logging wrapper versus
> > directly using a logging api like log4j, jdk1.4
> > logging etc. Recently there
> > was a discussion on this list on merits/demerits of
> > using commons logging
> > which is essentially a wrapper instead of using a
> > logging api directly. 
> > 
> > I think the summary of discussion was that it is
> > better to use commons
> > logging if you are writing an api/component that
> > will be used across several
> > projects. This way your api/component will be able
> > to use the logging system
> > of the project without any change. But in standalone
> > projects there is
> > little to be gained by using commons logging and you
> > are limited to lowest
> > common denominator of all the api's plus exposed to
> > possible problems in
> > deployment/configuration.
> > 
> > 
> > Search the archive for the complete discussion.
> > 
> > Regards
> > Tahir Akhtar
> > 
> > -----Original Message-----
> > From: Meera Mehta [mailto:mehtameera@yahoo.com] 
> > Sent: Wednesday, May 03, 2006 3:05 PM
> > To: commons-user@jakarta.apache.org
> > Subject: Why Log implementation is Serialized?
> > 
> > Hi,
> > 
> > I am new to commons logging, we are using commons
> > logging in our next project.
> > 
> > I want to know why Log implementations(Wrappers say
> > Log4JLogger,Jdk14Logger) implements Serializable????
> > 
> > please let me kow.
> > 
> > thanks in advance
> > cheers!!!!
> > 
> > Meera
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > 
> > -- 
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.385 / Virus Database: 268.5.2/329 -
> > Release Date: 5/2/2006
> >  
> > 
> > -- 
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.385 / Virus Database: 268.5.2/329 -
> > Release Date: 5/2/2006
> >  
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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


Mime
View raw message