ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/listener Log4jListener.java
Date Fri, 29 Oct 2004 08:54:33 GMT
peterreilly    2004/10/29 01:54:33

  Modified:    .        WHATSNEW build.xml
               src/main/org/apache/tools/ant/listener Log4jListener.java
  Log:
  Use org.apache.log4j.Logger instead of org.apache.log4j.Category
  PR: 31951
  Obtained from: J.M. (Martijn) Kruithof
  
  Revision  Changes    Path
  1.679     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.678
  retrieving revision 1.679
  diff -u -r1.678 -r1.679
  --- WHATSNEW	28 Oct 2004 08:47:26 -0000	1.678
  +++ WHATSNEW	29 Oct 2004 08:54:32 -0000	1.679
  @@ -96,6 +96,9 @@
   
   * New attribute alwayslog for <redirector> type.
   
  +* Use org.apache.log4j.Logger instead of org.apache.log4j.Category.
  +  Bugzilla Report 31951.
  +
   Fixed bugs:
   -----------
   
  
  
  
  1.439     +2 -2      ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.438
  retrieving revision 1.439
  diff -u -r1.438 -r1.439
  --- build.xml	29 Oct 2004 07:35:17 -0000	1.438
  +++ build.xml	29 Oct 2004 08:54:32 -0000	1.439
  @@ -461,7 +461,7 @@
                  classname="jdepend.framework.JDepend"
                  classpathref="classpath"/>
       <available property="log4j.present"
  -               classname="org.apache.log4j.Category"
  +               classname="org.apache.log4j.Logger"
                  classpathref="classpath"/>
       <available property="commons.logging.present"
                  classname="org.apache.commons.logging.LogFactory"
  @@ -1652,4 +1652,4 @@
             description="--> creates a minimum distribution in ./dist"
             depends="dist-lite"/>
   
  -</project>
  \ No newline at end of file
  +</project>
  
  
  
  1.17      +26 -26    ant/src/main/org/apache/tools/ant/listener/Log4jListener.java
  
  Index: Log4jListener.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/listener/Log4jListener.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Log4jListener.java	9 Mar 2004 16:48:03 -0000	1.16
  +++ Log4jListener.java	29 Oct 2004 08:54:33 -0000	1.17
  @@ -17,7 +17,7 @@
   
   package org.apache.tools.ant.listener;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.helpers.NullEnumeration;
   import org.apache.tools.ant.BuildEvent;
   import org.apache.tools.ant.BuildListener;
  @@ -40,12 +40,12 @@
        */
       public Log4jListener() {
           initialized = false;
  -        Category cat = Category.getInstance("org.apache.tools.ant");
  -        Category rootCat = Category.getRoot();
  -        if (!(rootCat.getAllAppenders() instanceof NullEnumeration)) {
  +        Logger log = Logger.getLogger("org.apache.tools.ant");
  +        Logger rootLog = Logger.getRootLogger();
  +        if (!(rootLog.getAllAppenders() instanceof NullEnumeration)) {
               initialized = true;
           } else {
  -            cat.error("No log4j.properties in build area");
  +            log.error("No log4j.properties in build area");
           }
       }
   
  @@ -54,8 +54,8 @@
        */
       public void buildStarted(BuildEvent event) {
           if (initialized) {
  -            Category cat = Category.getInstance(Project.class.getName());
  -            cat.info("Build started.");
  +            Logger log = Logger.getLogger(Project.class.getName());
  +            log.info("Build started.");
           }
       }
   
  @@ -64,11 +64,11 @@
        */
       public void buildFinished(BuildEvent event) {
           if (initialized) {
  -            Category cat = Category.getInstance(Project.class.getName());
  +            Logger log = Logger.getLogger(Project.class.getName());
               if (event.getException() == null) {
  -                cat.info("Build finished.");
  +                log.info("Build finished.");
               } else {
  -                cat.error("Build finished with error.", event.getException());
  +                log.error("Build finished with error.", event.getException());
               }
           }
       }
  @@ -78,8 +78,8 @@
        */
       public void targetStarted(BuildEvent event) {
           if (initialized) {
  -            Category cat = Category.getInstance(Target.class.getName());
  -            cat.info("Target \"" + event.getTarget().getName() + "\" started.");
  +            Logger log = Logger.getLogger(Target.class.getName());
  +            log.info("Target \"" + event.getTarget().getName() + "\" started.");
           }
       }
   
  @@ -89,7 +89,7 @@
       public void targetFinished(BuildEvent event) {
           if (initialized) {
               String targetName = event.getTarget().getName();
  -            Category cat = Category.getInstance(Target.class.getName());
  +            Logger cat = Logger.getLogger(Target.class.getName());
               if (event.getException() == null) {
                   cat.info("Target \"" + targetName + "\" finished.");
               } else {
  @@ -105,8 +105,8 @@
       public void taskStarted(BuildEvent event) {
           if (initialized) {
               Task task = event.getTask();
  -            Category cat = Category.getInstance(task.getClass().getName());
  -            cat.info("Task \"" + task.getTaskName() + "\" started.");
  +            Logger log = Logger.getLogger(task.getClass().getName());
  +            log.info("Task \"" + task.getTaskName() + "\" started.");
           }
       }
   
  @@ -116,11 +116,11 @@
       public void taskFinished(BuildEvent event) {
           if (initialized) {
               Task task = event.getTask();
  -            Category cat = Category.getInstance(task.getClass().getName());
  +            Logger log = Logger.getLogger(task.getClass().getName());
               if (event.getException() == null) {
  -                cat.info("Task \"" + task.getTaskName() + "\" finished.");
  +                log.info("Task \"" + task.getTaskName() + "\" finished.");
               } else {
  -                cat.error("Task \"" + task.getTaskName()
  +                log.error("Task \"" + task.getTaskName()
                       + "\" finished with error.", event.getException());
               }
           }
  @@ -139,26 +139,26 @@
                   }
               }
   
  -            Category cat
  -                = Category.getInstance(categoryObject.getClass().getName());
  +            Logger log
  +                = Logger.getLogger(categoryObject.getClass().getName());
               switch (event.getPriority()) {
                   case Project.MSG_ERR:
  -                    cat.error(event.getMessage());
  +                    log.error(event.getMessage());
                       break;
                   case Project.MSG_WARN:
  -                    cat.warn(event.getMessage());
  +                    log.warn(event.getMessage());
                       break;
                   case Project.MSG_INFO:
  -                    cat.info(event.getMessage());
  +                    log.info(event.getMessage());
                       break;
                   case Project.MSG_VERBOSE:
  -                    cat.debug(event.getMessage());
  +                    log.debug(event.getMessage());
                       break;
                   case Project.MSG_DEBUG:
  -                    cat.debug(event.getMessage());
  +                    log.debug(event.getMessage());
                       break;
                   default:
  -                    cat.error(event.getMessage());
  +                    log.error(event.getMessage());
                       break;
               }
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message