From 452b9fa6b13d47c8d9583e0b65770ae3c10eb5ab Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Thu, 7 Feb 2008 20:33:38 +0000 Subject: [PATCH] - improvements to documentation - minor license correction --- slf4j-converter/pom.xml | 6 +- .../java/org/slf4j/impl/JCLLoggerAdapter.java | 44 ++++++-------- slf4j-site/src/site/pages/faq.html | 58 ++++++++++++++++++- slf4j-site/src/site/pages/index.html | 2 +- slf4j-site/src/site/pages/manual.html | 11 ++-- slf4j-site/src/site/pages/news.html | 17 +++++- 6 files changed, 102 insertions(+), 36 deletions(-) diff --git a/slf4j-converter/pom.xml b/slf4j-converter/pom.xml index 080865f4..b97e9b88 100644 --- a/slf4j-converter/pom.xml +++ b/slf4j-converter/pom.xml @@ -5,9 +5,9 @@ - org.slf4j - slf4j-parent - 1.5.0-SNAPSHOT + org.slf4j + slf4j-parent + 1.5.0-SNAPSHOT 4.0.0 diff --git a/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerAdapter.java b/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerAdapter.java index 2bfa380e..5dfd15da 100644 --- a/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerAdapter.java +++ b/slf4j-jcl/src/main/java/org/slf4j/impl/JCLLoggerAdapter.java @@ -1,36 +1,28 @@ -/* - * Copyright (c) 2004-2005 SLF4J.ORG - * Copyright (c) 2004-2005 QOS.ch - * +/* + * Copyright (c) 2004-2008 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 + * + * 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, and/or sell copies of the Software, and to permit persons - * to whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * + * 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 - * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY - * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * of the copyright holder. - * + * 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. */ + package org.slf4j.impl; import org.apache.commons.logging.Log; diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html index 5f1ff430..ff4c3cf0 100644 --- a/slf4j-site/src/site/pages/faq.html +++ b/slf4j-site/src/site/pages/faq.html @@ -108,7 +108,14 @@ prefix=''; FATAL level?
  • Why was the TRACE level introduced only in - SLF4J version 1.4.0?
  • + SLF4J version 1.4.0? + +
  • Does the SLF4J logging API support I18N + (internationalization)?
  • + + + + Implementing the SLF4J API @@ -805,6 +812,55 @@ logger.debug("The new entry is {}.", entry);

    + +
    + Does the SLF4J logging API support I18N + (internationalization)? + +
    + +
    +

    No. SLF4J does not offer any particular support for + I18N. However, nothing prevents you from implementing i18n + support around the SLF4J API.

    + +

    As suggested by Sebastien Davids in bug report + 50, a possible pattern might be:

    + +

    +class MyClass { + + ResourceBundle bundle = ResourceBundle.getBundle("my.package.messages"); + Logger logger = LoggerFactory.getLogger(MyClass.class); + + void method() { + if (logger.isWarnEnabled()) { + MessageFormat format = new MessageFormat(bundle.getString("my_message_key")); + logger.warn(format.format(new Object[] { new Date(), 1 })); + } + } +}

    + +

    Where my_message_key is defined as

    +

    my_message_key=my text to be i18n {1,date,short} {0,number,00}

    + + + + +
    + + + + + + + +
    + [top] +
    + + diff --git a/slf4j-site/src/site/pages/index.html b/slf4j-site/src/site/pages/index.html index 6ed4e521..9772a2e1 100644 --- a/slf4j-site/src/site/pages/index.html +++ b/slf4j-site/src/site/pages/index.html @@ -37,7 +37,7 @@ prefix='';

    Logging systems can either choose to implement the the SLF4J - interfaces directly, à la logback or SimpleLogger. Alternatively, it is possible (and rather easy) to write SLF4J adapters for a given diff --git a/slf4j-site/src/site/pages/manual.html b/slf4j-site/src/site/pages/manual.html index a4c85b1e..49ed04b0 100644 --- a/slf4j-site/src/site/pages/manual.html +++ b/slf4j-site/src/site/pages/manual.html @@ -149,6 +149,10 @@ prefix=''; forcing these upon your users as dependencies.

    +

    As of SLF4J version 1.5.0, SLF4J provides MDC support for + java.util.logging (JDK 1.4 logging) as well. +

    +

    For more information on MDC please see the chapter on MDC in the logback manual. @@ -267,10 +271,9 @@ prefix=''; SLF4J supports popular logging systems, namely log4j, - JDK 1.4 logging, Simple logging and NOP whereas the logback API supports - SLF4J natively. - + JDK 1.4 logging, Simple logging and NOP. The logback project supports + SLF4J natively. diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html index d1dfdac2..733baf99 100644 --- a/slf4j-site/src/site/pages/news.html +++ b/slf4j-site/src/site/pages/news.html @@ -62,7 +62,7 @@ prefix='';

    In org.apache.log4j.Category class as implemented in the log4j-over-slf4j module, calls to the trace() printing method are now correctly mapped to SLF4J's trace() printing method (instead of - debug()). Superflous printing methods with the signature + debug()). Superfluous printing methods with the signature xxxx(Object, Object) and xxxx(String, Object, Object) have been removed.

    @@ -74,6 +74,21 @@ prefix='';

    +

    Fixed bug + 69 reported by Joern Huxhorn, who graciously supplied the fix as + well as a test case. The add method in + BasicMarker class now corectly prevents multiple + addition of the same child. Moreover, the remove method + now correcty removes the specified child marker. +

    + +

    Fixed bug + 41 reported by Sebastian Davids. The manifest files of various + projects now mention J2SE-1.3 as the required execution + envirionment. +

    + +

    August 20th, 2007 - Release of SLF4J 1.4.3