[cvs] expresso commit by lhamel: cosmetic improvements

JCorporate Ltd jcorp at jcorporate.com
Sat Jan 29 23:38:39 UTC 2005


Log Message:
-----------
cosmetic improvements

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging:
        DBAppender.java

Revision Data
-------------
Index: DBAppender.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging/DBAppender.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging/DBAppender.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging/DBAppender.java -u -r1.15 -r1.16
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging/DBAppender.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/logging/DBAppender.java
@@ -80,7 +80,6 @@
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 
-
 /**
  * JDBC type appender for Log4j
  *
@@ -94,11 +93,8 @@
     private static final int WARN = Priority.WARN.toInt();
     private static final int INFO = Priority.INFO.toInt();
     private static final int DEBUG = Priority.DEBUG.toInt();
-    private static final String thisClass = "com.jcorporate.expresso.core.logging.DBAppender.";
+    private static final String thisClass = DBAppender.class.getName() + ".";
 
-    /**
-     *
-     */
     public DBAppender() {
     } /* DBAppender() */
 
@@ -110,20 +106,15 @@
     } /* requiresLayout() */
 
     /**
-     * Uses Expresso's Log Handler.
-     *
-     * @param parm1 no longer used
+     * append a message
      */
     protected void append(LoggingEvent parm1) {
-        final String myName = "com.jcorporate.expresso.core.logging.DBAppender";
         String theMessage = layout.format(parm1);
         String theColor = "R";
 
         //Determine Color based upon the priority of the message.
         int priorityInt = parm1.getLevel().toInt();
 
-
-
         //Filter the possible priorities into the standard four colors
         if (priorityInt <= DEBUG) {
             theColor = "G";
@@ -152,9 +143,8 @@
                         parm1.getThrowableInformation().getThrowable());
             }
         } catch (LogException e) {
-
             //TODO: Maybe need to use an Error Handler Class Instead?????
-            LogLog.error(myName + ":Unable to log message '" + theMessage +
+            LogLog.error(thisClass + ":Unable to log message '" + theMessage +
                     "' from category '" + parm1.getLoggerName() + "':", e);
         }
     } /* append(LoggingEvent) */
@@ -168,7 +158,6 @@
      */
     protected static void log(String objectName, Throwable e)
             throws LogException {
-        String myName = (thisClass + "log(String, Exception)");
         String message = e.getMessage();
 
         if (e instanceof DBException) {
@@ -184,6 +173,7 @@
             myLog.setField("ObjectName", objectName);
             LogHandler.staticAddToQueue(myLog);
         } catch (DBException de) {
+            String myName = (thisClass + "log(String, Exception)");
             throw new LogException(myName + ":" + de.getMessage());
         }
     } /* log(String, Throwable) */
@@ -197,14 +187,9 @@
      * @param objectName   Calling object
      * @param msg          Message to log
      * @param color        Color to log the message with.  One character 'R' 'G' 'B' or 'Y'
-     * @throws LogException if the message cannot be logged
      */
     protected static void log(int messageLevel, String objectName, String msg,
-                              String color)
-            throws LogException {
-        String myName = (thisClass + "log(int, String, String, " +
-                "String)");
-
+                              String color) {
         try {
             LogEntry myLog = new LogEntry(SecuredDBObject.SYSTEM_ACCOUNT);
             myLog.setField("ObjectName", objectName);
@@ -215,9 +200,10 @@
             LogHandler.staticAddToQueue(myLog);
         } catch (DBException de) {
 
-            //Caught an exception. Log it to the loglog facility.
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             de.printStackTrace(new PrintStream(bos));
+            String myName = (thisClass + "log(int, String, String, " +
+                    "String)");
             LogLog.error(myName + ":Unable to log '" + msg + "'" +
                     bos.toString());
         }
@@ -225,10 +211,9 @@
 
 
     /**
-     *
+     * flush items
      */
     public void close() {
-        final String myName = thisClass + "close()";
 
         try {
             LogHandler.flush();
@@ -237,6 +222,7 @@
             //Caught an exception. Log it to the loglog facility.
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             e.printStackTrace(new PrintStream(bos));
+            final String myName = thisClass + "close()";
             LogLog.error(myName + ":Unable to flush LogHandler '" +
                     e.getMessage() + "'" + bos.toString());
         }


More information about the cvs mailing list