cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Pötz <reinh...@apache.org>
Subject Re: @Logger in RestController or independent?
Date Fri, 15 Jul 2011 14:00:09 GMT
On 07/13/2011 08:12 PM, Thorsten Scherler wrote:
> Hi all,
>
> I developed a small @Logger annotation for a customer project which I
> would like to contribute. The question is ATM what is the best way?
>
> ATM I have implemented the annotation based on an independent
> BeanPostProcessor which I then invoke with adding
> <!-- logger annotation implementation -->
>    <bean class="org.apache.cocoon.common.LoggerInjector"/>
>
> Basically the class is doing:
> if (field.getAnnotation(Logger.class) != null) {
>                      Log log = LogFactory.getLog(bean.getClass());
>                      field.set(bean, log);
>                  }
>
> I saw SpringRESTController and I wonder whether we should add it there
> in getController as  populateLogger(configuration, unpackedController,
> annotatedFields);
>
> or to leave it independent to allow usages as well in REST independent
> components such as generators, etc.

Injection logger instances is already supported. You can use the 
org.apache.cocoon.rest.controller.annotation.Inject annotation on a 
field of type org.apache.commons.logging.Log.

BTW, in the beta phase we should move our codebase to slf4j ...

-- 
Reinhard Pötz         Founder & Managing Director, Indoqa and Deepsearch
                         http://www.indoqa.com/people/reinhard-poetz.html

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member                  reinhard@apache.org
________________________________________________________________________

       Furthermore, I think Oracle has to honor the JSPA agreement.
     http://s.apache.org/JCPIsDead       http://s.apache.org/tck-trap

Mime
View raw message