Author: craigmcc
Date: Fri Dec 15 20:06:37 2006
New Revision: 487757

URL: http://svn.apache.org/viewvc?view=rev&rev=487757
Log:
Define an adapter layer for logging that delegates to Apache Commons Logging
(if present), or JDK 1.4+ logging (if present), or writes to System.out.
Shale Remoting functional logic has not yet been modified to utilize these
adapters (to make it easy to review them separately, or consider placing them
in a shared module for use by other Shale modules).

There was pushback on SHALE-281 related to switching to JDK 1.4 logging
unconditionally, but this change (once completed) would allow the Commons
Logging dependency in Shale Remoting to be marked optional.  This is
particularly important for this module, because it will often be used in a
manner independent of the rest of the framework (such as embedded within a
JSF component library), and therefore should have zero required dependencies
outside the platform APIs that must be provided (servlet, JSP, JSF).

Added:
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
   (with props)
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
   (with props)
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
   (with props)
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
   (with props)
    
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
   (with props)
Modified:
    
shale/framework/trunk/shale-remoting/src/main/resources/META-INF/faces-config.xml

Added: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java?view=auto&rev=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
 (added)
+++ 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
 Fri Dec 15 20:06:37 2006
@@ -0,0 +1,51 @@
+/*
+ * 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.shale.remoting.logger;
+
+import java.text.MessageFormat;
+import org.apache.shale.remoting.logger.Logger;
+
+/**
+ * <p>Abstract base class for [EMAIL PROTECTED] Logger} implementations.</p>
+ */
+public abstract class AbstractLogger implements Logger {
+    
+
+    // ------------------------------------------------------- Protected 
Methods
+
+
+    /**
+     * <p>Return a formatted message based on the specified parameters.</p>
+     *
+     * @param message Message string (treated as a message format if the
+     *  <code>params</code> parameter has one or more elements)
+     * @param params Substitution parameters for a message format string,
+     *  or <code>null</code> if there are no such parameters
+     */
+    protected String message(String message, Object[] params) {
+
+        if ((params == null) || (params.length < 1)) {
+            return message;
+        } else {
+            return MessageFormat.format(message, params);
+        }
+
+    }
+
+
+}

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/AbstractLogger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java?view=auto&rev=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
 (added)
+++ 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
 Fri Dec 15 20:06:37 2006
@@ -0,0 +1,167 @@
+/*
+ * 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.shale.remoting.logger;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * <p>Implementation of [EMAIL PROTECTED] Logger} that interacts with the 
Apache Jakarta
+ * Commons Logging APIs.</p>
+ */
+public final class CommonsLogger extends AbstractLogger {
+    
+
+    // ------------------------------------------------------ Condition 
Checking
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isTraceEnabled(String name) {
+        return logger(name).isTraceEnabled();
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isDebugEnabled(String name) {
+        return logger(name).isDebugEnabled();
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isInfoEnabled(String name) {
+        return logger(name).isInfoEnabled();
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isWarnEnabled(String name) {
+        return logger(name).isWarnEnabled();
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isErrorEnabled(String name) {
+        return logger(name).isErrorEnabled();
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isFatalEnabled(String name) {
+        return logger(name).isFatalEnabled();
+    }
+
+
+    // ------------------------------------------------------------- Log 
Methods
+
+
+    /** [EMAIL PROTECTED] */
+    public void trace(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).trace(message(message, params));
+        } else {
+            logger(name).trace(message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void debug(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).debug(message(message, params));
+        } else {
+            logger(name).debug(message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void info(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).info(message(message, params));
+        } else {
+            logger(name).info(message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void warn(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).warn(message(message, params));
+        } else {
+            logger(name).warn(message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void error(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).error(message(message, params));
+        } else {
+            logger(name).error(message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void fatal(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).fatal(message(message, params));
+        } else {
+            logger(name).fatal(message(message, params), exception);
+        }
+    }
+
+
+    // --------------------------------------------------------- Private 
Methods
+
+
+    /**
+     * <p>Map of Commons Logging <code>Log</code> instances, keyed by name.</p>
+     */
+    private Map loggers = new HashMap();
+
+
+    /**
+     * <p>Return a Commons Logging <code>Log</code> instance for the specified
+     * logger name, creating a new one if necessary.</p>
+     *
+     * @param name Name of the requested logger
+     */
+    private synchronized Log logger(String name) {
+
+        Log logger = (Log) loggers.get(name);
+        if (logger == null) {
+            logger = LogFactory.getLog(name);
+            loggers.put(name, logger);
+        }
+        return logger;
+
+    }
+
+
+}

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/CommonsLogger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java?view=auto&rev=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
 (added)
+++ 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
 Fri Dec 15 20:06:37 2006
@@ -0,0 +1,217 @@
+/*
+ * 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.shale.remoting.logger;
+
+import org.apache.shale.remoting.logger.Logger;
+
+/**
+ * <p>Default [EMAIL PROTECTED] Logger} implementation that delegates to 
Apache Commons
+ * Logging (if present), or JDK <code>java.util.Logging</code> (if present),
+ * or simply writes to <code>System.out</code>.</p>
+ */
+public class DefaultLogger extends AbstractLogger {
+
+
+    // ------------------------------------------------------------ 
Constructors
+
+
+    /**
+     * <p>Construct a new DefaultLogger instance, deciding which
+     * [EMAIL PROTECTED] Logger} implementation, if any, we should delegate 
to.</p>
+     */
+    public DefaultLogger() {
+
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+        // Delegate to Apache Commons Logging if possible
+        try {
+            Class clazz = 
loader.loadClass("org.apache.shale.remoting.logger.CommonsLogger");
+            this.logger = (Logger) clazz.newInstance();
+            return;
+        } catch (Exception e) {
+            ; // Fall through
+        }
+
+        // Delegate to JDK java.util.logging Logging if possible
+        try {
+            Class clazz = 
loader.loadClass("org.apache.shale.remoting.logger.JdkLogger");
+            this.logger = (Logger) clazz.newInstance();
+            return;
+        } catch (Exception e) {
+            ; // Fall through
+        }
+
+        // We will do the logging stuff ourself
+
+    }
+
+
+    // ------------------------------------------------------ Instance 
Variables
+
+
+    /**
+     * <p>The [EMAIL PROTECTED] Logger} instance we should delegate to (if 
any).</p>
+     */
+    protected Logger logger = null;
+
+
+    // ------------------------------------------------------ Condition 
Checking
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isTraceEnabled(String name) {
+        if (logger != null) {
+            return logger.isTraceEnabled(name);
+        }
+        return false;
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isDebugEnabled(String name) {
+        if (logger != null) {
+            return logger.isDebugEnabled(name);
+        }
+        return false;
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isInfoEnabled(String name) {
+        if (logger != null) {
+            return logger.isInfoEnabled(name);
+        }
+        return false;
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isWarnEnabled(String name) {
+        if (logger != null) {
+            return logger.isWarnEnabled(name);
+        }
+        return false;
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isErrorEnabled(String name) {
+        if (logger != null) {
+            return logger.isErrorEnabled(name);
+        }
+        return false;
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isFatalEnabled(String name) {
+        if (logger != null) {
+            return logger.isFatalEnabled(name);
+        }
+        return false;
+    }
+
+
+    // ------------------------------------------------------------- Log 
Methods
+
+
+    /** [EMAIL PROTECTED] */
+    public void trace(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (logger != null) {
+            trace(name, message, exception, params);
+            return;
+        }
+        System.out.println("TRACE: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void debug(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (logger != null) {
+            debug(name, message, exception, params);
+            return;
+        }
+        System.out.println("DEBUG: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void info(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (logger != null) {
+            info(name, message, exception, params);
+            return;
+        }
+        System.out.println("INFO: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void warn(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (logger != null) {
+            warn(name, message, exception, params);
+            return;
+        }
+        System.out.println("WARN: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void error(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (logger != null) {
+            error(name, message, exception, params);
+            return;
+        }
+        System.out.println("ERROR: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void fatal(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (logger != null) {
+            fatal(name, message, exception, params);
+            return;
+        }
+        System.out.println("FATAL: " + message(message, params));
+        if (exception != null) {
+            exception.printStackTrace(System.out);
+        }
+    }
+
+
+}

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/DefaultLogger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java?view=auto&rev=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
 (added)
+++ 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
 Fri Dec 15 20:06:37 2006
@@ -0,0 +1,170 @@
+/*
+ * 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.shale.remoting.logger;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * <p>Implementation of [EMAIL PROTECTED] Logger} that interacts with the 
standard
+ * <code>java.util.logging</code> APIs.</p>
+ */
+public final class JdkLogger extends AbstractLogger {
+    
+
+    // ------------------------------------------------------ Condition 
Checking
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isTraceEnabled(String name) {
+        return logger(name).isLoggable(Level.FINEST);
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isDebugEnabled(String name) {
+        return logger(name).isLoggable(Level.FINE);
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isInfoEnabled(String name) {
+        return logger(name).isLoggable(Level.INFO);
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isWarnEnabled(String name) {
+        return logger(name).isLoggable(Level.WARNING);
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isErrorEnabled(String name) {
+        return logger(name).isLoggable(Level.SEVERE);
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public boolean isFatalEnabled(String name) {
+        return logger(name).isLoggable(Level.SEVERE);
+    }
+
+
+    // ------------------------------------------------------------- Log 
Methods
+
+
+    /** [EMAIL PROTECTED] */
+    public void trace(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.FINEST, message(message, params));
+        } else {
+            logger(name).log(Level.FINEST, message(message, params), 
exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void debug(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.FINE, message(message, params));
+        } else {
+            logger(name).log(Level.FINE, message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void info(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.INFO, message(message, params));
+        } else {
+            logger(name).log(Level.INFO, message(message, params), exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void warn(String name, String message,
+                     Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.WARNING, message(message, params));
+        } else {
+            logger(name).log(Level.WARNING, message(message, params), 
exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void error(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.SEVERE, message(message, params));
+        } else {
+            logger(name).log(Level.SEVERE, message(message, params), 
exception);
+        }
+    }
+
+
+    /** [EMAIL PROTECTED] */
+    public void fatal(String name, String message,
+                      Throwable exception, Object[] params) {
+        if (exception == null) {
+            logger(name).log(Level.SEVERE, message(message, params));
+        } else {
+            logger(name).log(Level.SEVERE, message(message, params), 
exception);
+        }
+    }
+
+
+    // --------------------------------------------------------- Private 
Methods
+
+
+    /**
+     * <p>Map of <code>Logger</code> instances, keyed by name.</p>
+     */
+    private Map loggers = new HashMap();
+
+
+    /**
+     * <p>Return a <code>Logger</code> instance for the specified
+     * logger name, creating a new one if necessary.</p>
+     *
+     * @param name Name of the requested logger
+     */
+    private synchronized Logger logger(String name) {
+
+        Logger logger = (Logger) loggers.get(name);
+        if (logger == null) {
+            logger = LogManager.getLogManager().getLogger(name);
+            loggers.put(name, logger);
+        }
+        return logger;
+
+    }
+
+
+}

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/JdkLogger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java?view=auto&rev=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
 (added)
+++ 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
 Fri Dec 15 20:06:37 2006
@@ -0,0 +1,165 @@
+/*
+ * 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.shale.remoting.logger;
+
+/**
+ * <p>Adapter to logging systems that intends to make Commons Logging
+ * optional on deployments running on JDK 1.4 or later.</p>
+ */
+public interface Logger {
+    
+
+    // ------------------------------------------------------ Condition 
Checking
+
+
+    /**
+     * <p>Is trace level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isTraceEnabled(String name);
+
+
+    /**
+     * <p>Is debug level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isDebugEnabled(String name);
+
+
+    /**
+     * <p>Is info level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isInfoEnabled(String name);
+
+
+    /**
+     * <p>Is warning level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isWarnEnabled(String name);
+
+
+    /**
+     * <p>Is error level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isErrorEnabled(String name);
+
+
+    /**
+     * <p>Is fatal level debugging enabled on the specified logger?</p>
+     *
+     * @param name Name of the logger to check
+     */
+    public boolean isFatalEnabled(String name);
+
+
+    // ------------------------------------------------------------- Log 
Methods
+
+
+    /**
+     * <p>Log a message at trace severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void trace(String name, String message,
+                      Throwable exception, Object[] params);
+
+
+    /**
+     * <p>Log a message at debug severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void debug(String name, String message,
+                      Throwable exception, Object[] params);
+
+
+    /**
+     * <p>Log a message at info severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void info(String name, String message,
+                     Throwable exception, Object[] params);
+
+
+    /**
+     * <p>Log a message at warning severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void warn(String name, String message,
+                     Throwable exception, Object[] params);
+
+
+    /**
+     * <p>Log a message at error severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void error(String name, String message,
+                      Throwable exception, Object[] params);
+
+
+    /**
+     * <p>Log a message at fatal severity.</p>
+     *
+     * @param name Name of the logger to use
+     * @param message Text message to record (treated as a message format if
+     *  the <code>params</code> argument is not null)
+     * @param exception Exception to report, or <code>null</code> for none
+     * @param params Message4 format replacement parameters, or
+     *  <code>null</code> for none
+     */
+    public void fatal(String name, String message,
+                      Throwable exception, Object[] params);
+
+
+}

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
shale/framework/trunk/shale-remoting/src/main/java/org/apache/shale/remoting/logger/Logger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: 
shale/framework/trunk/shale-remoting/src/main/resources/META-INF/faces-config.xml
URL: 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-remoting/src/main/resources/META-INF/faces-config.xml?view=diff&rev=487757&r1=487756&r2=487757
==============================================================================
--- 
shale/framework/trunk/shale-remoting/src/main/resources/META-INF/faces-config.xml
 (original)
+++ 
shale/framework/trunk/shale-remoting/src/main/resources/META-INF/faces-config.xml
 Fri Dec 15 20:06:37 2006
@@ -35,7 +35,17 @@
 
   <lifecycle>
     <!-- Load the phase listener that provides remoting services -->
-    
<phase-listener>org.apache.shale.remoting.faces.RemotingPhaseListener</phase-listener>
+      <phase-listener>
+          org.apache.shale.remoting.faces.RemotingPhaseListener
+      </phase-listener>
   </lifecycle>
+
+  <managed-bean>
+    <!-- Default logging adapter implementation -->
+      <managed-bean-name>org.apache.shale.remoting.LOGGER</managed-bean-name>
+      <managed-bean-class>
+          org.apache.shale.remoting.logger.DefaultLogger
+      </managed-bean-class>
+  </managed-bean>
 
 </faces-config>


Reply via email to