You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/04/30 13:26:16 UTC

svn commit: r652336 - in /servicemix/smx4/kernel/trunk: ./ assembly/ assembly/src/main/descriptors/ assembly/src/main/distribution/text/etc/ assembly/src/main/filtered-resources/etc/ gshell/ gshell/gshell-core/src/main/filtered-resources/org/apache/ger...

Author: gnodet
Date: Wed Apr 30 04:26:15 2008
New Revision: 652336

URL: http://svn.apache.org/viewvc?rev=652336&view=rev
Log:
SMX4KNL-1: Implements a log command

Added:
    servicemix/smx4/kernel/trunk/gshell/gshell-log/   (with props)
    servicemix/smx4/kernel/trunk/gshell/gshell-log/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/DisplayLog.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/GetLogLevel.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/LruList.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/SetLogLevel.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/VmLogAppender.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/AbsoluteTimeDateFormat.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/DateTimeDateFormat.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/FormattingInfo.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/ISO8601DateFormat.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternConverter.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternParser.java
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/
    servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
Modified:
    servicemix/smx4/kernel/trunk/assembly/pom.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.ops4j.pax.logging.cfg
    servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/pom.xml
    servicemix/smx4/kernel/trunk/pom.xml

Modified: servicemix/smx4/kernel/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/pom.xml?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/pom.xml Wed Apr 30 04:26:15 2008
@@ -109,6 +109,11 @@
           <artifactId>org.apache.servicemix.kernel.gshell.osgi</artifactId>
           <version>${pom.version}</version>
       </dependency>
+      <dependency>
+          <groupId>org.apache.servicemix.kernel.gshell</groupId>
+          <artifactId>org.apache.servicemix.kernel.gshell.log</artifactId>
+          <version>${pom.version}</version>
+      </dependency>
         <dependency>
             <groupId>org.apache.servicemix.kernel.gshell</groupId>
             <artifactId>org.apache.servicemix.kernel.gshell.features</artifactId>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml Wed Apr 30 04:26:15 2008
@@ -133,6 +133,7 @@
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina-${mina.version}</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.core</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.osgi</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.log</include>
 
 		        <!-- OBR + GShell command -->
                 <include>org.apache.felix:org.apache.felix.bundlerepository</include>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml Wed Apr 30 04:26:15 2008
@@ -126,6 +126,7 @@
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina-${mina.version}</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.core</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.osgi</include>
+                <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.log</include>
 
 		        <!-- OBR + GShell command -->
                 <include>org.apache.felix:org.apache.felix.bundlerepository</include>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.ops4j.pax.logging.cfg
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.ops4j.pax.logging.cfg?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.ops4j.pax.logging.cfg (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.ops4j.pax.logging.cfg Wed Apr 30 04:26:15 2008
@@ -18,7 +18,7 @@
 ################################################################################
 
 #
-log4j.rootLogger=INFO, out
+log4j.rootLogger=INFO, out, osgi:VmLogAppender
 
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties Wed Apr 30 04:26:15 2008
@@ -51,6 +51,7 @@
 org.apache.servicemix.kernel.gshell.obr-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
+org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
 
 #
 # Start console last

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties Wed Apr 30 04:26:15 2008
@@ -51,6 +51,7 @@
 org.apache.servicemix.kernel.gshell.obr-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
+org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
 
 #
 # Start console last

Propchange: servicemix/smx4/kernel/trunk/gshell/gshell-log/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 30 04:26:15 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/pom.xml?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/pom.xml Wed Apr 30 04:26:15 2008
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.kernel.gshell</groupId>
+        <artifactId>gshell</artifactId>
+        <version>1.0-m3-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.gshell</groupId>
+    <artifactId>org.apache.servicemix.kernel.gshell.log</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0-m3-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: GShell Log Commands</name>
+
+    <description>
+        Provides the OSGi Log commands
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel.gshell</groupId>
+            <artifactId>org.apache.servicemix.kernel.gshell.core</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${felix.osgi.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>${felix.compendium.version}</version>
+            <scope>provided</scope>
+            <exclusions>
+              <exclusion>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>org.osgi.foundation</artifactId>
+              </exclusion>
+             <exclusion>
+               <groupId>org.apache.felix</groupId>
+               <artifactId>javax.servlet</artifactId>
+             </exclusion>
+           </exclusions>
+        </dependency>
+		
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <version>${spring.osgi.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.logging</groupId>
+            <artifactId>pax-logging-service</artifactId>
+            <version>${pax.logging.version}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>org.apache.servicemix.gshell.log*;version=${project.version};-split-package:=merge-first</Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/DisplayLog.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/DisplayLog.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/DisplayLog.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/DisplayLog.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log;
+
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.servicemix.gshell.log.layout.PatternConverter;
+import org.apache.servicemix.gshell.log.layout.PatternParser;
+import org.ops4j.pax.logging.spi.PaxLoggingEvent;
+
+@CommandComponent(id = "log:display", description = "Display log entries")
+public class DisplayLog extends OsgiCommandSupport {
+
+    @Option(name = "-n", description="Number of entries to display")
+    protected int entries;
+
+    @Option(name = "-p", description="Output formatting pattern")
+    protected String overridenPattern;
+
+    protected String pattern;
+
+    protected LruList<PaxLoggingEvent> events;
+
+    @Override
+    protected OsgiCommandSupport createCommand() throws Exception {
+        DisplayLog command = new DisplayLog();
+        command.setEvents(getEvents());
+        command.setPattern(getPattern());
+        return command;
+    }
+
+    public LruList<PaxLoggingEvent> getEvents() {
+        return events;
+    }
+
+    public void setEvents(LruList<PaxLoggingEvent> events) {
+        this.events = events;
+    }
+
+    public String getPattern() {
+        return pattern;
+    }
+
+    public void setPattern(String pattern) {
+        this.pattern = pattern;
+    }
+
+    protected Object doExecute() throws Exception {
+        PatternConverter cnv = new PatternParser(overridenPattern != null ? overridenPattern : pattern).parse();
+
+        Iterable<PaxLoggingEvent> le = events.getElements(entries == 0 ? Integer.MAX_VALUE : entries);
+        StringBuffer sb = new StringBuffer();
+        for (PaxLoggingEvent event : le) {
+            sb.setLength(0);
+            for (PatternConverter pc = cnv; pc != null; pc = pc.next) {
+                pc.format(sb, event);
+            }
+            io.out.print(sb.toString());
+        }
+        io.out.println();
+        
+        return SUCCESS;
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/GetLogLevel.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/GetLogLevel.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/GetLogLevel.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/GetLogLevel.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log;
+
+import java.util.List;
+import java.util.Dictionary;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Enumeration;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.Configuration;
+
+/**
+ * User: ewoodman
+ * Date: March 3, 2008
+ * Time: 11:10:10 AM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id = "log:get", description = "Show Log Level")
+public class GetLogLevel extends OsgiCommandSupport {
+
+    @Argument(required = false, description = "Logger name, ALL or ROOT (default)")
+    String logger;
+
+    static final String CONFIGURATION_PID  = "org.ops4j.pax.logging";
+    static final String ROOT_LOGGER_PREFIX = "log4j.rootLogger";
+    static final String LOGGER_PREFIX      = "log4j.logger.";
+    static final String ALL_LOGGER         = "ALL";
+    static final String ROOT_LOGGER        = "ROOT";
+
+    protected Object doExecute() throws Exception {
+        ConfigurationAdmin cfgAdmin = getConfigAdmin();
+        Configuration cfg = cfgAdmin.getConfiguration(CONFIGURATION_PID);
+        Dictionary props = cfg.getProperties();
+
+        if (ROOT_LOGGER.equalsIgnoreCase(this.logger)) {
+            this.logger = null;
+        }
+        if (ALL_LOGGER.equalsIgnoreCase(logger)) {
+            String root = getLevel((String) props.get(ROOT_LOGGER_PREFIX));
+            Map<String, String> loggers = new TreeMap<String, String>();
+            for (Enumeration e = props.keys(); e.hasMoreElements();) {
+                String prop = (String) e.nextElement();
+                if (prop.startsWith(LOGGER_PREFIX)) {
+                    String val = getLevel((String) props.get(prop));
+                    loggers.put(prop.substring(LOGGER_PREFIX.length()), val);
+                }
+            }
+            io.out.println("ROOT: " + root);
+            for (String logger : loggers.keySet()) {
+                io.out.println(logger + ": " + loggers.get(logger));
+            }
+        } else {
+            String logger = this.logger;
+            String val;
+            for (;;) {
+                String prop;
+                if (logger == null) {
+                    prop = ROOT_LOGGER_PREFIX;
+                } else {
+                    prop = LOGGER_PREFIX + logger;
+                }
+                val = (String) props.get(prop);
+                val = getLevel(val);
+                if (val != null || logger == null) {
+                    break;
+                }
+                int idx = logger.lastIndexOf('.');
+                if (idx < 0) {
+                    logger = null;
+                } else {
+                    logger = logger.substring(0, idx);
+                }
+            }
+            String st = "Level: " + val;
+            if (logger != this.logger) {
+                st += " (inherited from " + (logger != null ? logger : "ROOT") + ")";
+            }
+            io.out.println(st);
+        }
+        return SUCCESS;
+    }
+
+    protected String getLevel(String prop) {
+        if (prop == null) {
+            return null;
+        } else {
+            String val = prop.trim();
+            int idx = val.indexOf(",");
+            if (idx == 0) {
+                val = null;
+            } else if (idx > 0) {
+                val = val.substring(0, idx);
+            }
+            return val;
+        }
+    }
+
+    protected ConfigurationAdmin getConfigAdmin() {
+        ServiceReference ref = getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+        return getService(ConfigurationAdmin.class, ref);
+    }
+
+}
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/LruList.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/LruList.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/LruList.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/LruList.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,88 @@
+package org.apache.servicemix.gshell.log;
+
+import java.util.AbstractList;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Apr 28, 2008
+ * Time: 6:15:47 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class LruList<E> {
+
+    private E[] elements;
+    private transient int start = 0;
+    private transient int end = 0;
+    private transient boolean full = false;
+    private final int maxElements;
+
+    public LruList(int size) {
+        if (size <= 0) {
+            throw new IllegalArgumentException("The size must be greater than 0");
+        }
+        elements = (E[]) new Object[size];
+        maxElements = elements.length;
+    }
+
+    public int size() {
+        synchronized (elements) {
+            int size = 0;
+            if (end < start) {
+                size = maxElements - start + end;
+            } else if (end == start) {
+                size = (full ? maxElements : 0);
+            } else {
+                size = end - start;
+            }
+            return size;
+        }
+    }
+
+    public void add(E element) {
+        synchronized (elements) {
+            if (null == element) {
+                 throw new NullPointerException("Attempted to add null object to buffer");
+            }
+            if (size() == maxElements) {
+                Object e = elements[start];
+                if (null != e) {
+                    elements[start++] = null;
+                    if (start >= maxElements) {
+                        start = 0;
+                    }
+                    full = false;
+                }
+            }
+            elements[end++] = element;
+            if (end >= maxElements) {
+                end = 0;
+            }
+            if (end == start) {
+                full = true;
+            }
+        }
+    }
+
+    public Iterable<E> getElements() {
+        synchronized (elements) {
+            return getElements(size());
+        }
+    }
+
+    public Iterable<E> getElements(int nb) {
+        synchronized (elements) {
+            int s = size();
+            nb = Math.min(Math.max(0, nb), s);
+            E[] e = (E[]) new Object[nb];
+            for (int i = 0; i < nb; i++) {
+                e[i] = elements[(i + s - nb + start) % maxElements];
+            }
+            return Arrays.asList(e);
+        }
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/SetLogLevel.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/SetLogLevel.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/SetLogLevel.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/SetLogLevel.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log;
+
+import java.util.Dictionary;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.support.OsgiCommandSupport;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.Configuration;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * User: ewoodman
+ * Date: March 3, 2008
+ * Time: 11:10:10 AM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id = "log:set", description = "Change the log level")
+public class SetLogLevel extends OsgiCommandSupport {
+
+    @Argument(index = 0, required = true, description = "Level (TRACE, DEBUG, INFO, WARN, ERROR or - to unset")
+    String level;
+
+    @Argument(index = 1, required = false, description = "Logger name or ROOT (default)")
+    String logger;
+
+    static final String CONFIGURATION_PID  = "org.ops4j.pax.logging";
+    static final String ROOT_LOGGER_PREFIX = "log4j.rootLogger";
+    static final String LOGGER_PREFIX      = "log4j.logger.";
+    static final String ROOT_LOGGER        = "ROOT";
+
+    static final String TRACE = "TRACE";
+    static final String DEBUG = "DEBUG";
+    static final String INFO = "INFO";
+    static final String WARN = "WARN";
+    static final String ERROR = "ERROR";
+    static final String INHERITED = "-";
+
+    protected Object doExecute() throws Exception {
+        if (ROOT_LOGGER.equalsIgnoreCase(this.logger)) {
+            this.logger = null;
+        }
+        if (!TRACE.equals(level) &&
+                !DEBUG.equals(level) &&
+                !INFO.equals(level) &&
+                !WARN.equals(level) &&
+                !ERROR.equals(level) &&
+                !INHERITED.equals(level)) {
+            io.err.println("level must be set to TRACE, DEBUG, INFO, WARN or ERROR (or - to unset it)");
+            return FAILURE;
+        }
+        if (INHERITED.equals(level) && logger == null) {
+            io.err.println("Can not unset the ROOT logger");
+            return FAILURE;
+        }
+
+        ConfigurationAdmin cfgAdmin = getConfigAdmin();
+        Configuration cfg = cfgAdmin.getConfiguration(CONFIGURATION_PID);
+        Dictionary props = cfg.getProperties();
+
+        String logger = this.logger;
+        String val;
+        String prop;
+        if (logger == null) {
+            prop = ROOT_LOGGER_PREFIX;
+        } else {
+            prop = LOGGER_PREFIX + logger;
+        }
+        val = (String) props.get(prop);
+        if (INHERITED.equals(level)) {
+            if (val != null) {
+                val = val.trim();
+                int idx = val.indexOf(",");
+                if (idx > 0) {
+                    val = val.substring(idx);
+                } else {
+                    val = null;
+                }
+            }
+        } else {
+            if (val == null) {
+                val = level;
+            } else {
+                val = val.trim();
+                int idx = val.indexOf(",");
+                if (idx == 0) {
+                    val = level + val;
+                } else if (idx > 0) {
+                    val = level + val.substring(idx);
+                }
+            }
+        }
+        if (val == null) {
+            props.remove(prop);
+        } else {
+            props.put(prop, val);
+        }
+        cfg.update(props);
+
+        return SUCCESS;
+    }
+
+    protected ConfigurationAdmin getConfigAdmin() {
+        ServiceReference ref = getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+        return getService(ConfigurationAdmin.class, ref);
+    }
+
+}
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/VmLogAppender.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/VmLogAppender.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/VmLogAppender.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/VmLogAppender.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,31 @@
+package org.apache.servicemix.gshell.log;
+
+import org.ops4j.pax.logging.spi.PaxAppender;
+import org.ops4j.pax.logging.spi.PaxLoggingEvent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Apr 28, 2008
+ * Time: 5:13:39 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class VmLogAppender implements PaxAppender {
+
+    protected LruList<PaxLoggingEvent> events;
+
+    public LruList<PaxLoggingEvent> getEvents() {
+        return events;
+    }
+
+    public void setEvents(LruList<PaxLoggingEvent> events) {
+        this.events = events;
+    }
+
+    public void doAppend(PaxLoggingEvent event) {
+        if (events != null) {
+            events.add(event);
+        }
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/AbsoluteTimeDateFormat.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/AbsoluteTimeDateFormat.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/AbsoluteTimeDateFormat.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/AbsoluteTimeDateFormat.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+import java.util.Date;
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.text.FieldPosition;
+import java.text.ParsePosition;
+import java.text.DateFormat;
+
+
+/**
+   Formats a {@link Date} in the format "HH:mm:ss,SSS" for example,
+   "15:49:37,459".
+
+   @author Ceki G&uuml;lc&uuml;
+   @author Andrew Vajoczki
+
+   @since 0.7.5
+*/
+public class AbsoluteTimeDateFormat extends DateFormat {
+
+  /**
+     String constant used to specify {@link
+     org.apache.log4j.helpers.AbsoluteTimeDateFormat} in layouts. Current
+     value is <b>ABSOLUTE</b>.  */
+  public final static String ABS_TIME_DATE_FORMAT = "ABSOLUTE";
+
+  /**
+     String constant used to specify {@link
+     org.apache.log4j.helpers.DateTimeDateFormat} in layouts.  Current
+     value is <b>DATE</b>.
+  */
+  public final static String DATE_AND_TIME_DATE_FORMAT = "DATE";
+
+  /**
+     String constant used to specify {@link
+     org.apache.log4j.helpers.ISO8601DateFormat} in layouts. Current
+     value is <b>ISO8601</b>.
+  */
+  public final static String ISO8601_DATE_FORMAT = "ISO8601";
+
+  public
+  AbsoluteTimeDateFormat() {
+    setCalendar(Calendar.getInstance());
+  }
+
+  public
+  AbsoluteTimeDateFormat(TimeZone timeZone) {
+    setCalendar(Calendar.getInstance(timeZone));
+  }
+
+  private static long   previousTime;
+  private static char[] previousTimeWithoutMillis = new char[9]; // "HH:mm:ss."
+
+  /**
+     Appends to <code>sbuf</code> the time in the format
+     "HH:mm:ss,SSS" for example, "15:49:37,459"
+
+     @param date the date to format
+     @param sbuf the string buffer to write to
+     @param fieldPosition remains untouched
+    */
+  public
+  StringBuffer format(Date date, StringBuffer sbuf,
+		      FieldPosition fieldPosition) {
+
+    long now = date.getTime();
+    int millis = (int)(now % 1000);
+
+    if ((now - millis) != previousTime) {
+      // We reach this point at most once per second
+      // across all threads instead of each time format()
+      // is called. This saves considerable CPU time.
+
+      calendar.setTime(date);
+
+      int start = sbuf.length();
+
+      int hour = calendar.get(Calendar.HOUR_OF_DAY);
+      if(hour < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(hour);
+      sbuf.append(':');
+
+      int mins = calendar.get(Calendar.MINUTE);
+      if(mins < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(mins);
+      sbuf.append(':');
+
+      int secs = calendar.get(Calendar.SECOND);
+      if(secs < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(secs);
+      sbuf.append(',');
+
+      // store the time string for next time to avoid recomputation
+      sbuf.getChars(start, sbuf.length(), previousTimeWithoutMillis, 0);
+
+      previousTime = now - millis;
+    }
+    else {
+      sbuf.append(previousTimeWithoutMillis);
+    }
+
+
+
+    if(millis < 100)
+      sbuf.append('0');
+    if(millis < 10)
+      sbuf.append('0');
+
+    sbuf.append(millis);
+    return sbuf;
+  }
+
+  /**
+     This method does not do anything but return <code>null</code>.
+   */
+  public
+  Date parse(String s, ParsePosition pos) {
+    return null;
+  }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/DateTimeDateFormat.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/DateTimeDateFormat.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/DateTimeDateFormat.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/DateTimeDateFormat.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.Date;
+import java.text.FieldPosition;
+import java.text.ParsePosition;
+import java.text.DateFormatSymbols;
+
+/**
+   Formats a {@link Date} in the format "dd MMM yyyy HH:mm:ss,SSS" for example,
+   "06 Nov 1994 15:49:37,459".
+
+   @author Ceki G&uuml;lc&uuml;
+   @since 0.7.5
+*/
+public class DateTimeDateFormat extends AbsoluteTimeDateFormat {
+
+  String[] shortMonths;
+
+  public
+  DateTimeDateFormat() {
+    super();
+    shortMonths = new DateFormatSymbols().getShortMonths();
+  }
+
+  public
+  DateTimeDateFormat(TimeZone timeZone) {
+    this();
+    setCalendar(Calendar.getInstance(timeZone));
+  }
+
+  /**
+     Appends to <code>sbuf</code> the date in the format "dd MMM yyyy
+     HH:mm:ss,SSS" for example, "06 Nov 1994 08:49:37,459".
+
+     @param sbuf the string buffer to write to
+  */
+  public
+  StringBuffer format(Date date, StringBuffer sbuf,
+		      FieldPosition fieldPosition) {
+
+    calendar.setTime(date);
+
+    int day = calendar.get(Calendar.DAY_OF_MONTH);
+    if(day < 10)
+      sbuf.append('0');
+    sbuf.append(day);
+    sbuf.append(' ');
+    sbuf.append(shortMonths[calendar.get(Calendar.MONTH)]);
+    sbuf.append(' ');
+
+    int year =  calendar.get(Calendar.YEAR);
+    sbuf.append(year);
+    sbuf.append(' ');
+
+    return super.format(date, sbuf, fieldPosition);
+  }
+
+  /**
+     This method does not do anything but return <code>null</code>.
+   */
+  public
+  Date parse(java.lang.String s, ParsePosition pos) {
+    return null;
+  }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/FormattingInfo.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/FormattingInfo.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/FormattingInfo.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/FormattingInfo.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+
+/**
+   FormattingInfo instances contain the information obtained when parsing
+   formatting modifiers in conversion modifiers.
+
+   @author <a href=mailto:jim_cakalic@na.biomerieux.com>Jim Cakalic</a>
+   @author Ceki G&uuml;lc&uuml;
+
+   @since 0.8.2
+ */
+public class FormattingInfo {
+  int min = -1;
+  int max = 0x7FFFFFFF;
+  boolean leftAlign = false;
+
+  void reset() {
+    min = -1;
+    max = 0x7FFFFFFF;
+    leftAlign = false;
+  }
+
+  void dump() {
+    //LogLog.debug("min="+min+", max="+max+", leftAlign="+leftAlign);
+  }
+}
+

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/ISO8601DateFormat.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/ISO8601DateFormat.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/ISO8601DateFormat.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/ISO8601DateFormat.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.Date;
+import java.text.FieldPosition;
+import java.text.ParsePosition;
+
+// Contributors: Arndt Schoenewald <ar...@ibm23093i821.mc.schoenewald.de>
+
+/**
+   Formats a {@link Date} in the format "yyyy-MM-dd HH:mm:ss,SSS" for example
+   "1999-11-27 15:49:37,459".
+
+   <p>Refer to the <a
+   href=http://www.cl.cam.ac.uk/~mgk25/iso-time.html>summary of the
+   International Standard Date and Time Notation</a> for more
+   information on this format.
+
+   @author Ceki G&uuml;lc&uuml;
+   @author Andrew Vajoczki
+
+   @since 0.7.5
+*/
+public class ISO8601DateFormat extends AbsoluteTimeDateFormat {
+
+  public
+  ISO8601DateFormat() {
+  }
+
+  public
+  ISO8601DateFormat(TimeZone timeZone) {
+    super(timeZone);
+  }
+
+  static private long   lastTime;
+  static private char[] lastTimeString = new char[20];
+
+  /**
+     Appends a date in the format "YYYY-mm-dd HH:mm:ss,SSS"
+     to <code>sbuf</code>. For example: "1999-11-27 15:49:37,459".
+
+     @param sbuf the <code>StringBuffer</code> to write to
+  */
+  public
+  StringBuffer format(Date date, StringBuffer sbuf,
+		      FieldPosition fieldPosition) {
+
+    long now = date.getTime();
+    int millis = (int)(now % 1000);
+
+    if ((now - millis) != lastTime) {
+      // We reach this point at most once per second
+      // across all threads instead of each time format()
+      // is called. This saves considerable CPU time.
+
+      calendar.setTime(date);
+
+      int start = sbuf.length();
+
+      int year =  calendar.get(Calendar.YEAR);
+      sbuf.append(year);
+
+      String month;
+      switch(calendar.get(Calendar.MONTH)) {
+      case Calendar.JANUARY: month = "-01-"; break;
+      case Calendar.FEBRUARY: month = "-02-";  break;
+      case Calendar.MARCH: month = "-03-"; break;
+      case Calendar.APRIL: month = "-04-";  break;
+      case Calendar.MAY: month = "-05-"; break;
+      case Calendar.JUNE: month = "-06-";  break;
+      case Calendar.JULY: month = "-07-"; break;
+      case Calendar.AUGUST: month = "-08-";  break;
+      case Calendar.SEPTEMBER: month = "-09-"; break;
+      case Calendar.OCTOBER: month = "-10-"; break;
+      case Calendar.NOVEMBER: month = "-11-";  break;
+      case Calendar.DECEMBER: month = "-12-";  break;
+      default: month = "-NA-"; break;
+      }
+      sbuf.append(month);
+
+      int day = calendar.get(Calendar.DAY_OF_MONTH);
+      if(day < 10)
+	sbuf.append('0');
+      sbuf.append(day);
+
+      sbuf.append(' ');
+
+      int hour = calendar.get(Calendar.HOUR_OF_DAY);
+      if(hour < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(hour);
+      sbuf.append(':');
+
+      int mins = calendar.get(Calendar.MINUTE);
+      if(mins < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(mins);
+      sbuf.append(':');
+
+      int secs = calendar.get(Calendar.SECOND);
+      if(secs < 10) {
+	sbuf.append('0');
+      }
+      sbuf.append(secs);
+
+      sbuf.append(',');
+
+      // store the time string for next time to avoid recomputation
+      sbuf.getChars(start, sbuf.length(), lastTimeString, 0);
+      lastTime = now - millis;
+    }
+    else {
+      sbuf.append(lastTimeString);
+    }
+
+
+    if (millis < 100)
+      sbuf.append('0');
+    if (millis < 10)
+      sbuf.append('0');
+
+    sbuf.append(millis);
+    return sbuf;
+  }
+
+  /**
+    This method does not do anything but return <code>null</code>.
+   */
+  public
+  Date parse(java.lang.String s, ParsePosition pos) {
+    return null;
+  }
+}
+

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternConverter.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternConverter.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternConverter.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternConverter.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+import org.ops4j.pax.logging.spi.PaxLoggingEvent;
+
+/**
+
+   <p>PatternConverter is an abtract class that provides the
+   formatting functionality that derived classes need.
+
+   <p>Conversion specifiers in a conversion patterns are parsed to
+   individual PatternConverters. Each of which is responsible for
+   converting a logging event in a converter specific manner.
+
+   @author <a href="mailto:cakalijp@Maritz.com">James P. Cakalic</a>
+   @author Ceki G&uuml;lc&uuml;
+
+   @since 0.8.2
+ */
+public abstract class PatternConverter {
+  public PatternConverter next;
+  int min = -1;
+  int max = 0x7FFFFFFF;
+  boolean leftAlign = false;
+
+  protected
+  PatternConverter() {  }
+
+  protected
+  PatternConverter(FormattingInfo fi) {
+    min = fi.min;
+    max = fi.max;
+    leftAlign = fi.leftAlign;
+  }
+
+  /**
+     Derived pattern converters must override this method in order to
+     convert conversion specifiers in the correct way.
+  */
+  abstract
+  protected
+  String convert(PaxLoggingEvent event);
+
+  /**
+     A template method for formatting in a converter specific way.
+   */
+  public
+  void format(StringBuffer sbuf, PaxLoggingEvent e) {
+    String s = convert(e);
+
+    if(s == null) {
+      if(0 < min)
+	spacePad(sbuf, min);
+      return;
+    }
+
+    int len = s.length();
+
+    if(len > max)
+      sbuf.append(s.substring(len-max));
+    else if(len < min) {
+      if(leftAlign) {
+	sbuf.append(s);
+	spacePad(sbuf, min-len);
+      }
+      else {
+	spacePad(sbuf, min-len);
+	sbuf.append(s);
+      }
+    }
+    else
+      sbuf.append(s);
+  }
+
+  static String[] SPACES = {" ", "  ", "    ", "        ", //1,2,4,8 spaces
+			    "                ", // 16 spaces
+			    "                                " }; // 32 spaces
+
+  /**
+     Fast space padding method.
+  */
+  public
+  void spacePad(StringBuffer sbuf, int length) {
+    while(length >= 32) {
+      sbuf.append(SPACES[5]);
+      length -= 32;
+    }
+
+    for(int i = 4; i >= 0; i--) {
+      if((length & (1<<i)) != 0) {
+	sbuf.append(SPACES[i]);
+      }
+    }
+  }
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternParser.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternParser.java?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternParser.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/java/org/apache/servicemix/gshell/log/layout/PatternParser.java Wed Apr 30 04:26:15 2008
@@ -0,0 +1,526 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.gshell.log.layout;
+
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.spi.LocationInfo;
+import org.ops4j.pax.logging.spi.PaxLoggingEvent;
+import org.ops4j.pax.logging.spi.PaxLocationInfo;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+// Contributors:   Nelson Minar <(n...@monkey.org>
+//                 Igor E. Poteryaev <ja...@mail.ru>
+//                 Reinhard Deschler <re...@web.de>
+
+/**
+   Most of the work of the {@link org.apache.log4j.PatternLayout} class
+   is delegated to the PatternParser class.
+
+   @author <a href=mailto:"cakalijp@Maritz.com">James P. Cakalic</a>
+   @author Ceki G&uuml;lc&uuml;
+   @author Anders Kristensen
+
+   @since 0.8.2
+*/
+public class PatternParser {
+
+  private static final String LINE_SEP = System.getProperty("line.separator");
+
+  private static final char ESCAPE_CHAR = '%';
+
+  private static final int LITERAL_STATE = 0;
+  private static final int CONVERTER_STATE = 1;
+  private static final int MINUS_STATE = 2;
+  private static final int DOT_STATE = 3;
+  private static final int MIN_STATE = 4;
+  private static final int MAX_STATE = 5;
+
+  static final int FULL_LOCATION_CONVERTER = 1000;
+  static final int METHOD_LOCATION_CONVERTER = 1001;
+  static final int CLASS_LOCATION_CONVERTER = 1002;
+  static final int LINE_LOCATION_CONVERTER = 1003;
+  static final int FILE_LOCATION_CONVERTER = 1004;
+
+  static final int RELATIVE_TIME_CONVERTER = 2000;
+  static final int THREAD_CONVERTER = 2001;
+  static final int LEVEL_CONVERTER = 2002;
+  static final int NDC_CONVERTER = 2003;
+  static final int MESSAGE_CONVERTER = 2004;
+
+  int state;
+  protected StringBuffer currentLiteral = new StringBuffer(32);
+  protected int patternLength;
+  protected int i;
+  PatternConverter head;
+  PatternConverter tail;
+  protected FormattingInfo formattingInfo = new FormattingInfo();
+  protected String pattern;
+
+  public
+  PatternParser(String pattern) {
+    this.pattern = pattern;
+    patternLength =  pattern.length();
+    state = LITERAL_STATE;
+  }
+
+  private
+  void  addToList(PatternConverter pc) {
+    if(head == null) {
+      head = tail = pc;
+    } else {
+      tail.next = pc;
+      tail = pc;
+    }
+  }
+
+  protected
+  String extractOption() {
+    if((i < patternLength) && (pattern.charAt(i) == '{')) {
+      int end = pattern.indexOf('}', i);
+      if (end > i) {
+	String r = pattern.substring(i + 1, end);
+	i = end+1;
+	return r;
+      }
+    }
+    return null;
+  }
+
+
+  /**
+     The option is expected to be in decimal and positive. In case of
+     error, zero is returned.  */
+  protected
+  int extractPrecisionOption() {
+    String opt = extractOption();
+    int r = 0;
+    if(opt != null) {
+      try {
+	r = Integer.parseInt(opt);
+	if(r <= 0) {
+	    //LogLog.error("Precision option (" + opt + ") isn't a positive integer.");
+	    r = 0;
+	}
+      }
+      catch (NumberFormatException e) {
+	//LogLog.error("Category option \""+opt+"\" not a decimal integer.", e);
+      }
+    }
+    return r;
+  }
+
+  public
+  PatternConverter parse() {
+    char c;
+    i = 0;
+    while(i < patternLength) {
+      c = pattern.charAt(i++);
+      switch(state) {
+      case LITERAL_STATE:
+        // In literal state, the last char is always a literal.
+        if(i == patternLength) {
+          currentLiteral.append(c);
+          continue;
+        }
+        if(c == ESCAPE_CHAR) {
+          // peek at the next char.
+          switch(pattern.charAt(i)) {
+          case ESCAPE_CHAR:
+            currentLiteral.append(c);
+            i++; // move pointer
+            break;
+          case 'n':
+            currentLiteral.append(LINE_SEP);
+            i++; // move pointer
+            break;
+          default:
+            if(currentLiteral.length() != 0) {
+              addToList(new LiteralPatternConverter(
+                                                  currentLiteral.toString()));
+              //LogLog.debug("Parsed LITERAL converter: \""
+              //           +currentLiteral+"\".");
+            }
+            currentLiteral.setLength(0);
+            currentLiteral.append(c); // append %
+            state = CONVERTER_STATE;
+            formattingInfo.reset();
+          }
+        }
+        else {
+          currentLiteral.append(c);
+        }
+        break;
+      case CONVERTER_STATE:
+	currentLiteral.append(c);
+	switch(c) {
+	case '-':
+	  formattingInfo.leftAlign = true;
+	  break;
+	case '.':
+	  state = DOT_STATE;
+	  break;
+	default:
+	  if(c >= '0' && c <= '9') {
+	    formattingInfo.min = c - '0';
+	    state = MIN_STATE;
+	  }
+	  else
+	    finalizeConverter(c);
+	} // switch
+	break;
+      case MIN_STATE:
+	currentLiteral.append(c);
+	if(c >= '0' && c <= '9')
+	  formattingInfo.min = formattingInfo.min*10 + (c - '0');
+	else if(c == '.')
+	  state = DOT_STATE;
+	else {
+	  finalizeConverter(c);
+	}
+	break;
+      case DOT_STATE:
+	currentLiteral.append(c);
+	if(c >= '0' && c <= '9') {
+	  formattingInfo.max = c - '0';
+	   state = MAX_STATE;
+	}
+	else {
+	  //LogLog.error("Error occured in position "+i+".\n Was expecting digit, instead got char \""+c+"\".");
+	  state = LITERAL_STATE;
+	}
+	break;
+      case MAX_STATE:
+	currentLiteral.append(c);
+	if(c >= '0' && c <= '9')
+	  formattingInfo.max = formattingInfo.max*10 + (c - '0');
+	else {
+	  finalizeConverter(c);
+	  state = LITERAL_STATE;
+	}
+	break;
+      } // switch
+    } // while
+    if(currentLiteral.length() != 0) {
+      addToList(new LiteralPatternConverter(currentLiteral.toString()));
+      //LogLog.debug("Parsed LITERAL converter: \""+currentLiteral+"\".");
+    }
+    return head;
+  }
+
+  protected
+  void finalizeConverter(char c) {
+    PatternConverter pc = null;
+    switch(c) {
+    case 'c':
+      pc = new CategoryPatternConverter(formattingInfo,
+					extractPrecisionOption());
+      //LogLog.debug("CATEGORY converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'C':
+      pc = new ClassNamePatternConverter(formattingInfo,
+					 extractPrecisionOption());
+      //LogLog.debug("CLASS_NAME converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'd':
+      String dateFormatStr = AbsoluteTimeDateFormat.ISO8601_DATE_FORMAT;
+      DateFormat df;
+      String dOpt = extractOption();
+      if(dOpt != null)
+	dateFormatStr = dOpt;
+
+      if(dateFormatStr.equalsIgnoreCase(
+                                    AbsoluteTimeDateFormat.ISO8601_DATE_FORMAT))
+	df = new  ISO8601DateFormat();
+      else if(dateFormatStr.equalsIgnoreCase(
+                                   AbsoluteTimeDateFormat.ABS_TIME_DATE_FORMAT))
+	df = new AbsoluteTimeDateFormat();
+      else if(dateFormatStr.equalsIgnoreCase(
+                              AbsoluteTimeDateFormat.DATE_AND_TIME_DATE_FORMAT))
+	df = new DateTimeDateFormat();
+      else {
+	try {
+	  df = new SimpleDateFormat(dateFormatStr);
+	}
+	catch (IllegalArgumentException e) {
+	  //LogLog.error("Could not instantiate SimpleDateFormat with " + dateFormatStr, e);
+	  df = new ISO8601DateFormat();
+	}
+      }
+      pc = new DatePatternConverter(formattingInfo, df);
+      //LogLog.debug("DATE converter {"+dateFormatStr+"}.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'F':
+      pc = new LocationPatternConverter(formattingInfo,
+					FILE_LOCATION_CONVERTER);
+      //LogLog.debug("File name converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    /*case 'l':
+      pc = new LocationPatternConverter(formattingInfo,
+					FULL_LOCATION_CONVERTER);
+      //LogLog.debug("Location converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;*/
+    case 'L':
+      pc = new LocationPatternConverter(formattingInfo,
+					LINE_LOCATION_CONVERTER);
+      //LogLog.debug("LINE NUMBER converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'm':
+      pc = new BasicPatternConverter(formattingInfo, MESSAGE_CONVERTER);
+      //LogLog.debug("MESSAGE converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'M':
+      pc = new LocationPatternConverter(formattingInfo,
+					METHOD_LOCATION_CONVERTER);
+      //LogLog.debug("METHOD converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'p':
+      pc = new BasicPatternConverter(formattingInfo, LEVEL_CONVERTER);
+      //LogLog.debug("LEVEL converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 'r':
+      pc = new BasicPatternConverter(formattingInfo,
+					 RELATIVE_TIME_CONVERTER);
+      //LogLog.debug("RELATIVE time converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+    case 't':
+      pc = new BasicPatternConverter(formattingInfo, THREAD_CONVERTER);
+      //LogLog.debug("THREAD converter.");
+      //formattingInfo.dump();
+      currentLiteral.setLength(0);
+      break;
+      /*case 'u':
+      if(i < patternLength) {
+	char cNext = pattern.charAt(i);
+	if(cNext >= '0' && cNext <= '9') {
+	  pc = new UserFieldPatternConverter(formattingInfo, cNext - '0');
+	  LogLog.debug("USER converter ["+cNext+"].");
+	  formattingInfo.dump();
+	  currentLiteral.setLength(0);
+	  i++;
+	}
+	else
+	  LogLog.error("Unexpected char" +cNext+" at position "+i);
+      }
+      break;*/
+    /*case 'x':
+      pc = new BasicPatternConverter(formattingInfo, NDC_CONVERTER);
+      //LogLog.debug("NDC converter.");
+      currentLiteral.setLength(0);
+      break;
+    case 'X':
+      String xOpt = extractOption();
+      pc = new MDCPatternConverter(formattingInfo, xOpt);
+      currentLiteral.setLength(0);
+      break;*/
+    default:
+      //LogLog.error("Unexpected char [" +c+"] at position "+i+" in conversion patterrn.");
+      pc = new LiteralPatternConverter(currentLiteral.toString());
+      currentLiteral.setLength(0);
+    }
+
+    addConverter(pc);
+  }
+
+  protected
+  void addConverter(PatternConverter pc) {
+    currentLiteral.setLength(0);
+    // Add the pattern converter to the list.
+    addToList(pc);
+    // Next pattern is assumed to be a literal.
+    state = LITERAL_STATE;
+    // Reset formatting info
+    formattingInfo.reset();
+  }
+
+  // ---------------------------------------------------------------------
+  //                      PatternConverters
+  // ---------------------------------------------------------------------
+
+  private static class BasicPatternConverter extends PatternConverter {
+    int type;
+
+    BasicPatternConverter(FormattingInfo formattingInfo, int type) {
+      super(formattingInfo);
+      this.type = type;
+    }
+
+    public
+    String convert(PaxLoggingEvent event) {
+      switch(type) {
+      case RELATIVE_TIME_CONVERTER:
+	return (Long.toString(event.getTimeStamp() - LoggingEvent.getStartTime()));
+      case THREAD_CONVERTER:
+	return event.getThreadName();
+      case LEVEL_CONVERTER:
+	return event.getLevel().toString();
+    //  case NDC_CONVERTER:
+	//return event.getNDC();
+      case MESSAGE_CONVERTER: {
+	return event.getRenderedMessage();
+      }
+      default: return null;
+      }
+    }
+  }
+
+  private static class LiteralPatternConverter extends PatternConverter {
+    private String literal;
+
+    LiteralPatternConverter(String value) {
+      literal = value;
+    }
+
+    public
+    final
+    void format(StringBuffer sbuf, LoggingEvent event) {
+      sbuf.append(literal);
+    }
+
+    public
+    String convert(PaxLoggingEvent event) {
+      return literal;
+    }
+  }
+
+  private static class DatePatternConverter extends PatternConverter {
+    private DateFormat df;
+    private Date date;
+
+    DatePatternConverter(FormattingInfo formattingInfo, DateFormat df) {
+      super(formattingInfo);
+      date = new Date();
+      this.df = df;
+    }
+
+    public
+    String convert(PaxLoggingEvent event) {
+      date.setTime(event.getTimeStamp());
+      String converted = null;
+      try {
+        converted = df.format(date);
+      }
+      catch (Exception ex) {
+        //LogLog.error("Error occured while converting date.", ex);
+      }
+      return converted;
+    }
+  }
+
+  private class LocationPatternConverter extends PatternConverter {
+    int type;
+
+    LocationPatternConverter(FormattingInfo formattingInfo, int type) {
+      super(formattingInfo);
+      this.type = type;
+    }
+
+    public
+    String convert(PaxLoggingEvent event) {
+      PaxLocationInfo locationInfo = event.getLocationInformation();
+      switch(type) {
+      /*case FULL_LOCATION_CONVERTER:
+	return locationInfo.fullInfo;*/
+      case METHOD_LOCATION_CONVERTER:
+	return locationInfo.getMethodName();
+      case LINE_LOCATION_CONVERTER:
+	return locationInfo.getLineNumber();
+      case FILE_LOCATION_CONVERTER:
+	return locationInfo.getFileName();
+      default: return null;
+      }
+    }
+  }
+
+  private static abstract class NamedPatternConverter extends PatternConverter {
+    int precision;
+
+    NamedPatternConverter(FormattingInfo formattingInfo, int precision) {
+      super(formattingInfo);
+      this.precision =  precision;
+    }
+
+    abstract
+    String getFullyQualifiedName(PaxLoggingEvent event);
+
+    public
+    String convert(PaxLoggingEvent event) {
+      String n = getFullyQualifiedName(event);
+      if(precision <= 0)
+	return n;
+      else {
+	int len = n.length();
+
+	// We substract 1 from 'len' when assigning to 'end' to avoid out of
+	// bounds exception in return r.substring(end+1, len). This can happen if
+	// precision is 1 and the category name ends with a dot.
+	int end = len -1 ;
+	for(int i = precision; i > 0; i--) {
+	  end = n.lastIndexOf('.', end-1);
+	  if(end == -1)
+	    return n;
+	}
+	return n.substring(end+1, len);
+      }
+    }
+  }
+
+  private class ClassNamePatternConverter extends NamedPatternConverter {
+
+    ClassNamePatternConverter(FormattingInfo formattingInfo, int precision) {
+      super(formattingInfo, precision);
+    }
+
+    String getFullyQualifiedName(PaxLoggingEvent event) {
+      return event.getLocationInformation().getClassName();
+    }
+  }
+
+  private class CategoryPatternConverter extends NamedPatternConverter {
+
+    CategoryPatternConverter(FormattingInfo formattingInfo, int precision) {
+      super(formattingInfo, precision);
+    }
+
+    String getFullyQualifiedName(PaxLoggingEvent event) {
+      return event.getLoggerName();
+    }
+  }
+}
+

Added: servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml?rev=652336&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml Wed Apr 30 04:26:15 2008
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd
+  http://www.springframework.org/schema/osgi-compendium
+  http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+    <bean id="display-log" class="org.apache.servicemix.gshell.log.DisplayLog">
+        <property name="events" ref="events" />
+        <property name="pattern" value="${pattern}" />
+    </bean>
+
+    <bean id="get-log-level" class="org.apache.servicemix.gshell.log.GetLogLevel" />
+
+    <bean id="set-log-level" class="org.apache.servicemix.gshell.log.SetLogLevel" />
+
+    <bean id="vmLogAppender" class="org.apache.servicemix.gshell.log.VmLogAppender">
+        <property name="events" ref="events" />
+    </bean>
+
+    <bean id="events" class="org.apache.servicemix.gshell.log.LruList">
+        <constructor-arg value="${size}" />
+    </bean>
+
+    <osgi:service ref="display-log" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="log"/>
+        <entry key="alias" value="display"/>
+        <entry key="alias" value="d"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="get-log-level" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="log"/>
+        <entry key="alias" value="get"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="set-log-level" interface="org.apache.geronimo.gshell.command.Command">
+      <osgi:service-properties>
+        <entry key="shell" value="log"/>
+        <entry key="alias" value="set"/>
+      </osgi:service-properties>
+    </osgi:service>
+
+    <osgi:service ref="vmLogAppender" interface="org.ops4j.pax.logging.spi.PaxAppender">
+        <osgi:service-properties>
+            <entry>
+                <key><util:constant static-field="org.ops4j.pax.logging.PaxLoggingService.APPENDER_NAME_PROPERTY"/></key>
+                <value>VmLogAppender</value>
+            </entry>
+        </osgi:service-properties>
+    </osgi:service>
+
+    <osgix:property-placeholder persistent-id="org.apache.servicemix.log">
+        <osgix:default-properties>
+            <prop key="size">500</prop>
+            <prop key="pattern">%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n</prop>
+        </osgix:default-properties>
+    </osgix:property-placeholder>
+
+</beans>
\ No newline at end of file

Modified: servicemix/smx4/kernel/trunk/gshell/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/pom.xml?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/pom.xml Wed Apr 30 04:26:15 2008
@@ -39,6 +39,7 @@
         <module>gshell-obr</module>
         <module>gshell-wrapper</module>
         <module>gshell-features</module>
+        <module>gshell-log</module>
     </modules>
 
 </project>

Modified: servicemix/smx4/kernel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/pom.xml?rev=652336&r1=652335&r2=652336&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/pom.xml Wed Apr 30 04:26:15 2008
@@ -80,7 +80,7 @@
       <jline.version>0.9.93</jline.version>
       <log4j.version>1.2.14</log4j.version>
       <mina.version>1.1.6</mina.version>
-      <pax.logging.version>1.0.0</pax.logging.version>
+      <pax.logging.version>1.1-SNAPSHOT</pax.logging.version>
       <pax.url.version>0.3.0</pax.url.version>
       <servicemix.legal.version>1.0</servicemix.legal.version>
       <servicemix.spec.version>1.0-SNAPSHOT</servicemix.spec.version>
@@ -102,12 +102,20 @@
            <name>Apache ServiceMix Repository</name>
            <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
        </repository>
-       <!-- Spring Milestone repo -->
+       <!-- OPS4J repo -->
        <repository>
            <id>ops4j</id>
            <name>OPS4j Repository</name>
            <url>http://repository.ops4j.org/maven2</url>
        </repository>
+       <!-- OPS4J snapshots repo -->
+       <repository>
+           <id>ops4j-snapshots</id>
+           <name>OPS4j Snapshots Repository</name>
+           <url>http://repository.ops4j.org/mvn-snapshots</url>
+           <releases><enabled>false</enabled></releases>
+           <snapshots><enabled>true</enabled></snapshots>
+       </repository>
    </repositories>
 
   <pluginRepositories>