I'm trying to implement a tracing aspect using the pertypewithin instantiation model.
In this way, I'll be able to use one logger per class per type.
From some examples arround the we I can find this code to init the logger:
public abstract aspect TraceAspect pertypewithin(com.something.*) {
abstract pointcut traced();
after() : staticinitialization(*) {
logger = Logger.getLogger(getWithinTypeName());
}
before() : traced() {
logger.log(...);
}
//....
}
unfortunately, I'm not able to fully translate this to the @AspectJ syntax (it's a project requirement outside my control), especially the part in with I need to setup the logger, executing that code only once.
Is this possible?
Thanks,
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…