commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Rosenberg <>
Subject Re: Static versus Transient Logger Declarations
Date Fri, 10 Sep 2010 12:29:26 GMT

as to my knowledge the modern containers do not encourage the usage of
shared data anymore, and this was the only possible problem cause

The real root cause of this problem is that SHARED data (static
members on a class) is being shared across supposedly independent
"applications". If no classes are "shared" between applications then
the problem does not exist. However it appears that (to my personal
frustration) container vendors continue to encourage the use of shared
classes, and application developers continue to use it.

In other words, if the application developer is dumb enough to put his
logging library in the shared lib folder of the container he will
encounter a problem. If he's a brave soul and deploys each webapp
independtly he will have no problems. Right?

Since the dumb developer will always find a way to mess stuff up, I
would say the whole discussion is pointless ;-)

best regards

P.S. talking about modern containers I was referring to tomcat.

On Fri, Sep 10, 2010 at 2:16 PM, Cardillo, Ray - IS
<> wrote:
> I guess that aspect of it comes down to a personal philosophy more than anything else.
 I typically try to help things like this bubble up so the knowledge can be shared and pain
can be avoided in a proactive way instead of waiting for others to learn for themselves.  So
that's why I'm asking for other communities to engage.  I'm not actually trying to challenge
the JBoss contributors directly, or cause any "religious" wars over best practices.  I just
want to see some solid reasoning on the topic so we can get the correct knowledge out there
and either validate the currently accepted practice, or confirm that this other strategy should
be the best practice.  Once the correct knowledge is out there, then each community can make
solid design decisions instead of succumbing to the "cargo cult code" phenomenon that seems
to be responsible for the current strategy that people think is a best practice only because
they see the pattern so frequently.
> I'm not really worried about it, for the reasons you mentioned, but I do want to see
the "experts" in this area at least defend or amend the Apache Commons Wiki content if it
turns out to be bad information (as some in the aforementioned thread seem to indicate).
> Ray
> -----Original Message-----
> From: Adrian Crum []
> Sent: Thursday, September 09, 2010 3:54 PM
> To: Commons Users List
> Subject: Re: Static versus Transient Logger Declarations
> I'm not an expert on the subject, but as an outsider looking in, it seems to me that
logging performance is a moot point - since logging is typically used as a debugging tool.
It is unlikely that a high-demand or high-performance application will be doing a lot of logging.
> Also, it seems you are questioning the JBoss contributors best practices in your post.
Why not follow the best practices and let someone else worry about the pros and cons of static
Log instances? If static Log instances cause a configuration problem in certain app containers,
then it will be evident in the bug tracker - and someone down the road will make the appropriate
change to fix the bug.
> In other words, if it was me, I wouldn't worry about it.
> -Adrian
> --- On Thu, 9/9/10, Cardillo, Ray - IS <> wrote:
>> From: Cardillo, Ray - IS <>
>> Subject: Static versus Transient Logger Declarations
>> To: "" <>, ""
>> Date: Thursday, September 9, 2010, 9:27 AM
>> I have recently started a
>> discussion<>
>> about the use of Static versus Transient Logger declarations
>> in open source libraries that are intended to be used in
>> multiple application containers (or other contexts) after
>> reading the following Apache Commons Logging article:
>> Logging/StaticLog
>> The article seems sound to me, and does a good job of
>> explaining why Transient is generally the better strategy,
>> should not cause any tangible performance degradation with
>> most modern logging libraries, and more importantly, why it
>> will actually work correctly when used in anything but the
>> simplest Java application.  However, some people have
>> responded to this thread by either focusing on performance
>> (which seems to be a mute point in my opinion) or by
>> focusing on the features of one specific Logger library
>> implementation.  Both perspectives seem to be short
>> sited if you are intending to create a library that can be
>> used in any context (e.g., any application container,
>> application, used by another library, etc).
>> I am asking for participation from the Apache community
>> because some replies have (politely) discredited or
>> dismissed the Apache article that I referenced.  If the
>> article is in fact out of date, then can someone please
>> verify that, and amend the Apache Commons Wiki?  If the
>> article is not outdated, and is still technically accurate,
>> then can someone who is intimately familiar with this topic
>> step forward and help defend the position, and educate
>> others who might be interested in this topic?  I would
>> like to see the correct strategy employed in future work by
>> this community (and other open source communities) because
>> many open source libraries are incubated under bigger
>> projects like JBoss AS, but intended to be used more widely
>> as well.  I would hate to see the incorrect pattern
>> being proliferated just because it is the "de facto norm"
>> especially if there is an opportunity to help educate
>> everyone about a better approach.
>> So in summary, I am asking for help getting facts (not
>> opinions) communicated about Static versus Transient Logger
>> declarations, so developers who are creating libraries that
>> are intended to be used in any context (any application
>> container, etc), can have a solid reference about which
>> strategy is best.  Again, for easy reference, the link
>> to the forum discussion is:
>> Better strategy for instantiation of Logger instances
>> (static causes problems)
>> Thanks in advance to anyone who participates!
>> Ray Cardillo
>> Principal Software Engineer
>> ITT Corporation
>> Advanced Engineering & Sciences (AES)
>> Rome, NY
>> ________________________________
>> This e-mail and any files transmitted with it may be
>> proprietary and are intended solely for the use of the
>> individual or entity to whom they are addressed. If you have
>> received this e-mail in error please notify the sender.
>> Please note that any views or opinions presented in this
>> e-mail are solely those of the author and do not necessarily
>> represent those of ITT Corporation. The recipient should
>> check this e-mail and any attachments for the presence of
>> viruses. ITT accepts no liability for any damage caused by
>> any virus transmitted by this e-mail.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message