You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by nb...@apache.org on 2006/03/06 18:52:49 UTC

svn commit: r383599 - in /jakarta/velocity/engine/trunk/src: java/org/apache/velocity/runtime/ java/org/apache/velocity/runtime/log/ test/org/apache/velocity/test/

Author: nbubna
Date: Mon Mar  6 09:52:45 2006
New Revision: 383599

URL: http://svn.apache.org/viewcvs?rev=383599&view=rev
Log:
deprecate log message prefixes in RuntimeConstants and move them to LogChute

Modified:
    jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java
    jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java
    jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/LogChute.java
    jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/StandardOutLogChute.java
    jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java

Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=383599&r1=383598&r2=383599&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java (original)
+++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeConstants.java Mon Mar  6 09:52:45 2006
@@ -1,7 +1,7 @@
 package org.apache.velocity.runtime;
 
 /*
- * Copyright 2000-2004 The Apache Software Foundation.
+ * Copyright 2000-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -85,14 +85,17 @@
     public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID  =
         "runtime.log.invalid.references";
 
-    /**
-     *  Log message prefixes
-     */
+    /** @deprecated Use LogChute.TRACE_PREFIX instead */
     public final static String TRACE_PREFIX = " [trace] ";
+    /** @deprecated Use LogChute.DEBUG_PREFIX instead */
     public final static String DEBUG_PREFIX = " [debug] ";
+    /** @deprecated Use LogChute.INFO_PREFIX instead */
     public final static String INFO_PREFIX  = "  [info] ";
+    /** @deprecated Use LogChute.WARN_PREFIX instead */
     public final static String WARN_PREFIX  = "  [warn] ";
+    /** @deprecated Use LogChute.ERROR_PREFIX instead */
     public final static String ERROR_PREFIX = " [error] ";
+    /** @deprecated This will be removed in a future version */
     public final static String UNKNOWN_PREFIX = " [unknown] ";
 
     /*

Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java?rev=383599&r1=383598&r2=383599&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java (original)
+++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/AvalonLogChute.java Mon Mar  6 09:52:45 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -112,23 +112,23 @@
          */
         switch (level) 
         {
-            case LogChute.WARN_ID:
-                logger.warn( RuntimeConstants.WARN_PREFIX + message );
+            case WARN_ID:
+                logger.warn(WARN_PREFIX + message );
                 break;
-            case LogChute.INFO_ID:
-                logger.info( RuntimeConstants.INFO_PREFIX + message);
+            case INFO_ID:
+                logger.info(INFO_PREFIX + message);
                 break;
-            case LogChute.DEBUG_ID:
-                logger.debug( RuntimeConstants.DEBUG_PREFIX + message);
+            case DEBUG_ID:
+                logger.debug(DEBUG_PREFIX + message);
                 break;
-            case LogChute.TRACE_ID:
-                logger.debug(RuntimeConstants.TRACE_PREFIX + message);
+            case TRACE_ID:
+                logger.debug(TRACE_PREFIX + message);
                 break;
-            case LogChute.ERROR_ID:
-                logger.error(RuntimeConstants.ERROR_PREFIX + message);
+            case ERROR_ID:
+                logger.error(ERROR_PREFIX + message);
                 break;
             default:
-                logger.info( message);
+                logger.info(message);
                 break;
         }
     }
@@ -143,20 +143,20 @@
     {
         switch (level) 
         {
-            case LogChute.WARN_ID:
-                logger.warn(RuntimeConstants.WARN_PREFIX + message, t);
+            case WARN_ID:
+                logger.warn(WARN_PREFIX + message, t);
                 break;
-            case LogChute.INFO_ID:
-                logger.info(RuntimeConstants.INFO_PREFIX + message, t);
+            case INFO_ID:
+                logger.info(INFO_PREFIX + message, t);
                 break;
-            case LogChute.DEBUG_ID:
-                logger.debug(RuntimeConstants.DEBUG_PREFIX + message, t);
+            case DEBUG_ID:
+                logger.debug(DEBUG_PREFIX + message, t);
                 break;
-            case LogChute.TRACE_ID:
-                logger.debug(RuntimeConstants.TRACE_PREFIX + message, t);
+            case TRACE_ID:
+                logger.debug(TRACE_PREFIX + message, t);
                 break;
-            case LogChute.ERROR_ID:
-                logger.error(RuntimeConstants.ERROR_PREFIX + message, t);
+            case ERROR_ID:
+                logger.error(ERROR_PREFIX + message, t);
                 break;
             default:
                 logger.info(message, t);
@@ -172,14 +172,14 @@
         switch (level)
         {
             // For Avalon, no Trace exists. Log at debug level.
-            case LogChute.TRACE_ID:
-            case LogChute.DEBUG_ID:
+            case TRACE_ID:
+            case DEBUG_ID:
                 return logger.isDebugEnabled();
-            case LogChute.INFO_ID:
+            case INFO_ID:
                 return logger.isInfoEnabled();
-            case LogChute.WARN_ID:
+            case WARN_ID:
                 return logger.isWarnEnabled();
-            case LogChute.ERROR_ID:
+            case ERROR_ID:
                 return logger.isErrorEnabled();
             default:
                 return true;

Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/LogChute.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/LogChute.java?rev=383599&r1=383598&r2=383599&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/LogChute.java (original)
+++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/LogChute.java Mon Mar  6 09:52:45 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -29,29 +29,34 @@
  */
 public interface LogChute
 {
-    /**
-     * ID for trace messages.
-     */
+    /** Prefix string for trace messages. */
+    public final static String TRACE_PREFIX = " [trace] ";
+
+    /** Prefix string for debug messages. */
+    public final static String DEBUG_PREFIX = " [debug] ";
+
+    /** Prefix string for info messages. */
+    public final static String INFO_PREFIX  = "  [info] ";
+
+    /** Prefix string for warn messages. */
+    public final static String WARN_PREFIX  = "  [warn] ";
+
+    /** Prefix string for error messages. */
+    public final static String ERROR_PREFIX = " [error] ";
+
+    /** ID for trace messages. */
     public final static int TRACE_ID = -1;
 
-    /**
-     * ID for debug messages.
-     */
+    /** ID for debug messages. */
     public final static int DEBUG_ID = 0;
 
-    /** 
-     * ID for info messages.
-     */
+    /** ID for info messages. */
     public final static int INFO_ID = 1;
     
-    /** 
-     * ID for warning messages.
-     */
+    /** ID for warning messages. */
     public final static int WARN_ID = 2;
 
-    /** 
-     * ID for error messages.
-     */
+    /** ID for error messages. */
     public final static int ERROR_ID = 3;
 
     /**

Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/StandardOutLogChute.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/StandardOutLogChute.java?rev=383599&r1=383598&r2=383599&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/StandardOutLogChute.java (original)
+++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/StandardOutLogChute.java Mon Mar  6 09:52:45 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -62,18 +62,18 @@
     {
         switch (level)
         {
-            case LogChute.WARN_ID:
-                return RuntimeConstants.WARN_PREFIX;
-            case LogChute.INFO_ID:
-                return RuntimeConstants.INFO_PREFIX ;
-            case LogChute.DEBUG_ID:
-                return RuntimeConstants.DEBUG_PREFIX;
-            case LogChute.TRACE_ID:
-                return RuntimeConstants.TRACE_PREFIX;
-            case LogChute.ERROR_ID:
-                return RuntimeConstants.ERROR_PREFIX;
+            case WARN_ID:
+                return WARN_PREFIX;
+            case INFO_ID:
+                return INFO_PREFIX ;
+            case DEBUG_ID:
+                return DEBUG_PREFIX;
+            case TRACE_ID:
+                return TRACE_PREFIX;
+            case ERROR_ID:
+                return ERROR_PREFIX;
             default:
-                return RuntimeConstants.UNKNOWN_PREFIX;
+                return INFO_PREFIX;
         }
     }
 

Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java?rev=383599&r1=383598&r2=383599&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java Mon Mar  6 09:52:45 2006
@@ -1,7 +1,7 @@
 package org.apache.velocity.test;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License")
  * you may not use this file except in compliance with the License.
@@ -96,27 +96,27 @@
          */
         switch( level )
         {
-            case LogChute.DEBUG_ID :
-                out = VelocityEngine.DEBUG_PREFIX;
+            case DEBUG_ID :
+                out = DEBUG_PREFIX;
                 break;
-            case LogChute.INFO_ID :
-                out = VelocityEngine.INFO_PREFIX;
+            case INFO_ID :
+                out = INFO_PREFIX;
                 break;
-            case LogChute.TRACE_ID :
-                out = VelocityEngine.TRACE_PREFIX;
+            case TRACE_ID :
+                out = TRACE_PREFIX;
                 break;
-            case LogChute.WARN_ID :
-                out = VelocityEngine.WARN_PREFIX;
+            case WARN_ID :
+                out = WARN_PREFIX;
                 break;
-            case LogChute.ERROR_ID :
-                out = VelocityEngine.ERROR_PREFIX;
+            case ERROR_ID :
+                out = ERROR_PREFIX;
                 break;
             default :
-                out = VelocityEngine.UNKNOWN_PREFIX;
+                out = INFO_PREFIX;
                 break;
         }
 
-        logString =  out + message;
+        logString = out + message;
     }
 
     public void log(int level, String message, Throwable t)



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