[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] initialize aspect attributes

Hello, I have this aspect, and I don0t how I can initialize logger: For "initialize" --> execute  logger.addAppender(appender), and this method I don't know where can I type it. Where should you type this code to add an appender to my logger?

package org;

public aspect LogAspect {
    protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("aspectLog");
    protected org.apache.log4j.SimpleLayout layout = new org.apache.log4j.SimpleLayout();
    protected org.apache.log4j.FileAppender appender = new org.apache.log4j.FileAppender(layout,"log.txt",false);
    pointcut sets (org.ProvaClass p, int value) : call (void org.ProvaClass.set*(int)) && target(p) && args(value);
    before (org.ProvaClass p, int value) : sets(p,value){