Author: fmeschbe
Date: Thu Sep 25 07:10:25 2008
New Revision: 698974
URL: http://svn.apache.org/viewvc?rev=698974&view=rev
Log:
SLING-674 Replace Tomcat juli by own own implementation to have
Jasper log to SLF4J
Added:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Log.java
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogConfigurationException.java
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogFactory.java
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Slf4jLog.java
Modified:
incubator/sling/trunk/scripting/jsp/pom.xml
Modified: incubator/sling/trunk/scripting/jsp/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/pom.xml?rev=698974&r1=698973&r2=698974&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/pom.xml (original)
+++ incubator/sling/trunk/scripting/jsp/pom.xml Thu Sep 25 07:10:25 2008
@@ -62,7 +62,8 @@
<Private-Package>
org.apache.sling.scripting.jsp,
!org.apache.sling.scripting.jsp.jasper.runtime,
- org.apache.sling.scripting.jsp.jasper.*
+ org.apache.sling.scripting.jsp.jasper.*,
+ org.apache.juli.logging
</Private-Package>
<DynamicImport-Package>*</DynamicImport-Package>
@@ -75,7 +76,7 @@
<!-- Embed Jasper completely -->
<Embed-Dependency>
- jasper*,juli,el-api,jsp-api
+ jasper*,el-api,jsp-api
</Embed-Dependency>
<Embed-StripGroup>true</Embed-StripGroup>
</instructions>
@@ -143,11 +144,6 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
- <artifactId>juli</artifactId>
- <version>6.0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
<artifactId>el-api</artifactId>
<version>6.0.14</version>
</dependency>
Added:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Log.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Log.java?rev=698974&view=auto
==============================================================================
---
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Log.java
(added)
+++
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Log.java
Thu Sep 25 07:10:25 2008
@@ -0,0 +1,245 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.juli.logging;
+
+/**
+ * <p>A simple logging interface abstracting logging APIs. In order to be
+ * instantiated successfully by [EMAIL PROTECTED] LogFactory}, classes that
implement
+ * this interface must have a constructor that takes a single String
+ * parameter representing the "name" of this Log.</p>
+ *
+ * <p> The six logging levels used by <code>Log</code> are (in order):
+ * <ol>
+ * <li>trace (the least serious)</li>
+ * <li>debug</li>
+ * <li>info</li>
+ * <li>warn</li>
+ * <li>error</li>
+ * <li>fatal (the most serious)</li>
+ * </ol>
+ * The mapping of these log levels to the concepts used by the underlying
+ * logging system is implementation dependent.
+ * The implemention should ensure, though, that this ordering behaves
+ * as expected.</p>
+ *
+ * <p>Performance is often a logging concern.
+ * By examining the appropriate property,
+ * a component can avoid expensive operations (producing information
+ * to be logged).</p>
+ *
+ * <p> For example,
+ * <code><pre>
+ * if (log.isDebugEnabled()) {
+ * ... do something expensive ...
+ * log.debug(theResult);
+ * }
+ * </pre></code>
+ * </p>
+ *
+ * <p>Configuration of the underlying logging system will generally be done
+ * external to the Logging APIs, through whatever mechanism is supported by
+ * that system.</p>
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Scott Sanders</a>
+ * @author Rod Waldhoff
+ * @version $Id: Log.java 381838 2006-02-28 23:57:11Z skitching $
+ */
+public interface Log {
+
+
+ // ----------------------------------------------------- Logging Properties
+
+
+ /**
+ * <p> Is debug logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than debug. </p>
+ *
+ * @return true if debug is enabled in the underlying logger.
+ */
+ public boolean isDebugEnabled();
+
+
+ /**
+ * <p> Is error logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than error. </p>
+ *
+ * @return true if error is enabled in the underlying logger.
+ */
+ public boolean isErrorEnabled();
+
+
+ /**
+ * <p> Is fatal logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than fatal. </p>
+ *
+ * @return true if fatal is enabled in the underlying logger.
+ */
+ public boolean isFatalEnabled();
+
+
+ /**
+ * <p> Is info logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than info. </p>
+ *
+ * @return true if info is enabled in the underlying logger.
+ */
+ public boolean isInfoEnabled();
+
+
+ /**
+ * <p> Is trace logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than trace. </p>
+ *
+ * @return true if trace is enabled in the underlying logger.
+ */
+ public boolean isTraceEnabled();
+
+
+ /**
+ * <p> Is warn logging currently enabled? </p>
+ *
+ * <p> Call this method to prevent having to perform expensive operations
+ * (for example, <code>String</code> concatenation)
+ * when the log level is more than warn. </p>
+ *
+ * @return true if warn is enabled in the underlying logger.
+ */
+ public boolean isWarnEnabled();
+
+
+ // -------------------------------------------------------- Logging Methods
+
+
+ /**
+ * <p> Log a message with trace log level. </p>
+ *
+ * @param message log this message
+ */
+ public void trace(Object message);
+
+
+ /**
+ * <p> Log an error with trace log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void trace(Object message, Throwable t);
+
+
+ /**
+ * <p> Log a message with debug log level. </p>
+ *
+ * @param message log this message
+ */
+ public void debug(Object message);
+
+
+ /**
+ * <p> Log an error with debug log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void debug(Object message, Throwable t);
+
+
+ /**
+ * <p> Log a message with info log level. </p>
+ *
+ * @param message log this message
+ */
+ public void info(Object message);
+
+
+ /**
+ * <p> Log an error with info log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void info(Object message, Throwable t);
+
+
+ /**
+ * <p> Log a message with warn log level. </p>
+ *
+ * @param message log this message
+ */
+ public void warn(Object message);
+
+
+ /**
+ * <p> Log an error with warn log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void warn(Object message, Throwable t);
+
+
+ /**
+ * <p> Log a message with error log level. </p>
+ *
+ * @param message log this message
+ */
+ public void error(Object message);
+
+
+ /**
+ * <p> Log an error with error log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void error(Object message, Throwable t);
+
+
+ /**
+ * <p> Log a message with fatal log level. </p>
+ *
+ * @param message log this message
+ */
+ public void fatal(Object message);
+
+
+ /**
+ * <p> Log an error with fatal log level. </p>
+ *
+ * @param message log this message
+ * @param t log this cause
+ */
+ public void fatal(Object message, Throwable t);
+
+
+}
Added:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogConfigurationException.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogConfigurationException.java?rev=698974&view=auto
==============================================================================
---
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogConfigurationException.java
(added)
+++
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogConfigurationException.java
Thu Sep 25 07:10:25 2008
@@ -0,0 +1,19 @@
+/*
+ * $Url: $
+ * $Id: $
+ *
+ * Copyright 1997-2005 Day Management AG
+ * Barfuesserplatz 6, 4001 Basel, Switzerland
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Day Management AG, ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with Day.
+ */
+package org.apache.juli.logging;
+
+public class LogConfigurationException extends RuntimeException {
+
+}
Added:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogFactory.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogFactory.java?rev=698974&view=auto
==============================================================================
---
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogFactory.java
(added)
+++
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/LogFactory.java
Thu Sep 25 07:10:25 2008
@@ -0,0 +1,57 @@
+/*
+ * 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.juli.logging;
+
+public class LogFactory {
+
+ /**
+ * Convenience method to return a named logger, without the application
+ * having to care about factories.
+ *
+ * @param clazz Class from which a log name will be derived
+ *
+ * @exception LogConfigurationException if a suitable <code>Log</code>
+ * instance cannot be returned
+ */
+ public static Log getLog(Class clazz)
+ throws LogConfigurationException {
+
+ return getLog(clazz.getName());
+
+ }
+
+
+ /**
+ * Convenience method to return a named logger, without the application
+ * having to care about factories.
+ *
+ * @param name Logical name of the <code>Log</code> instance to be
+ * returned (the meaning of this name is only known to the underlying
+ * logging implementation that is being wrapped)
+ *
+ * @exception LogConfigurationException if a suitable <code>Log</code>
+ * instance cannot be returned
+ */
+ public static Log getLog(String name)
+ throws LogConfigurationException {
+
+ return new Slf4jLog(name);
+
+ }
+}
Added:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Slf4jLog.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Slf4jLog.java?rev=698974&view=auto
==============================================================================
---
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Slf4jLog.java
(added)
+++
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/juli/logging/Slf4jLog.java
Thu Sep 25 07:10:25 2008
@@ -0,0 +1,105 @@
+/*
+ * 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.juli.logging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Slf4jLog implements Log {
+
+ private Logger delegatee;
+
+ Slf4jLog(String name) {
+ this.delegatee = LoggerFactory.getLogger(name);
+ }
+
+ public void debug(Object message, Throwable t) {
+ delegatee.debug(message.toString(), t);
+ }
+
+ public void debug(Object message) {
+ delegatee.debug(message.toString());
+ }
+
+ public void error(Object message, Throwable t) {
+ delegatee.error(message.toString(), t);
+ }
+
+ public void error(Object message) {
+ delegatee.error(message.toString());
+ }
+
+ public void fatal(Object message, Throwable t) {
+ delegatee.error(message.toString(), t);
+ }
+
+ public void fatal(Object message) {
+ delegatee.error(message.toString());
+ }
+
+ public void info(Object message, Throwable t) {
+ delegatee.info(message.toString(), t);
+ }
+
+ public void info(Object message) {
+ delegatee.info(message.toString());
+ }
+
+ public boolean isDebugEnabled() {
+ return delegatee.isDebugEnabled();
+ }
+
+ public boolean isErrorEnabled() {
+ return delegatee.isErrorEnabled();
+ }
+
+ public boolean isFatalEnabled() {
+ return delegatee.isErrorEnabled();
+ }
+
+ public boolean isInfoEnabled() {
+ return delegatee.isInfoEnabled();
+ }
+
+ public boolean isTraceEnabled() {
+ return delegatee.isTraceEnabled();
+ }
+
+ public boolean isWarnEnabled() {
+ return delegatee.isWarnEnabled();
+ }
+
+ public void trace(Object message, Throwable t) {
+ delegatee.trace(message.toString(), t);
+ }
+
+ public void trace(Object message) {
+ delegatee.trace(message.toString());
+ }
+
+ public void warn(Object message, Throwable t) {
+ delegatee.warn(message.toString(), t);
+ }
+
+ public void warn(Object message) {
+ delegatee.warn(message.toString());
+ }
+
+
+}