DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901

           Summary: Log4j Configurator Task
           Product: Ant
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


In some build systems log4j never gets configured.  I have created a Log4J ant
task which configurates the and set the levels.  It is so simple.


package util;

public class Log4jAntTask extends org.apache.tools.ant.Task {
        String level;

        public Log4jAntTask(){
                org.apache.log4j.BasicConfigurator.configure();
               
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.toLevel(level));
                   
                org.apache.log4j.Logger.getRootLogger().setAdditivity(true);   
                

        }
        public void setLevel(String level){
                this.level=level;
        }    
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to