geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r515439 - in /geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system: logging/log4j/Log4jService.java main/Daemon.java
Date Wed, 07 Mar 2007 03:36:27 GMT
Author: jdillon
Date: Tue Mar  6 19:36:26 2007
New Revision: 515439

URL: http://svn.apache.org/viewvc?view=rev&rev=515439
Log:
(GERONIMO-2741) Port logging updates to 1.2, limits default console output

Modified:
    geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
    geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java

Modified: geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java?view=diff&rev=515439&r1=515438&r2=515439
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
Tue Mar  6 19:36:26 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/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java?view=diff&rev=515439&r1=515438&r2=515439
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
(original)
+++ geronimo/server/branches/1.2/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
Tue Mar  6 19:36:26 2007
@@ -160,22 +160,29 @@
 
             // 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!)
-            // 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);
+            
+            // This MUST be done before the first log is acquired (which the startup monitor
below does)
+            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
@@ -197,13 +204,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 the non-existent
directory: " + tmpDir);
+                System.exit(1);
+                throw new AssertionError();
+            }
 
             // Determine the geronimo installation directory
             File geronimoInstallDirectory = DirectoryUtils.getGeronimoInstallDirectory();



Mime
View raw message