geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r513066 - in /geronimo/server/trunk/modules: geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/ geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/ geronimo-system/src/main/java/org/apache/geronimo/system/main/
Date Wed, 28 Feb 2007 23:38:39 GMT
Author: jdillon
Date: Wed Feb 28 15:38:38 2007
New Revision: 513066

URL: http://svn.apache.org/viewvc?view=rev&rev=513066
Log:
(GERONIMO-2741) Clean up logging output on console

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/GeronimoLogging.java?view=diff&rev=513066&r1=513065&r2=513066
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
Wed Feb 28 15:38:38 2007
@@ -55,7 +55,12 @@
 
             // force the log factory to initialize
             LogFactory.getLog(GeronimoLogging.class);
-
+            
+            //
+            // FIXME: Replace the bits below with this:
+            //
+            // System.setProperty("mx4j.log.prototype", "mx4j.log.CommonsLogger");
+            
             // force mx4j to use commons logging
             // Use reflection so mx4j is not required (this is important in JDK 1.5)
             // mx4j.log.Log.redirectTo(new mx4j.log.CommonsLogger());

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java?view=diff&rev=513066&r1=513065&r2=513066
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
Wed Feb 28 15:38:38 2007
@@ -512,6 +512,8 @@
         File file = resolveConfigurationFile();
         if (file == null || !file.exists()) {
             return;
+        } else {
+            lastChanged = file.lastModified();
         }
 
         // Record the default console log level
@@ -552,23 +554,8 @@
     public void doStart() {
         LogFactory logFactory = LogFactory.getFactory();
         if (logFactory instanceof GeronimoLogFactory) {
-            synchronized (this) {
-                timer = new Timer(true);
-
-                // Periodically check the configuration file
-                schedule();
-
-                // Make sure the root Logger has loaded
-                Logger logger = LogManager.getRootLogger();
-
-                reconfigure();
-
-                File file = resolveConfigurationFile();
-                if (file != null) {
-                    lastChanged = file.lastModified();
-                }
-                logEnvInfo(logger);
-            }
+            // Make sure the root Logger has loaded
+            Logger logger = LogManager.getRootLogger();
 
             // Change all of the loggers over to use log4j
             GeronimoLogFactory geronimoLogFactory = (GeronimoLogFactory) logFactory;
@@ -577,6 +564,17 @@
                     geronimoLogFactory.setLogFactory(new CachingLog4jLogFactory());
                 }
             }
+
+            synchronized (this) {
+                reconfigure();
+
+                timer = new Timer(true);
+
+                // Periodically check the configuration file
+                schedule();
+            }
+
+            logEnvInfo();
         }
 
         synchronized (this) {
@@ -608,8 +606,9 @@
         }
     }
 
-    private void logEnvInfo(Logger log) {
+    private void logEnvInfo() {
        try {
+          Log log = LogFactory.getLog(Log4jService.class);
           log.info("----------------------------------------------");
           log.info("Started Logging Service");
           log.debug("Log4jService created with configFileName=" + this.configurationFile
+
@@ -640,9 +639,7 @@
           log.info("  System property [sun.boot.class.path] = " + System.getProperty("sun.boot.class.path"));
           log.info("----------------------------------------------");
        } catch (Exception e) {
-          String msg = "Exception caught during logging of Runtime Information.  Exception="
+ e.toString();
-          log.error(msg);
-          System.err.println(msg);
+          System.err.println("Exception caught during logging of Runtime Information.  Exception="
+ e.toString());
        }
     }
 

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java?view=diff&rev=513066&r1=513065&r2=513066
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
Wed Feb 28 15:38:38 2007
@@ -160,27 +160,43 @@
 
             // Perform initialization tasks common with the various Geronimo environments
             GeronimoEnvironment.init();
-
-            // This MUST be done before the first log is acquired (WHICH THE STARTUP MONITOR
5 LINES LATER DOES!)
+            
+            //
+            // FIXME: Allow -v -> INFO, -vv -> DEBUG, -vvv -> TRACE
+            //
+            
+            // This MUST be done before the first log is acquired (which the startup monitor
below does)
             // Generally we want to suppress anything but WARN until the log GBean starts
up
-            GeronimoLogging.initialize(verboseArg == null || verboseArg.equals(ARGUMENT_VERBOSE)
? GeronimoLogging.WARN : GeronimoLogging.DEBUG);
-            // The following will be used once the log GBean starts up
-            GeronimoLogging.setConsoleLogLevel(verboseArg == null ? GeronimoLogging.INFO
: verboseArg.equals(ARGUMENT_VERBOSE) ? GeronimoLogging.DEBUG : GeronimoLogging.TRACE);
+            GeronimoLogging level = GeronimoLogging.WARN;
+            if (verboseArg != null) {
+                if (verboseArg.equals(ARGUMENT_VERBOSE)) {
+                    level = GeronimoLogging.DEBUG;
+                } else if (verboseArg.equals(ARGUMENT_MORE_VERBOSE)) {
+                    level = GeronimoLogging.TRACE;
+                }
+            }
+            GeronimoLogging.initialize(level);
+            
             log = LogFactory.getLog(Daemon.class.getName());
         }
 
         if (verboseArg != null || noProgressArg != null) {
             monitor = new SilentStartupMonitor();
         } else {
-            if (longProgressArg != null)
+            if (longProgressArg != null) {
                 monitor = new LongStartupMonitor();
-            else
+            } else {
                 monitor = new ProgressBarStartupMonitor();
+            }
         }
 
         // JVMCheck();   // Removed for 1.1
     }
 
+    //
+    // FIXME: This is not used...
+    //
+    
     private void JVMCheck() {
         String jvmVersion = System.getProperty("java.specification.version");
         if (! jvmVersion.equals("1.4"))
@@ -197,13 +213,11 @@
             // since we allow it to be configured in geronimo.bat and geronimo.sh
             // (since 1.0 release) the same way Tomcat allows it to be configured.
             String tmpDir = System.getProperty("java.io.tmpdir");
-            if (tmpDir == null || (!(new File(tmpDir)).exists()) ||
-                    (!(new File(tmpDir)).isDirectory())) {
-                    System.err.println("The java.io.tmpdir system property specifies the
"+
-                            "non-existent directory " +tmpDir);
-                    System.exit(1);
-                    throw new AssertionError();
-                }
+            if (tmpDir == null || (!(new File(tmpDir)).exists()) || (!(new File(tmpDir)).isDirectory()))
{
+                System.err.println("The java.io.tmpdir system property specifies a non-existent
directory: "  + tmpDir);
+                System.exit(1);
+                throw new AssertionError();
+            }
 
             // Determine the geronimo installation directory
             File geronimoInstallDirectory = DirectoryUtils.getGeronimoInstallDirectory();
@@ -332,7 +346,11 @@
             throw new AssertionError();
         }
     }
-
+    
+    //
+    // FIXME: This is not used...
+    //
+    
     private void AddToSystemProperty(String propertyName, List dirsFromManifest, File geronimoInstallDirectory)
{
         String dirs = System.getProperty(propertyName, "");
         for (Iterator iterator = dirsFromManifest.iterator(); iterator.hasNext();) {



Mime
View raw message