
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SLF4J: Simple Logging Facade for Java". The branch, master has been updated via 461e0efd24a6875eee7950ad60c9117514fbba29 (commit) via 0047754f0bc10ceebde3b8e50e23a0dc40e93c44 (commit) via 442e90ba5785cba96a620d0b4fa1f1a6ae267051 (commit) from f9eb71c563caa3b4e26fbe4a3a2ea40ef024e4fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=461e0efd24a6875eee7950ad60c... http://github.com/ceki/slf4j/commit/461e0efd24a6875eee7950ad60c9117514fbba29 commit 461e0efd24a6875eee7950ad60c9117514fbba29 Author: Ceki Gulcu <ceki@qos.ch> Date: Thu Sep 27 13:12:05 2012 +0200 forcedLog method should be in the Category class as in the original log4j software diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java index 2fd6ccf..2282339 100644 --- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Category.java @@ -290,6 +290,10 @@ public class Category { LocationAwareLogger.ERROR_INT, message, t); } + protected void forcedLog(String FQCN, Priority p, Object msg, Throwable t) { + log(FQCN, p, msg, t); + } + // See also http://bugzilla.slf4j.org/show_bug.cgi?id=168 public void log(String FQCN, Priority p, Object msg, Throwable t) { int levelInt = priorityToLevelInt(p); diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java index a9e264a..cf9f605 100644 --- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java @@ -48,10 +48,6 @@ public class Logger extends Category { return getLogger(clazz.getName()); } - protected void forcedLog(String FQCN, Priority p, Object msg, Throwable t) { - log(FQCN, p, msg, t); - } - /** * Does the obvious. * http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=0047754f0bc10ceebde3b8e50e2... http://github.com/ceki/slf4j/commit/0047754f0bc10ceebde3b8e50e23a0dc40e93c44 commit 0047754f0bc10ceebde3b8e50e23a0dc40e93c44 Merge: 442e90b f9eb71c Author: Christian Trutz <christian.trutz@belaso.de> Date: Thu Sep 27 12:19:09 2012 +0200 Merge branch 'master' of https://github.com/qos-ch/slf4j http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=442e90ba5785cba96a620d0b4fa... http://github.com/ceki/slf4j/commit/442e90ba5785cba96a620d0b4fa1f1a6ae267051 commit 442e90ba5785cba96a620d0b4fa1f1a6ae267051 Author: Christian Trutz <christian.trutz@belaso.de> Date: Thu Sep 27 12:17:34 2012 +0200 log4j-over-slf4j works now also with IBM DB2 Content Manager 8. Signed-off-by: Christian Trutz <christian.trutz@belaso.de> diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java new file mode 100644 index 0000000..4ea3d99 --- /dev/null +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +// Contributors: Christian Trutz <christian.trutz@belaso.de> +package org.apache.log4j; + +/** + * This class is a minimal implementation of the original Log4J class. + * + * @author Christian Trutz <christian.trutz@belaso.de> + * */ +public class Layout { + +} diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java index aff7c04..5ce8a99 100644 --- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Log4jLoggerFactory.java @@ -1,66 +1,78 @@ -/* - * 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.log4j; - -import java.util.Hashtable; - -import org.slf4j.helpers.Util; - -/** - * This class is a factory that creates and maintains org.apache.log4j.Loggers - * wrapping org.slf4j.Loggers. - * - * It keeps a hashtable of all created org.apache.log4j.Logger instances so that - * all newly created instances are not dulpicates of existing loggers. - * - * @author Sébastien Pennec - */ -class Log4jLoggerFactory { - - // String, Logger - private static Hashtable log4jLoggers = new Hashtable(); - - private static final String LOG4J_DELEGATION_LOOP_URL = "http://www.slf4j.org/codes.html#log4jDelegationLoop"; - - // check for delegation loops - static { - try { - Class.forName("org.slf4j.impl.Log4jLoggerFactory"); - String part1 = "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. "; - String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL - + " for more details."; - - Util.report(part1); - Util.report(part2); - throw new IllegalStateException(part1 + part2); - } catch (ClassNotFoundException e) { - // this is the good case - } - } - - public static synchronized Logger getLogger(String name) { - if (log4jLoggers.containsKey(name)) { - return (org.apache.log4j.Logger) log4jLoggers.get(name); - } else { - Logger log4jLogger = new Logger(name); - - log4jLoggers.put(name, log4jLogger); - return log4jLogger; - } - } - -} +/* + * 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.log4j; + +import java.util.Hashtable; + +import org.apache.log4j.spi.LoggerFactory; +import org.slf4j.helpers.Util; + +/** + * This class is a factory that creates and maintains org.apache.log4j.Loggers + * wrapping org.slf4j.Loggers. + * + * It keeps a hashtable of all created org.apache.log4j.Logger instances so that + * all newly created instances are not dulpicates of existing loggers. + * + * @author Sébastien Pennec + */ +class Log4jLoggerFactory { + + // String, Logger + private static Hashtable log4jLoggers = new Hashtable(); + + private static final String LOG4J_DELEGATION_LOOP_URL = "http://www.slf4j.org/codes.html#log4jDelegationLoop"; + + // check for delegation loops + static { + try { + Class.forName("org.slf4j.impl.Log4jLoggerFactory"); + String part1 = "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. "; + String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL + + " for more details."; + + Util.report(part1); + Util.report(part2); + throw new IllegalStateException(part1 + part2); + } catch (ClassNotFoundException e) { + // this is the good case + } + } + + public static synchronized Logger getLogger(String name) { + if (log4jLoggers.containsKey(name)) { + return (org.apache.log4j.Logger) log4jLoggers.get(name); + } else { + Logger log4jLogger = new Logger(name); + + log4jLoggers.put(name, log4jLogger); + return log4jLogger; + } + } + + public static synchronized Logger getLogger(String name, LoggerFactory loggerFactory) { + if (log4jLoggers.containsKey(name)) { + return (org.apache.log4j.Logger) log4jLoggers.get(name); + } else { + Logger log4jLogger = loggerFactory.makeNewLoggerInstance(name); + + log4jLoggers.put(name, log4jLogger); + return log4jLogger; + } + } + +} diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java index 98c1d64..a9e264a 100644 --- a/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/Logger.java @@ -1,79 +1,88 @@ -/* - * 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.log4j; - -import org.slf4j.spi.LocationAwareLogger; - -/** - * <p> - * This class is a minimal implementation of the original - * <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2) - * delegating all calls to a {@link org.slf4j.Logger} instance. - * </p> - * - * @author Ceki Gülcü - * */ -public class Logger extends Category { - - private static final String LOGGER_FQCN = Logger.class.getName(); - - protected Logger(String name) { - super(name); - } - - public static Logger getLogger(String name) { - return Log4jLoggerFactory.getLogger(name); - } - - public static Logger getLogger(Class clazz) { - return getLogger(clazz.getName()); - } - - /** - * Does the obvious. - * - * @return - */ - public static Logger getRootLogger() { - return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); - } - - - /** - * Delegates to {@link org.slf4j.Logger#isTraceEnabled} - * method of SLF4J. - */ - public boolean isTraceEnabled() { - return slf4jLogger.isTraceEnabled(); - } - - /** - * Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J. - */ - public void trace(Object message) { - differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null); - } - - /** - * Delegates to {@link org.slf4j.Logger#trace(String,Throwable)} - * method in SLF4J. - */ - public void trace(Object message, Throwable t) { - differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null); - } - -} +/* + * 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.log4j; + +import org.apache.log4j.spi.LoggerFactory; +import org.slf4j.spi.LocationAwareLogger; + +/** + * <p> + * This class is a minimal implementation of the original + * <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2) + * delegating all calls to a {@link org.slf4j.Logger} instance. + * </p> + * + * @author Ceki Gülcü + * */ +public class Logger extends Category { + + private static final String LOGGER_FQCN = Logger.class.getName(); + + protected Logger(String name) { + super(name); + } + + public static Logger getLogger(String name) { + return Log4jLoggerFactory.getLogger(name); + } + + public static Logger getLogger(String name, LoggerFactory loggerFactory) { + return Log4jLoggerFactory.getLogger(name,loggerFactory); + } + + public static Logger getLogger(Class clazz) { + return getLogger(clazz.getName()); + } + + protected void forcedLog(String FQCN, Priority p, Object msg, Throwable t) { + log(FQCN, p, msg, t); + } + + /** + * Does the obvious. + * + * @return + */ + public static Logger getRootLogger() { + return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); + } + + + /** + * Delegates to {@link org.slf4j.Logger#isTraceEnabled} + * method of SLF4J. + */ + public boolean isTraceEnabled() { + return slf4jLogger.isTraceEnabled(); + } + + /** + * Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J. + */ + public void trace(Object message) { + differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null); + } + + /** + * Delegates to {@link org.slf4j.Logger#trace(String,Throwable)} + * method in SLF4J. + */ + public void trace(Object message, Throwable t) { + differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null); + } + +} diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java new file mode 100644 index 0000000..3f65f44 --- /dev/null +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +// Contributors: Christian Trutz <christian.trutz@belaso.de> +package org.apache.log4j; + +/** + * This class is a minimal implementation of the original Log4J class. + * + * @author Christian Trutz <christian.trutz@belaso.de> + * */ +public class PatternLayout extends Layout { + +} ----------------------------------------------------------------------- Summary of changes: .../src/main/java/org/apache/log4j/Category.java | 4 + .../java/org/apache/log4j/{spi => }/Layout.java | 9 +- .../java/org/apache/log4j/Log4jLoggerFactory.java | 144 ++++++++++-------- .../src/main/java/org/apache/log4j/Logger.java | 163 ++++++++++---------- .../{BasicConfigurator.java => PatternLayout.java} | 16 +-- 5 files changed, 180 insertions(+), 156 deletions(-) copy log4j-over-slf4j/src/main/java/org/apache/log4j/{spi => }/Layout.java (73%) copy log4j-over-slf4j/src/main/java/org/apache/log4j/{BasicConfigurator.java => PatternLayout.java} (73%) hooks/post-receive -- SLF4J: Simple Logging Facade for Java