On May 14, 2010, at 11:53 PM, Thorbjørn Ravn Andersen wrote:

> Den 15/05/10 08.29, Ralph Goers (JIRA) skrev:
>> My experimental branch uses annotations for Logj components, but still does 
>> not address my desire to allow applications to inject logging.
>>   
> Annotations are just meta-information.  You will need the classloader to take 
> special action on them for anything to happen.

That depends if it is a compile time annotation or runtime annotation. With 
Java 6 compile time annotations can leverage the annotation processor during 
compilation to do all sorts of interesting things.
 
> 
> I am cracking the nut of how to get "@Inject Logger log" to work properly 
> with slf4j in a JEE 6 setting - I believe it is a case of a correctly placed 
> @Producer.  Is this similar to what you want to solve?


I haven't sat down and spec'd it out but something like:

@Logger Logger logger;

@LogFlow
public class MyClass {

        public void method1(String parm1) {
        ...
        }
}

which would inject the logger and the entry and exit tracing. It would be even 
better if you could do


        public void method1(String parm1) {
                ...
                @debug result = callService(parm1);
         }

and have the debug generate a message like "callService with parm1=value 
returned result n" or "calling callService with parm 1" followed by 
"callService returned result n".

Unfortunately, I don't believe this is possible since annotations aren't 
allowed on a statement.

Ralph


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to