geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pasi Salminen <pasi.salmi...@profitsoftware.com>
Subject Re: Logging code and Garbage Collection
Date Thu, 14 Aug 2003 05:31:16 GMT
Putting my administrator hat on, I must say that I don't like application servers
which do not enable change of logging level at runtime. When you are in production
and something weird happens you can't just reboot the server or even that
application. You may even never see this situation again or it may take a month
before it happens again. That's why it should be possible. It's kind of QOS of the
server and for example WebSphere is doing pretty good job in this area.

Regards,

Paci

Berin Loritsch wrote:

> To be honest, I think we are overthinking this a bit.  Very rarely does the
> logging levels change at runtime.  In fact many logging toolkits cache the
> log level as a final variable to help the JIT inline and optimize out the
> whole block.
>
> In every project I have worked on, the logging levels remained constant from
> component init time to destruction.  The only time a logging level could or
> would change is if the change was detected when the component was reloaded.
> Effectively, in most cases this meant that the whole system came down before
> the configuration would change.
>
> Why add more difficulty to a simple solution?
>
> The isXEnabled() methods are fast, and are usually quicker than one
> concatenation.  They do become the "bottleneck" when there is no concatenation
> at all.
>
> For example:
>
> if ( m_logger.isDebugEnabled() )
> {
>      m_logger.debug( "test message" );
> }
>
> is both slower and more cumbersome than this:
>
> m_logger.debug( "test message" );
>
> However, as soon as you add in one concatenation with a variable the test
> becomes valuable again:
>
> if ( m_logger.isDebugEnabled() )
> {
>      m_logger.debug( "processing the component: " + componentName );
> }
>
> Also note that concatenating constants is something that most compilers do
> anyway so that is not an issue for runtime performance.  IOW:
>
> "test" + " " + "message" == "test message"
>
> Anything more than this is simply adding too much complexity for little or no
> gain.
>
> --
>
> "They that give up essential liberty to obtain a little temporary safety
>   deserve neither liberty nor safety."
>                  - Benjamin Franklin

__________________________________________________________________________

This message and its attachments have been found clean from known viruses 
with three different antivirus programs.
__________________________________________________________________________

Mime
View raw message