You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Gurkan Erdogdu <gu...@yahoo.com> on 2010/08/20 15:04:54 UTC
ERROR : Static Logger Usage
Hello folks,
As you have already know, we have been using "static loggers" in our codes. But
using those libraries in Java EE containers, problems have occured.
For example, in Tomcat, Loggers are configured per classloader. When application
is undeployed all of the handlers of application loggers are removed. Therefore,
after undeploying the first applications, other applications that use the same
class are suffered from logging. i.e
For example,
private static final WebBeansLogger logger = .....
When first application is deployed, it sets logger. When it is undeplyed, logger
is reset and no application is able to use it.
I think to change all loggers from static to normal ?
WDYT?
Thanks;
--Gurkan
Re: ERROR : Static Logger Usage
Posted by Gerhard <ge...@gmail.com>.
hi,
+1 (see [1] and esp. [2]).
just if there are really a lot of instances of a class, we would see a
noticeable performance impact -> we have to treat such cases differently.
furthermore, it's possible to benefit from inheritance - e.g. in case of
jul:
protected final Logger logger = Logger.getLogger(getClass().getName());
regards,
gerhard
[1] http://www.slf4j.org/faq.html#declared_static
[2] http://wiki.apache.org/commons/Logging/StaticLog
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
2010/8/20 Gurkan Erdogdu <gu...@yahoo.com>
> Hello folks,
>
> As you have already know, we have been using "static loggers" in our codes.
> But
> using those libraries in Java EE containers, problems have occured.
>
>
> For example, in Tomcat, Loggers are configured per classloader. When
> application
> is undeployed all of the handlers of application loggers are removed.
> Therefore,
> after undeploying the first applications, other applications that use the
> same
> class are suffered from logging. i.e
>
> For example,
>
> private static final WebBeansLogger logger = .....
>
> When first application is deployed, it sets logger. When it is undeplyed,
> logger
> is reset and no application is able to use it.
>
> I think to change all loggers from static to normal ?
>
> WDYT?
>
> Thanks;
>
> --Gurkan
>
>
>