incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r763238 - in /incubator/sling/trunk: contrib/launchpad/jcrapp/pom.xml launchpad/app/pom.xml launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java
Date Wed, 08 Apr 2009 13:27:29 GMT
Author: bdelacretaz
Date: Wed Apr  8 13:27:28 2009
New Revision: 763238

URL: http://svn.apache.org/viewvc?rev=763238&view=rev
Log:
SLING-918 - upgrade pax-web-service to 0.5.1, and make sure MainDelegate displays HTTP port
number, as pax-web-service doesn't display it anymore

Modified:
    incubator/sling/trunk/contrib/launchpad/jcrapp/pom.xml
    incubator/sling/trunk/launchpad/app/pom.xml
    incubator/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java

Modified: incubator/sling/trunk/contrib/launchpad/jcrapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/jcrapp/pom.xml?rev=763238&r1=763237&r2=763238&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/launchpad/jcrapp/pom.xml (original)
+++ incubator/sling/trunk/contrib/launchpad/jcrapp/pom.xml Wed Apr  8 13:27:28 2009
@@ -188,7 +188,7 @@
         <dependency>
             <groupId>org.ops4j.pax.web</groupId>
             <artifactId>pax-web-service</artifactId>
-            <version>0.2.3</version>
+            <version>0.5.1</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: incubator/sling/trunk/launchpad/app/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/app/pom.xml?rev=763238&r1=763237&r2=763238&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/app/pom.xml (original)
+++ incubator/sling/trunk/launchpad/app/pom.xml Wed Apr  8 13:27:28 2009
@@ -189,7 +189,7 @@
         <dependency>
             <groupId>org.ops4j.pax.web</groupId>
             <artifactId>pax-web-service</artifactId>
-            <version>0.2.3</version>
+            <version>0.5.1</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: incubator/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java?rev=763238&r1=763237&r2=763238&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java
(original)
+++ incubator/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/app/MainDelegate.java
Wed Apr  8 13:27:28 2009
@@ -18,6 +18,10 @@
 
 import static org.apache.felix.framework.util.FelixConstants.LOG_LEVEL_PROP;
 
+import java.io.PrintStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -145,6 +149,9 @@
             commandLine.put(LOG_LEVEL_PROP, String.valueOf(logLevel));
         }
         Logger logger = new Logger();
+        
+        // Display port number on console, in case HttpService doesn't
+        consoleInfo("HTTP server port: " + commandLine.get(PROP_PORT), null);
 
         // prevent tons of needless WARN from the framework
         logger.setLogLevel(Logger.LOG_ERROR);
@@ -348,4 +355,44 @@
 
         return defaultLevel;
     }
+    
+    // ---------- console logging
+
+    // emit an informational message to standard out
+    private static void consoleInfo(String message, Throwable t) {
+        log(System.out, "*INFO*", message, t);
+    }
+
+    private static final DateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS ");
+
+    // helper method to format the message on the correct output channel
+    // the throwable if not-null is also prefixed line by line with the prefix
+    private static void log(PrintStream out, String prefix, String message,
+            Throwable t) {
+
+        final StringBuilder linePrefixBuilder = new StringBuilder();
+        synchronized (fmt) {
+            linePrefixBuilder.append(fmt.format(new Date()));
+        }
+        linePrefixBuilder.append(prefix);
+        linePrefixBuilder.append(" [");
+        linePrefixBuilder.append(Thread.currentThread().getName());
+        linePrefixBuilder.append("] ");
+        final String linePrefix = linePrefixBuilder.toString();
+
+        out.print(linePrefix);
+        out.println(message);
+        if (t != null) {
+            t.printStackTrace(new PrintStream(out) {
+                @Override
+                public void println(String x) {
+                    synchronized (this) {
+                        print(linePrefix);
+                        super.println(x);
+                        flush();
+                    }
+                }
+            });
+        }
+    }
 }



Mime
View raw message