geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r209377 - in /geronimo/trunk/modules: assembly/src/var/log/ kernel/src/java/org/apache/geronimo/kernel/log/ system/src/java/org/apache/geronimo/system/logging/log4j/ system/src/java/org/apache/geronimo/system/main/
Date Wed, 06 Jul 2005 01:29:16 GMT
Author: ammulder
Date: Tue Jul  5 18:29:15 2005
New Revision: 209377

URL: http://svn.apache.org/viewcvs?rev=209377&view=rev
Log:
By popular demand... -v and -vv, version info, etc.

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

Modified: geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties (original)
+++ geronimo/trunk/modules/assembly/src/var/log/server-log4j.properties Tue Jul  5 18:29:15
2005
@@ -19,7 +19,7 @@
 log4j.rootCategory=DEBUG, CONSOLE, FILE
 
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=WARN
+log4j.appender.CONSOLE.Threshold=${org.apache.geronimo.log.ConsoleLogLevel}
 log4j.appender.CONSOLE.Target=System.out
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
 log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/log/GeronimoLogging.java
Tue Jul  5 18:29:15 2005
@@ -31,6 +31,7 @@
     public static final GeronimoLogging FATAL = new GeronimoLogging("FATAL");
 
     private static boolean initialized = false;
+    private static GeronimoLogging consoleLogLevel;
     private static GeronimoLogging defaultLevel;
 
     /**
@@ -42,6 +43,7 @@
     public static void initialize(GeronimoLogging level) {
         if (!initialized) {
             defaultLevel = level;
+            consoleLogLevel = level;
 
             // force commons-logging to use our log factory
             System.setProperty(LogFactory.FACTORY_PROPERTY, GeronimoLogFactory.class.getName());
@@ -60,6 +62,15 @@
 
     public static GeronimoLogging getDefaultLevel() {
         return defaultLevel;
+    }
+
+
+    public static GeronimoLogging getConsoleLogLevel() {
+        return consoleLogLevel;
+    }
+
+    public static void setConsoleLogLevel(GeronimoLogging consoleLogLevel) {
+        GeronimoLogging.consoleLogLevel = consoleLogLevel;
     }
 
     private final String level;

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/log4j/Log4jService.java?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
Tue Jul  5 18:29:15 2005
@@ -37,6 +37,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.log.GeronimoLogFactory;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
@@ -303,6 +304,10 @@
         if (file == null) {
             return;
         }
+        
+        // Record the default console log level
+        System.setProperty("org.apache.geronimo.log.ConsoleLogLevel", GeronimoLogging.getConsoleLogLevel().toString());
+
         try {
             URLConfigurator.configure(file.toURL());
         } catch (MalformedURLException e) {

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java Tue
Jul  5 18:29:15 2005
@@ -51,31 +51,31 @@
  */
 public class Daemon {
     private final static String ARGUMENT_NO_PROGRESS="-noprogress";
+    private final static String ARGUMENT_VERBOSE="-v";
+    private final static String ARGUMENT_MORE_VERBOSE="-vv";
+    private static boolean started = false;
     private static Log log;
     private static final ObjectName PERSISTENT_CONFIGURATION_LIST_NAME_QUERY = JMXUtil.getObjectName("*:j2eeType=PersistentConfigurationList,*");
 
-    static {
-        System.out.println("Booting Geronimo Kernel (in Java "+System.getProperty("java.version")+")...");
-        System.out.flush();
-        // This MUST be done before the first log is acquired
-        GeronimoLogging.initialize(GeronimoLogging.WARN);
-        log = LogFactory.getLog(Daemon.class.getName());
-
-        // Install our url factory
-        GeronimoURLFactory.install();
-
-        // Install the lame tools jar hack
-        ToolsJarHack.install();
-    }
-
-
 
     private StartupMonitor monitor;
     private List configs = new ArrayList();
+    private String verboseArg = null;
+    private String progressArg = null;
 
     private Daemon(String[] args) {
+        // Very first startup tasks
         long start = System.currentTimeMillis();
+        System.out.println("Booting Geronimo Kernel (in Java "+System.getProperty("java.version")+")...");
+        System.out.flush();
+
+        // Command line arguments affect logging configuration, etc.
         processArguments(args);
+
+        // Initialization tasks that must run before anything else
+        initializeSystem();
+
+        // Now logging is available and
         log.info("Server startup begun");
         monitor.systemStarting(start);
         doStartup();
@@ -84,7 +84,15 @@
     private void processArguments(String[] args) {
         for (int i = 0; i < args.length; i++) {
             if(args[i].equals(ARGUMENT_NO_PROGRESS)) {
-                monitor = new SilentStartupMonitor();
+                progressArg = ARGUMENT_NO_PROGRESS;
+            } else if (args[i].equals(ARGUMENT_VERBOSE)) {
+                if(verboseArg == null) {
+                    verboseArg = ARGUMENT_VERBOSE;
+                }
+            } else if (args[i].equals(ARGUMENT_MORE_VERBOSE)) {
+                if(verboseArg == null) {
+                    verboseArg = ARGUMENT_MORE_VERBOSE;
+                }
             } else {
                 try {
                     configs.add(new URI(args[i]));
@@ -96,8 +104,27 @@
                 }
             }
         }
-        if(monitor == null) {
-            monitor = new ProgressBarStartupMonitor();
+    }
+
+    private void initializeSystem() {
+        if(!started) {
+            started = true;
+
+            // This MUST be done before the first log is acquired
+            GeronimoLogging.initialize(verboseArg == null ? GeronimoLogging.WARN : verboseArg
== ARGUMENT_VERBOSE ? GeronimoLogging.INFO : GeronimoLogging.DEBUG);
+            log = LogFactory.getLog(Daemon.class.getName());
+
+            // Install our url factory
+            GeronimoURLFactory.install();
+
+            // Install the lame tools jar hack
+            ToolsJarHack.install();
+
+            if(verboseArg != null || progressArg != null) {
+                monitor = new SilentStartupMonitor();
+            } else {
+                monitor = new ProgressBarStartupMonitor();
+            }
         }
     }
 

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/ProgressBarStartupMonitor.java
Tue Jul  5 18:29:15 2005
@@ -143,6 +143,7 @@
             Set gbeans = kernel.listGBeans(new ObjectName("*:*"));
             Map beanInfos = new HashMap(); // key = GBeanInfo, value = List (of attribute
names)
             List ports = new ArrayList(); // type = AddressHolder
+            ObjectName serverInfo = null;
             boolean firstApp = true;
             for (Iterator it = gbeans.iterator(); it.hasNext();) {
                 ObjectName name = (ObjectName) it.next();
@@ -154,6 +155,9 @@
                     out.println("    "+decodeModule(name.getKeyProperty("j2eeType"))+": "+name.getKeyProperty("name"));
                 }
                 GBeanInfo info = kernel.getGBeanInfo(name);
+                if(info.getClassName().equals("org.apache.geronimo.system.serverinfo.ServerInfo"))
{
+                    serverInfo = name;
+                }
                 List list = (List) beanInfos.get(info);
                 if(list == null) {
                     list = new ArrayList(3);
@@ -214,6 +218,12 @@
                     out.println(buf.toString());
                 }
             }
+            StringBuffer msg = new StringBuffer();
+            msg.append("Geronimo Application Server started");
+            if(serverInfo != null) {
+                msg.append(" (version ").append(kernel.getAttribute(serverInfo, "version")+")");
+            }
+            out.println(msg.toString());
             out.flush();
         } catch (MalformedObjectNameException e) {
             e.printStackTrace();

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java?rev=209377&r1=209376&r2=209377&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/SilentStartupMonitor.java
Tue Jul  5 18:29:15 2005
@@ -29,14 +29,18 @@
     }
 
     public void startupFinished() {
+        System.out.println("Geronimo startup complete");
     }
 
     public void serverStartFailed(Exception problem) {
+        System.out.println("Geronimo startup failed");
     }
 
     public void loadFailed(String configuration, Exception problem) {
+        problem.printStackTrace();
     }
 
     public void startFailed(String configuration, Exception problem) {
+        problem.printStackTrace();
     }
 }



Mime
View raw message