Revision: 757
http://stripes.svn.sourceforge.net/stripes/?rev=757&view=rev
Author: javelotinfo
Date: 2008-01-18 10:22:52 -0800 (Fri, 18 Jan 2008)
Log Message:
-----------
After some discussion, it has been decided not to switch to SLF4J. Instead,
commons-logging has been upgraded to version 1.1.1. Furthermore, Log4J was
upgraded to version 1.2.15.
Modified Paths:
--------------
trunk/.classpath
trunk/build.xml
trunk/examples/Examples.iml
trunk/readme.txt
trunk/stripes/pom.xml
trunk/stripes/src/net/sourceforge/stripes/util/Log.java
trunk/stripes/src/net/sourceforge/stripes/util/Log4JLogger.java
trunk/stripes/stripes.iml
Added Paths:
-----------
trunk/examples/web/WEB-INF/lib/log4j-1.2.15.jar
trunk/stripes/lib/deploy/commons-logging.jar
trunk/stripes/lib/deploy/commons-logging.license
trunk/stripes/lib/deploy/commons-logging.notice
trunk/stripes/lib/test/log4j-1.2.15.jar
Removed Paths:
-------------
trunk/examples/web/WEB-INF/lib/log4j-1.2.9.jar
trunk/stripes/lib/deploy/slf4j-api.jar
trunk/stripes/lib/deploy/slf4j.license
trunk/stripes/lib/test/jcl104-over-slf4j.jar
trunk/stripes/lib/test/log4j-1.2.9.jar
trunk/stripes/lib/test/slf4j-simple.jar
Property Changed:
----------------
trunk/examples/web/WEB-INF/lib/
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/.classpath 2008-01-18 18:22:52 UTC (rev 757)
@@ -6,7 +6,7 @@
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib"
path="stripes/lib/test/commons-fileupload-1.2.jar"/>
<classpathentry kind="lib" path="stripes/lib/test/commons-io-1.2.jar"/>
- <classpathentry kind="lib" path="stripes/lib/deploy/slf4j-api.jar"/>
+ <classpathentry kind="lib"
path="stripes/lib/deploy/commons-logging.jar"/>
<classpathentry kind="lib" path="stripes/lib/deploy/cos.jar"/>
<classpathentry kind="lib" path="build/lib/hostedqa.jar"/>
<classpathentry kind="lib" path="stripes/lib/build/jsp-api.jar"/>
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/build.xml 2008-01-18 18:22:52 UTC (rev 757)
@@ -134,8 +134,8 @@
<include name="examples/web/**"/>
<exclude name="examples/web/WEB-INF/src/**"/>
<exclude name="examples/web/WEB-INF/classes/**"/>
+ <exclude name="examples/web/WEB-INF/lib/commons-logging.jar"/>
<exclude name="examples/web/WEB-INF/lib/cos.jar"/>
- <exclude name="examples/web/WEB-INF/lib/slf4j-api.jar"/>
<exclude name="examples/web/WEB-INF/lib/spring.jar"/>
<exclude name="examples/web/WEB-INF/lib/stripes.jar"/>
<include name="examples/build.xml"/>
Modified: trunk/examples/Examples.iml
===================================================================
--- trunk/examples/Examples.iml 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/examples/Examples.iml 2008-01-18 18:22:52 UTC (rev 757)
@@ -89,7 +89,7 @@
<containerElement type="library" level="module">
<attribute name="method" value="0" />
<attribute name="URI" value="<N/A>" />
- <url>jar://$MODULE_DIR$/../stripes/lib/deploy/slf4j-api.jar!/</url>
+ <url>jar://$MODULE_DIR$/../stripes/lib/deploy/commons-logging.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="0" />
Property changes on: trunk/examples/web/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
- cos.jar
slf4j-api.jar
stripes.jar
+ cos.jar
commons-logging.jar
stripes.jar
Added: trunk/examples/web/WEB-INF/lib/log4j-1.2.15.jar
===================================================================
(Binary files differ)
Property changes on: trunk/examples/web/WEB-INF/lib/log4j-1.2.15.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/examples/web/WEB-INF/lib/log4j-1.2.9.jar
===================================================================
(Binary files differ)
Modified: trunk/readme.txt
===================================================================
--- trunk/readme.txt 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/readme.txt 2008-01-18 18:22:52 UTC (rev 757)
@@ -57,7 +57,7 @@
-> Copy the following files into your classpath (preferably WEB-INF/lib
for deployment)
-> lib/stripes.jar
- -> lib/slf4j-api.jar
+ -> lib/commons-logging.jar
-> lib/cos.jar
-> Copy 'lib/StripesResources.properties' into /WEB-INF/classes or in to
another
@@ -115,13 +115,14 @@
Stripes is distributed with a small number of libraries on which it depends.
Those libraries are:
- -> Simple Logging Facade for Java (http://www.slf4j.org)
- SLF4J is used to provide Stripes with a logging mechanism that
+ -> Jakarta Commons Logging (http://jakarta.apache.org/commons/logging/)
+ Commons logging is used to provide Stripes with a logging mechanism that
does not tie it to a specific logging implementation. In reality, most
- users will probably be using Log4J, and so will need to configure SLF4J
- to point at Log4J.
- SLF4J is licensed under the MIT License, a copy of which is included in
- lib/slf4j.license
+ users will probably be using Log4J, and so will need to configure commons
+ logging to point at Log4J. A sample configuration file is included in
+ the example application at: examples/src/commons-logging.properties
+ Commons Logging is licensed under the Apache License Version 2.0, a copy
+ of which is included in lib/commons-logging.license
-> COS or com.oreilly.servlets by Jason Hunter (http://servlets.com/cos/)
COS provides one of only a couple of good implementations to handle HTTP
Added: trunk/stripes/lib/deploy/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on: trunk/stripes/lib/deploy/commons-logging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/stripes/lib/deploy/commons-logging.license
===================================================================
--- trunk/stripes/lib/deploy/commons-logging.license
(rev 0)
+++ trunk/stripes/lib/deploy/commons-logging.license 2008-01-18 18:22:52 UTC
(rev 757)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
Added: trunk/stripes/lib/deploy/commons-logging.notice
===================================================================
--- trunk/stripes/lib/deploy/commons-logging.notice
(rev 0)
+++ trunk/stripes/lib/deploy/commons-logging.notice 2008-01-18 18:22:52 UTC
(rev 757)
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Deleted: trunk/stripes/lib/deploy/slf4j-api.jar
===================================================================
(Binary files differ)
Deleted: trunk/stripes/lib/deploy/slf4j.license
===================================================================
--- trunk/stripes/lib/deploy/slf4j.license 2008-01-18 05:15:29 UTC (rev
756)
+++ trunk/stripes/lib/deploy/slf4j.license 2008-01-18 18:22:52 UTC (rev
757)
@@ -1,24 +0,0 @@
-Copyright (c) 2004-2007 QOS.ch
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
Deleted: trunk/stripes/lib/test/jcl104-over-slf4j.jar
===================================================================
(Binary files differ)
Added: trunk/stripes/lib/test/log4j-1.2.15.jar
===================================================================
(Binary files differ)
Property changes on: trunk/stripes/lib/test/log4j-1.2.15.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/stripes/lib/test/log4j-1.2.9.jar
===================================================================
(Binary files differ)
Deleted: trunk/stripes/lib/test/slf4j-simple.jar
===================================================================
(Binary files differ)
Modified: trunk/stripes/pom.xml
===================================================================
--- trunk/stripes/pom.xml 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/stripes/pom.xml 2008-01-18 18:22:52 UTC (rev 757)
@@ -35,9 +35,27 @@
<optional>true</optional>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.4.3</version>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>logkit</groupId>
+ <artifactId>logkit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
@@ -65,7 +83,7 @@
<version>5.5</version>
<scope>test</scope>
</dependency>
-
+
<!-- Spring is needed to compile the Spring support in Stripes, and
from then on, only if
you are actually using Spring in your own application.
-->
@@ -76,7 +94,7 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
-
+
<!-- Commons fileupload and io are listed as optional dependencies for
Stripes beceause
they are needed to compile and use the commons version of the
MultipartWrapper.
However, the default implementation uses COS instead, so these
jars are only
Modified: trunk/stripes/src/net/sourceforge/stripes/util/Log.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/Log.java 2008-01-18
05:15:29 UTC (rev 756)
+++ trunk/stripes/src/net/sourceforge/stripes/util/Log.java 2008-01-18
18:22:52 UTC (rev 757)
@@ -14,38 +14,38 @@
*/
package net.sourceforge.stripes.util;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
+import org.apache.commons.logging.LogFactory;
import java.util.Arrays;
/**
- * <p>A <em>wafer thin</em> wrapper around SLF4J (Simple Logging Facade for
Java) that uses var-args
- * to make it much more efficient to call the logging methods without having
to surround every call
- * site with calls to Logger.isXXXEnabled(). All the methods on this class
take a variable length
- * list of arguments and, only if logging is enabled for the level and channel
being logged to, will
- * those arguments be toString()'d and appended together.</p>
+ * <p>A <em>wafer thin</em> wrapper around Commons logging that uses var-args
to make it
+ * much more efficient to call the logging methods in commons logging without
having to
+ * surround every call site with calls to Log.isXXXEnabled(). All the methods
on this
+ * class take a variable length list of arguments and, only if logging is
enabled for
+ * the level and channel being logged to, will those arguments be toString()'d
and
+ * appended together.</p>
*
* @author Tim Fennell
*/
public final class Log {
- private Logger realLog;
+ private org.apache.commons.logging.Log realLog;
/**
* Get a Log instance to perform logging within the Class specified.
Returns an instance
- * of this class which wraps an instance of the SLF4J Logger class.
+ * of this class which wraps an instance of the commons logging Log class.
* @param clazz the Class which is going to be doing the logging
* @return a Log instance with which to log
*/
public static Log getInstance(Class<?> clazz) {
- return new Log( LoggerFactory.getLogger(clazz) );
+ return new Log( LogFactory.getLog(clazz) );
}
/**
- * Private constructor which creates a new Logger instance wrapping the
SLF4J Logger instance
+ * Private constructor which creates a new Log instance wrapping the
commons Log instance
* provided. Only used by the static getInstance() method on this class.
*/
- private Log(Logger realLog) {
+ private Log(org.apache.commons.logging.Log realLog) {
this.realLog = realLog;
}
@@ -56,8 +56,8 @@
* to form the log message.
*/
public final void fatal(Throwable throwable, Object... messageParts) {
- if (this.realLog.isErrorEnabled()) {
- this.realLog.error(combineParts(messageParts), throwable);
+ if (this.realLog.isFatalEnabled()) {
+ this.realLog.fatal(combineParts(messageParts), throwable);
}
}
@@ -129,8 +129,8 @@
* to form the log message.
*/
public final void fatal(Object... messageParts) {
- if (this.realLog.isErrorEnabled()) {
- this.realLog.error(combineParts(messageParts));
+ if (this.realLog.isFatalEnabled()) {
+ this.realLog.fatal(combineParts(messageParts));
}
}
@@ -192,7 +192,7 @@
/**
* Combines all the message parts handed in to the logger in order to pass
them in to
- * the SLF4J interface.
+ * the commons logging interface.
*/
private String combineParts(Object[] messageParts) {
StringBuilder builder = new StringBuilder(128);
Modified: trunk/stripes/src/net/sourceforge/stripes/util/Log4JLogger.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/Log4JLogger.java
2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/stripes/src/net/sourceforge/stripes/util/Log4JLogger.java
2008-01-18 18:22:52 UTC (rev 757)
@@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
package net.sourceforge.stripes.util;
import java.io.Serializable;
+import org.apache.commons.logging.Log;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.apache.log4j.Level;
-import org.slf4j.helpers.MarkerIgnoringBase;
-import org.slf4j.helpers.MessageFormatter;
/**
* Implementation of [EMAIL PROTECTED] Log} that maps directly to a
@@ -46,13 +47,13 @@
*/
@SuppressWarnings({ "serial", "deprecation" })
-public class Log4JLogger extends MarkerIgnoringBase implements
org.slf4j.Logger, Serializable {
+public class Log4JLogger implements Log, Serializable {
// ------------------------------------------------------------- Attributes
/** The fully qualified name of the Log4JLogger class.
*
- * ADP - This is the only change from the original in slf4j-api */
+ * ADP - This is the only change from the original in
commons-logging-1.1-src */
private static final String FQCN =
net.sourceforge.stripes.util.Log.class.getName();
/** Log to this logger */
@@ -67,7 +68,7 @@
// Static Initializer.
//
// Note that this must come after the static variable declarations
- // otherwise initializer expressions associated with those variables
+ // otherwise initialiser expressions associated with those variables
// will override any settings done here.
//
// Verify that log4j is available, and that it is version 1.2.
@@ -94,12 +95,14 @@
traceLevel = Priority.DEBUG;
}
}
+
// ------------------------------------------------------------ Constructor
public Log4JLogger() {
}
+
/**
* Base constructor.
*/
@@ -110,11 +113,12 @@
/** For use with a log4j factory.
*/
- public Log4JLogger(Logger logger) {
+ public Log4JLogger(Logger logger ) {
this.name = logger.getName();
this.logger=logger;
}
+
// ---------------------------------------------------------
// Implementation
//
@@ -132,12 +136,6 @@
// version 1.2 of log4j.
// ---------------------------------------------------------
- /**
- * Returns the name of this logger instance.
- */
- public String getName() {
- return getLogger().getName();
- }
/**
* Logs a message with <code>org.apache.log4j.Priority.TRACE</code>.
@@ -145,12 +143,13 @@
* level, the message will be logged at the <code>DEBUG</code> level.
*
* @param message to log
- * @see org.slf4j.Logger#trace(String)
+ * @see org.apache.commons.logging.Log#trace(Object)
*/
- public void trace(String message) {
- getLogger().log(FQCN, traceLevel, message, null);
+ public void trace(Object message) {
+ getLogger().log(FQCN, traceLevel, message, null );
}
+
/**
* Logs a message with <code>org.apache.log4j.Priority.TRACE</code>.
* When using a log4j version that does not support the <code>TRACE</code>
@@ -158,72 +157,21 @@
*
* @param message to log
* @param t log this cause
- * @see org.slf4j.Logger#trace(String, Throwable)
+ * @see org.apache.commons.logging.Log#trace(Object, Throwable)
*/
- public void trace(String message, Throwable t) {
- getLogger().log(FQCN, traceLevel, message, t);
+ public void trace(Object message, Throwable t) {
+ getLogger().log(FQCN, traceLevel, message, t );
}
- /**
- * Log a message at level TRACE according to the specified format and
- * argument.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for level TRACE. </p>
- *
- * @param format the format string
- * @param arg the argument
- */
- public void trace(String format, Object arg) {
- if (isTraceEnabled()) {
- String msgStr = MessageFormatter.format(format, arg);
- getLogger().log(FQCN, traceLevel, msgStr, null);
- }
- }
/**
- * Log a message at level TRACE according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the TRACE level. </p>
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void trace(String format, Object arg1, Object arg2) {
- if (isTraceEnabled()) {
- String msgStr = MessageFormatter.format(format, arg1, arg2);
- logger.log(FQCN, traceLevel, msgStr, null);
- }
- }
-
- /**
- * Log a message at level TRACE according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the TRACE level. </p>
- *
- * @param format the format string
- * @param argArray an array of arguments
- */
- public void trace(String format, Object[] argArray) {
- if (isTraceEnabled()) {
- String msgStr = MessageFormatter.arrayFormat(format, argArray);
- logger.log(FQCN, traceLevel, msgStr, null);
- }
- }
-
- /**
* Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>.
*
* @param message to log
- * @see org.slf4j.Logger#debug(String)
+ * @see org.apache.commons.logging.Log#debug(Object)
*/
- public void debug(String message) {
- getLogger().log(FQCN, Priority.DEBUG, message, null);
+ public void debug(Object message) {
+ getLogger().log(FQCN, Priority.DEBUG, message, null );
}
/**
@@ -231,283 +179,105 @@
*
* @param message to log
* @param t log this cause
- * @see org.slf4j.Logger#debug(String, Throwable)
+ * @see org.apache.commons.logging.Log#debug(Object, Throwable)
*/
- public void debug(String message, Throwable t) {
- getLogger().log(FQCN, Priority.DEBUG, message, t);
+ public void debug(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.DEBUG, message, t );
}
- /**
- * Log a message at level DEBUG according to the specified format and
- * argument.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for level DEBUG. </p>
- *
- * @param format the format string
- * @param arg the argument
- */
- public void debug(String format, Object arg) {
- if (logger.isDebugEnabled()) {
- String msgStr = MessageFormatter.format(format, arg);
- logger.log(FQCN, Priority.DEBUG, msgStr, null);
- }
- }
/**
- * Log a message at level DEBUG according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the DEBUG level. </p>
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void debug(String format, Object arg1, Object arg2) {
- if (logger.isDebugEnabled()) {
- String msgStr = MessageFormatter.format(format, arg1, arg2);
- logger.log(FQCN, Priority.DEBUG, msgStr, null);
- }
- }
-
- /**
- * Log a message at level DEBUG according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the DEBUG level. </p>
- *
- * @param format the format string
- * @param argArray an array of arguments
- */
- public void debug(String format, Object[] argArray) {
- if (logger.isDebugEnabled()) {
- String msgStr = MessageFormatter.arrayFormat(format, argArray);
- logger.log(FQCN, Priority.DEBUG, msgStr, null);
- }
- }
-
- /**
* Logs a message with <code>org.apache.log4j.Priority.INFO</code>.
*
* @param message to log
- * @see org.slf4j.Logger#info(String)
+ * @see org.apache.commons.logging.Log#info(Object)
*/
- public void info(String message) {
- getLogger().log(FQCN, Priority.INFO, message, null);
+ public void info(Object message) {
+ getLogger().log(FQCN, Priority.INFO, message, null );
}
+
/**
* Logs a message with <code>org.apache.log4j.Priority.INFO</code>.
*
* @param message to log
* @param t log this cause
- * @see org.slf4j.Logger#info(String, Throwable)
+ * @see org.apache.commons.logging.Log#info(Object, Throwable)
*/
- public void info(String message, Throwable t) {
- getLogger().log(FQCN, Priority.INFO, message, t);
+ public void info(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.INFO, message, t );
}
- /**
- * Log a message at level INFO according to the specified format and
- * argument.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the INFO level. </p>
- *
- * @param format the format string
- * @param arg the argument
- */
- public void info(String format, Object arg) {
- if (logger.isInfoEnabled()) {
- String msgStr = MessageFormatter.format(format, arg);
- logger.log(FQCN, Level.INFO, msgStr, null);
- }
- }
/**
- * Log a message at the INFO level according to the specified format
- * and arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the INFO level. </p>
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void info(String format, Object arg1, Object arg2) {
- if (logger.isInfoEnabled()) {
- String msgStr = MessageFormatter.format(format, arg1, arg2);
- logger.log(FQCN, Level.INFO, msgStr, null);
- }
- }
-
- /**
- * Log a message at level INFO according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the INFO level. </p>
- *
- * @param format the format string
- * @param argArray an array of arguments
- */
- public void info(String format, Object[] argArray) {
- if (logger.isInfoEnabled()) {
- String msgStr = MessageFormatter.arrayFormat(format, argArray);
- logger.log(FQCN, Level.INFO, msgStr, null);
- }
- }
-
- /**
* Logs a message with <code>org.apache.log4j.Priority.WARN</code>.
*
* @param message to log
- * @see org.slf4j.Logger#warn(String)
+ * @see org.apache.commons.logging.Log#warn(Object)
*/
- public void warn(String message) {
- getLogger().log(FQCN, Priority.WARN, message, null);
+ public void warn(Object message) {
+ getLogger().log(FQCN, Priority.WARN, message, null );
}
+
/**
* Logs a message with <code>org.apache.log4j.Priority.WARN</code>.
*
* @param message to log
* @param t log this cause
- * @see org.slf4j.Logger#warn(String, Throwable)
+ * @see org.apache.commons.logging.Log#warn(Object, Throwable)
*/
- public void warn(String message, Throwable t) {
- getLogger().log(FQCN, Priority.WARN, message, t);
+ public void warn(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.WARN, message, t );
}
- /**
- * Log a message at the WARN level according to the specified
- * format and argument.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the WARN level. </p>
- *
- * @param format the format string
- * @param arg the argument
- */
- public void warn(String format, Object arg) {
- if (logger.isEnabledFor(Level.WARN)) {
- String msgStr = MessageFormatter.format(format, arg);
- logger.log(FQCN, Level.WARN, msgStr, null);
- }
- }
/**
- * Log a message at the WARN level according to the specified
- * format and arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the WARN level. </p>
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
- */
- public void warn(String format, Object arg1, Object arg2) {
- if (logger.isEnabledFor(Level.WARN)) {
- String msgStr = MessageFormatter.format(format, arg1, arg2);
- logger.log(FQCN, Level.WARN, msgStr, null);
- }
- }
-
- /**
- * Log a message at level WARN according to the specified format and
- * arguments.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the WARN level. </p>
- *
- * @param format the format string
- * @param argArray an array of arguments
- */
- public void warn(String format, Object[] argArray) {
- if (logger.isEnabledFor(Level.WARN)) {
- String msgStr = MessageFormatter.arrayFormat(format, argArray);
- logger.log(FQCN, Level.WARN, msgStr, null);
- }
- }
-
- /**
* Logs a message with <code>org.apache.log4j.Priority.ERROR</code>.
*
* @param message to log
- * @see org.slf4j.Logger#error(String)
+ * @see org.apache.commons.logging.Log#error(Object)
*/
- public void error(String message) {
- getLogger().log(FQCN, Priority.ERROR, message, null);
+ public void error(Object message) {
+ getLogger().log(FQCN, Priority.ERROR, message, null );
}
+
/**
* Logs a message with <code>org.apache.log4j.Priority.ERROR</code>.
*
* @param message to log
* @param t log this cause
- * @see org.slf4j.Logger#error(String, Throwable)
+ * @see org.apache.commons.logging.Log#error(Object, Throwable)
*/
- public void error(String message, Throwable t) {
- getLogger().log(FQCN, Priority.ERROR, message, t);
+ public void error(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.ERROR, message, t );
}
- /**
- * Log a message at the ERROR level according to the specified
- * format and argument.
- *
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the ERROR level. </p>
- *
- * @param format the format string
- * @param arg the argument
- */
- public void error(String format, Object arg) {
- if (logger.isEnabledFor(Level.ERROR)) {
- String msgStr = MessageFormatter.format(format, arg);
- logger.log(FQCN, Level.ERROR, msgStr, null);
- }
- }
/**
- * Log a message at the ERROR level according to the specified
- * format and arguments.
+ * Logs a message with <code>org.apache.log4j.Priority.FATAL</code>.
*
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the ERROR level. </p>
- *
- * @param format the format string
- * @param arg1 the first argument
- * @param arg2 the second argument
+ * @param message to log
+ * @see org.apache.commons.logging.Log#fatal(Object)
*/
- public void error(String format, Object arg1, Object arg2) {
- if (logger.isEnabledFor(Level.ERROR)) {
- String msgStr = MessageFormatter.format(format, arg1, arg2);
- logger.log(FQCN, Level.ERROR, msgStr, null);
- }
+ public void fatal(Object message) {
+ getLogger().log(FQCN, Priority.FATAL, message, null );
}
+
/**
- * Log a message at level ERROR according to the specified format and
- * arguments.
+ * Logs a message with <code>org.apache.log4j.Priority.FATAL</code>.
*
- * <p>This form avoids superfluous object creation when the logger
- * is disabled for the ERROR level. </p>
- *
- * @param format the format string
- * @param argArray an array of arguments
+ * @param message to log
+ * @param t log this cause
+ * @see org.apache.commons.logging.Log#fatal(Object, Throwable)
*/
- public void error(String format, Object[] argArray) {
- if (logger.isEnabledFor(Level.ERROR)) {
- String msgStr = MessageFormatter.arrayFormat(format, argArray);
- logger.log(FQCN, Level.ERROR, msgStr, null);
- }
+ public void fatal(Object message, Throwable t) {
+ getLogger().log(FQCN, Priority.FATAL, message, t );
}
+
/**
* Return the native Logger instance we are using.
*/
@@ -518,6 +288,7 @@
return (this.logger);
}
+
/**
* Check whether the Log4j Logger used is enabled for <code>DEBUG</code>
priority.
*/
@@ -525,20 +296,31 @@
return getLogger().isDebugEnabled();
}
- /**
+
+ /**
* Check whether the Log4j Logger used is enabled for <code>ERROR</code>
priority.
*/
public boolean isErrorEnabled() {
return getLogger().isEnabledFor(Priority.ERROR);
}
+
/**
+ * Check whether the Log4j Logger used is enabled for <code>FATAL</code>
priority.
+ */
+ public boolean isFatalEnabled() {
+ return getLogger().isEnabledFor(Priority.FATAL);
+ }
+
+
+ /**
* Check whether the Log4j Logger used is enabled for <code>INFO</code>
priority.
*/
public boolean isInfoEnabled() {
return getLogger().isInfoEnabled();
}
+
/**
* Check whether the Log4j Logger used is enabled for <code>TRACE</code>
priority.
* When using a log4j version that does not support the TRACE level, this
call
Modified: trunk/stripes/stripes.iml
===================================================================
--- trunk/stripes/stripes.iml 2008-01-18 05:15:29 UTC (rev 756)
+++ trunk/stripes/stripes.iml 2008-01-18 18:22:52 UTC (rev 757)
@@ -13,7 +13,7 @@
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/deploy/slf4j-api.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/deploy/commons-logging.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development