Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [riena-dev] Cache for LOGGER.isLoggable

Hi Elias and reina-dev,

Thanks for the thoughts.

It looks like Log4r.getLogger() returns an instance of
org.eclipse.equinox.log.internal.LoggerImpl , which delegates an instance of
org.eclipse.equinox.log.internal.ExtendedLogServiceImpl . and eventually it
will be delegated to
org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.isLoggable(
Bundle, String, int) which does the work.

I personally doubt if it is really equinox's responsibility to cache the
result of isLoggable() . I think the equinox as the platform is reasonable
to always get the real-time result, while in most reina application, which
could usually be either a running hessian service server or a client
application, would like to have the result cached.

I would recommend to modify the Log4r.getLogger() method so that it will
return a cacheable instance of org.eclipse.equinox.log.Logger (which is an
instance anyway). This class will cache result of isLoggable() while
delegating all other calls to what is now returned by Log4r.getLogger() .

Any thoughts?
 
Regards,

Patrick He

-----邮件原件-----
发件人: riena-dev-bounces@xxxxxxxxxxx [mailto:riena-dev-bounces@xxxxxxxxxxx]
代表 Elias Volanakis
发送时间: Wednesday, 14 July 2010 5:24 AM
收件人: Riena Developers list
主题: Re: [riena-dev] Cache for LOGGER.isLoggable

Hi Patrick,

thanks for bringing that up.

I'm not the expert in this area (committer Stefan is) but I agree that
isLoggable(...) should be fast.

However: could you provide some information about where the code that does
the searching comes from? Are you referring to
ExtendedLogReaderServiceFactory.isLoggable(...) or something else? In the
first case: that class is part of the Equinox logging framework so you
should propably open a bug or talk with them:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox
http://eclipse.org/equinox/resources.php

Thanks,
Elias.


On Sat, Jul 10, 2010 at 7:20 PM, Patrick <platinas.hy@xxxxxxxxx> wrote:
> Hi riena-dev,
>
>
>
> When we use Log4r.getLogger() to get a logger, there is a method 
> isLoggable(int level). Using debugger to track turns out that it looks 
> like every time this method is called, it consults every registered 
> log listener to ask if this log level is loggable, which looks like is 
> resource consuming if there are many service enquiring if the log level is
available.
>
>
>
> The isLoggable method should be a quick one that pre-checks if the log 
> level applies to current environment, as sometimes dumping log data is 
> quite resource consuming and not needed in production mode.
>
>
>
> Maybe it is good to introduce some cache for the isLoggable method as 
> there are just a few log levels and the result is not likely to change 
> in application execution time.
>
>
>
> Thanks for any thoughts.
>
>
>
> Regards,
>
>
>
> Patrick He
>
>
>
> _______________________________________________
> riena-dev mailing list
> riena-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/riena-dev
>
>



--
Elias Volanakis | Technical Lead | http://eclipsesource.com
elias@xxxxxxxxxxxxxxxxx | +1 503 929 5537 | @evolanakis
_______________________________________________
riena-dev mailing list
riena-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/riena-dev



Back to the top