From 00a68ca27f8e83c2727039b03a1c6ca3151af734 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Mon, 6 Feb 2012 23:55:13 +0000
Subject: [PATCH 001/363] Make new home for Log4j2
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1241269 13f79535-47bb-0310-9956-ffa450edef68
From 2f96fb230cf5272d6d47b7496bba82fb81922ffa Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Mon, 7 Jan 2013 00:29:30 +0000
Subject: [PATCH 002/363] Add Log4j 2 to SLF4J adapter
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1429628 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 187 ++++++++++++++++++
.../apache/logging/slf4j/MDCContextMap.java | 59 ++++++
.../org/apache/logging/slf4j/SLF4JLogger.java | 152 ++++++++++++++
.../logging/slf4j/SLF4JLoggerContext.java | 54 +++++
.../slf4j/SLF4JLoggerContextFactory.java | 31 +++
.../apache/logging/slf4j/package-info.java | 20 ++
.../META-INF/log4j-provider.properties | 19 ++
log4j-to-slf4j/src/site/site.xml | 27 +++
log4j-to-slf4j/src/site/xdoc/index.xml | 53 +++++
.../org/apache/logging/slf4j/LoggerTest.java | 174 ++++++++++++++++
.../src/test/resources/logback-slf4j.xml | 13 ++
11 files changed, 789 insertions(+)
create mode 100644 log4j-to-slf4j/pom.xml
create mode 100644 log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
create mode 100644 log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
create mode 100644 log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
create mode 100644 log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
create mode 100644 log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/package-info.java
create mode 100644 log4j-to-slf4j/src/main/resources/META-INF/log4j-provider.properties
create mode 100644 log4j-to-slf4j/src/site/site.xml
create mode 100644 log4j-to-slf4j/src/site/xdoc/index.xml
create mode 100644 log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
create mode 100644 log4j-to-slf4j/src/test/resources/logback-slf4j.xml
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
new file mode 100644
index 0000000..e6ead03
--- /dev/null
+++ b/log4j-to-slf4j/pom.xml
@@ -0,0 +1,187 @@
+
+
+ 4.0.0
+
+ org.apache.logging.log4j
+ log4j
+ 2.0-beta4-SNAPSHOT
+ ../
+
+ org.apache.logging.log4j.adapters
+ log4j-to-slf4j
+ jar
+ Apache Log4j to SLF4J Adapter
+ Binding between LOG4J 2 API and SLF4J
+
+ ${basedir}/..
+ SLF4J Documentation
+ /log4j-to-slf4j
+
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.apache.logging.log4j
+ log4j-api
+
+
+ ch.qos.logback
+ logback-core
+ test
+
+
+ ch.qos.logback
+ logback-core
+ test-jar
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-changes-plugin
+ ${changes.plugin.version}
+
+
+
+ changes-report
+
+
+
+
+ %URL%/show_bug.cgi?id=%ISSUE%
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.7
+
+
+ ${log4jParentDir}/checkstyle.xml
+ ${log4jParentDir}/checkstyle-suppressions.xml
+ false
+ basedir=${basedir}
+ licensedir=${log4jParentDir}/checkstyle-header.txt
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${javadoc.plugin.version}
+
+ Copyright © {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved.
+ Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo,
+ and the Apache Log4j logo are trademarks of The Apache Software Foundation.
]]>
+
+ false
+ true
+
+
+ issue
+ a
+ JIRA issue:
+
+
+ doubt
+ a
+ Troublesome:
+
+
+ compare
+ a
+ Compare with:
+
+
+
+
+
+ non-aggregate
+
+ javadoc
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 2.3.2
+
+ Normal
+ Default
+ findbugs-exclude-filter.xml
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.3
+
+
+ non-aggregate
+
+ jxr
+
+
+
+ aggregate
+
+ aggregate
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ ${pmd.plugin.version}
+
+ 1.5
+
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ 2.2
+
+
+
+
+
+
+
+
+
+
+
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
new file mode 100644
index 0000000..67af884
--- /dev/null
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
@@ -0,0 +1,59 @@
+/*
+ * 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.logging.slf4j;
+
+import org.apache.logging.log4j.spi.ThreadContextMap;
+import org.slf4j.MDC;
+
+import java.util.Map;
+
+/**
+ * Bind the ThreadContextMap to the SLF4J MDC.
+ */
+public class MDCContextMap implements ThreadContextMap {
+ public void put(String key, String value) {
+ MDC.put(key, value);
+ }
+
+ public String get(String key) {
+ return MDC.get(key);
+ }
+
+ public void remove(String key) {
+ MDC.remove(key);
+ }
+
+ public void clear() {
+ MDC.clear();
+ }
+
+ public boolean containsKey(String key) {
+ return MDC.getCopyOfContextMap().containsKey(key);
+ }
+
+ public Map getContext() {
+ return MDC.getCopyOfContextMap();
+ }
+
+ public Map get() {
+ return MDC.getCopyOfContextMap();
+ }
+
+ public boolean isEmpty() {
+ return MDC.getCopyOfContextMap().isEmpty();
+ }
+}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
new file mode 100644
index 0000000..547315c
--- /dev/null
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
@@ -0,0 +1,152 @@
+/*
+ * 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.logging.slf4j;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.message.LoggerNameAwareMessage;
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.MessageFactory;
+import org.apache.logging.log4j.spi.AbstractLogger;
+import org.slf4j.MarkerFactory;
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ *
+ */
+public class SLF4JLogger extends AbstractLogger {
+
+ private final org.slf4j.Logger logger;
+ private final LocationAwareLogger locationAwareLogger;
+
+ public SLF4JLogger(final String name, final org.slf4j.Logger logger) {
+ super(name);
+ this.logger = logger;
+ this.locationAwareLogger = logger instanceof LocationAwareLogger ? (LocationAwareLogger) logger : null;
+ }
+
+ public SLF4JLogger(final String name, final MessageFactory messageFactory, final org.slf4j.Logger logger) {
+ super(name, messageFactory);
+ this.logger = logger;
+ this.locationAwareLogger = logger instanceof LocationAwareLogger ? (LocationAwareLogger) logger : null;
+ }
+
+ @Override
+ protected void log(Marker marker, String fqcn, Level level, Message data, Throwable t) {
+ if (locationAwareLogger != null) {
+ if (data instanceof LoggerNameAwareMessage) {
+ ((LoggerNameAwareMessage) data).setLoggerName(getName());
+ }
+ locationAwareLogger.log(getMarker(marker), fqcn, convertLevel(level), data.getFormattedMessage(),
+ data.getParameters(), t);
+ } else {
+ switch (level) {
+ case DEBUG :
+ logger.debug(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ case TRACE :
+ logger.trace(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ case INFO :
+ logger.info(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ case WARN :
+ logger.warn(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ case ERROR :
+ logger.error(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ default :
+ logger.error(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ }
+ }
+ }
+
+ private org.slf4j.Marker getMarker(Marker marker) {
+ if (marker == null) {
+ return null;
+ }
+ Marker parent = marker.getParent();
+ org.slf4j.Marker parentMarker = parent == null ? null : getMarker(parent);
+ org.slf4j.Marker slf4jMarker = MarkerFactory.getMarker(marker.getName());
+ if (parentMarker != null && !slf4jMarker.contains(parentMarker)) {
+ slf4jMarker.add(parentMarker);
+ }
+ return slf4jMarker;
+ }
+
+ private int convertLevel(Level level) {
+ switch (level) {
+ case DEBUG :
+ return LocationAwareLogger.DEBUG_INT;
+ case TRACE :
+ return LocationAwareLogger.TRACE_INT;
+ case INFO :
+ return LocationAwareLogger.INFO_INT;
+ case WARN :
+ return LocationAwareLogger.WARN_INT;
+ case ERROR :
+ return LocationAwareLogger.ERROR_INT;
+ default :
+ return LocationAwareLogger.ERROR_INT;
+ }
+ }
+
+ @Override
+ protected boolean isEnabled(Level level, Marker marker, String data) {
+ return isEnabledFor(level, marker);
+ }
+
+ @Override
+ protected boolean isEnabled(Level level, Marker marker, String data, Throwable t) {
+ return isEnabledFor(level, marker);
+ }
+
+ @Override
+ protected boolean isEnabled(Level level, Marker marker, String data, Object... p1) {
+ return isEnabledFor(level, marker);
+ }
+
+ @Override
+ protected boolean isEnabled(Level level, Marker marker, Object data, Throwable t) {
+ return isEnabledFor(level, marker);
+ }
+
+ @Override
+ protected boolean isEnabled(Level level, Marker marker, Message data, Throwable t) {
+ return isEnabledFor(level, marker);
+ }
+
+ private boolean isEnabledFor(Level level, Marker marker) {
+ org.slf4j.Marker slf4jMarker = getMarker(marker);
+ switch (level) {
+ case DEBUG :
+ return logger.isDebugEnabled(slf4jMarker);
+ case TRACE :
+ return logger.isTraceEnabled(slf4jMarker);
+ case INFO :
+ return logger.isInfoEnabled(slf4jMarker);
+ case WARN :
+ return logger.isWarnEnabled(slf4jMarker);
+ case ERROR :
+ return logger.isErrorEnabled(slf4jMarker);
+ default :
+ return logger.isErrorEnabled(slf4jMarker);
+
+ }
+ }
+
+ public org.slf4j.Logger getLogger() {
+ return locationAwareLogger != null ? locationAwareLogger : logger;
+ }
+
+}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
new file mode 100644
index 0000000..d25e32c
--- /dev/null
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
@@ -0,0 +1,54 @@
+/*
+ * 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.logging.slf4j;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.message.MessageFactory;
+import org.apache.logging.log4j.spi.LoggerContext;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public class SLF4JLoggerContext implements LoggerContext {
+ private final ConcurrentMap loggers = new ConcurrentHashMap();
+
+ public Object getExternalContext() {
+ return null;
+ }
+
+ public Logger getLogger(String name) {
+ if (!loggers.containsKey(name)) {
+ loggers.putIfAbsent(name, new SLF4JLogger(name, LoggerFactory.getLogger(name)));
+ }
+ return loggers.get(name);
+ }
+
+ public Logger getLogger(String name, MessageFactory messageFactory) {
+ if (!loggers.containsKey(name)) {
+ loggers.putIfAbsent(name, new SLF4JLogger(name, messageFactory, LoggerFactory.getLogger(name)));
+ }
+ return loggers.get(name);
+ }
+
+ public boolean hasLogger(String name) {
+ return loggers.containsKey(name);
+ }
+}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
new file mode 100644
index 0000000..d9c9c4a
--- /dev/null
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
@@ -0,0 +1,31 @@
+/*
+ * 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.logging.slf4j;
+
+import org.apache.logging.log4j.spi.LoggerContext;
+import org.apache.logging.log4j.spi.LoggerContextFactory;
+
+/**
+ *
+ */
+public class SLF4JLoggerContextFactory implements LoggerContextFactory {
+ private static LoggerContext context = new SLF4JLoggerContext();
+
+ public LoggerContext getContext(final String FQCN, final ClassLoader loader, final boolean currentContext) {
+ return context;
+ }
+}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/package-info.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/package-info.java
new file mode 100644
index 0000000..092c09a
--- /dev/null
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+/**
+ * SLF4J support.
+ */
+package org.apache.logging.slf4j;
diff --git a/log4j-to-slf4j/src/main/resources/META-INF/log4j-provider.properties b/log4j-to-slf4j/src/main/resources/META-INF/log4j-provider.properties
new file mode 100644
index 0000000..72b3a0b
--- /dev/null
+++ b/log4j-to-slf4j/src/main/resources/META-INF/log4j-provider.properties
@@ -0,0 +1,19 @@
+# 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.
+
+LoggerContextFactory = org.apache.logging.slf4j.SLF4JLoggerContextFactory
+Log4jAPIVersion = 2.0.0
+FactoryPriority= 15
+ThreadContextMap = org.apache.logging.slf4j.MDCContextMap
\ No newline at end of file
diff --git a/log4j-to-slf4j/src/site/site.xml b/log4j-to-slf4j/src/site/site.xml
new file mode 100644
index 0000000..09a9352
--- /dev/null
+++ b/log4j-to-slf4j/src/site/site.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/log4j-to-slf4j/src/site/xdoc/index.xml b/log4j-to-slf4j/src/site/xdoc/index.xml
new file mode 100644
index 0000000..8462ab0
--- /dev/null
+++ b/log4j-to-slf4j/src/site/xdoc/index.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+ Log4j to SLF4J Adapter
+ Ralph Goers
+
+
+
+
+
+
+ The Log4j 2 to SLF4J Adapter allows applications coded to the Log4j 2 API to be routed to SLF4J.
+ Use of this adapter may cause some loss of performance as the Log4j 2 Messages must be formatted
+ before they can be passed to SLF4J. With Log4j 2 as the implementation these would normally be
+ formatted only when they are accessed by a Filter or Appender.
+
+
+
+
+
+
+ The Log4j 2 to SLF4J adapter requires at least Java 5. Use of this adapter together with the
+ SLF4J bridge should never be attempted as it will cause a events to endlessly be routed between
+ SLF4J and Log4j 2.
+
+
+
+
+
+ Include this jar, the SLF4J jar(s) and an SLF4J logging implementation jar together. Configure
+ the logging implementation as required.
+
+
+
+
+
\ No newline at end of file
diff --git a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
new file mode 100644
index 0000000..eb6750a
--- /dev/null
+++ b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -0,0 +1,174 @@
+
+/*
+* 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.logging.slf4j;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.List;
+
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.joran.spi.JoranException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.message.MessageFactory;
+import org.apache.logging.log4j.message.ParameterizedMessageFactory;
+import org.apache.logging.log4j.message.StringFormatterMessageFactory;
+import ch.qos.logback.core.testUtil.StringListAppender;
+import ch.qos.logback.classic.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class LoggerTest {
+
+ private static final String CONFIG = "target/test-classes/logback-slf4j.xml";
+ private static Logger logger;
+ private static org.slf4j.Logger slf4jLogger;
+ private static LoggerContext context;
+ private static Logger root;
+ private static ch.qos.logback.classic.Logger rootLogger;
+ private static StringListAppender list;
+
+ @BeforeClass
+ public static void setupClass() throws Exception {
+ slf4jLogger = LoggerFactory.getLogger(LoggerTest.class);
+ context = ((ch.qos.logback.classic.Logger) slf4jLogger).getLoggerContext();
+ configure(CONFIG);
+ logger = LogManager.getLogger(LoggerTest.class);
+ assertTrue("Incorrect SLF4J Logger", ((SLF4JLogger) logger).getLogger() == slf4jLogger);
+ root = LogManager.getLogger("");
+ rootLogger = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
+ list = (StringListAppender) rootLogger.getAppender("LIST");
+ rootLogger.detachAppender("console");
+ }
+
+ private static void configure(String file) throws JoranException {
+ JoranConfigurator jc = new JoranConfigurator();
+ jc.setContext(context);
+ jc.doConfigure(file);
+ }
+
+ @Before
+ public void before() {
+ list.strList.clear();
+ }
+
+ @Test
+ public void basicFlow() {
+ logger.entry();
+ logger.exit();
+ assertTrue("Incorrect number of events. Expected 2, actual " + list.strList.size(), list.strList.size() == 2);
+ }
+
+ @Test
+ public void simpleFlow() {
+ logger.entry(CONFIG);
+ logger.exit(0);
+ assertTrue("Incorrect number of events. Expected 2, actual " + list.strList.size(), list.strList.size() == 2);
+ }
+
+ @Test
+ public void throwing() {
+ logger.throwing(new IllegalArgumentException("Test Exception"));
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ }
+
+ @Test
+ public void catching() {
+ try {
+ throw new NullPointerException();
+ } catch (final Exception e) {
+ logger.catching(e);
+ }
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ }
+
+ @Test
+ public void debug() {
+ logger.debug("Debug message");
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ }
+
+ @Test
+ public void getLogger_String_MessageFactoryMismatch() {
+ final Logger testLogger = testMessageFactoryMismatch("getLogger_String_MessageFactoryMismatch",
+ StringFormatterMessageFactory.INSTANCE, ParameterizedMessageFactory.INSTANCE);
+ testLogger.debug("%,d", Integer.MAX_VALUE);
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ assertEquals(String.format("%,d", Integer.MAX_VALUE), list.strList.get(0));
+ }
+
+ @Test
+ public void getLogger_String_MessageFactoryMismatchNull() {
+ final Logger testLogger = testMessageFactoryMismatch("getLogger_String_MessageFactoryMismatchNull",
+ StringFormatterMessageFactory.INSTANCE, null);
+ testLogger.debug("%,d", Integer.MAX_VALUE);
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ assertEquals(String.format("%,d", Integer.MAX_VALUE), list.strList.get(0));
+ }
+
+ private Logger testMessageFactoryMismatch(final String name, final MessageFactory messageFactory1, final MessageFactory messageFactory2) {
+ final Logger testLogger = (Logger) LogManager.getLogger(name, messageFactory1);
+ assertNotNull(testLogger);
+ assertEquals(messageFactory1, testLogger.getMessageFactory());
+ final Logger testLogger2 = (Logger) LogManager.getLogger(name, messageFactory2);
+ assertEquals(messageFactory1, testLogger2.getMessageFactory());
+ return testLogger;
+ }
+
+ @Test
+ public void debugObject() {
+ logger.debug(new Date());
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ }
+
+ @Test
+ public void debugWithParms() {
+ logger.debug("Hello, {}", "World");
+ assertTrue("Incorrect number of events. Expected 1, actual " + list.strList.size(), list.strList.size() == 1);
+ }
+
+ @Test
+ public void testImpliedThrowable() {
+ logger.debug("This is a test", new Throwable("Testing"));
+ final List msgs = list.strList;
+ assertTrue("Incorrect number of messages. Expected 1, actual " + msgs.size(), msgs.size() == 1);
+ String expected = "java.lang.Throwable: Testing";
+ assertTrue("Incorrect message data", msgs.get(0).contains(expected));
+ }
+ @Test
+ public void mdc() {
+ ThreadContext.put("TestYear", new Integer(2010).toString());
+ logger.debug("Debug message");
+ ThreadContext.clear();
+ logger.debug("Debug message");
+ assertTrue("Incorrect number of events. Expected 2, actual " + list.strList.size(), list.strList.size() == 2);
+ assertTrue("Incorrect year", list.strList.get(0).startsWith("2010"));
+ }
+}
+
diff --git a/log4j-to-slf4j/src/test/resources/logback-slf4j.xml b/log4j-to-slf4j/src/test/resources/logback-slf4j.xml
new file mode 100644
index 0000000..ad45676
--- /dev/null
+++ b/log4j-to-slf4j/src/test/resources/logback-slf4j.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ %X{TestYear}%msg
+
+
+
+
+
+
+
From 96d07a32704a33e368176a6629c317b4cbc7ead5 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 10 Jan 2013 15:34:39 +0000
Subject: [PATCH 003/363] Remove unnecessary casts.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1431434 13f79535-47bb-0310-9956-ffa450edef68
---
.../src/test/java/org/apache/logging/slf4j/LoggerTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index eb6750a..66644b7 100644
--- a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -133,10 +133,10 @@ public void getLogger_String_MessageFactoryMismatchNull() {
}
private Logger testMessageFactoryMismatch(final String name, final MessageFactory messageFactory1, final MessageFactory messageFactory2) {
- final Logger testLogger = (Logger) LogManager.getLogger(name, messageFactory1);
+ final Logger testLogger = LogManager.getLogger(name, messageFactory1);
assertNotNull(testLogger);
assertEquals(messageFactory1, testLogger.getMessageFactory());
- final Logger testLogger2 = (Logger) LogManager.getLogger(name, messageFactory2);
+ final Logger testLogger2 = LogManager.getLogger(name, messageFactory2);
assertEquals(messageFactory1, testLogger2.getMessageFactory());
return testLogger;
}
From 0a82c864ed4a6ab6861bc3a715fbe1c42f3c8297 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 10 Jan 2013 15:40:48 +0000
Subject: [PATCH 004/363] Remove unused imports.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1431439 13f79535-47bb-0310-9956-ffa450edef68
---
.../src/test/java/org/apache/logging/slf4j/LoggerTest.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index 66644b7..0873849 100644
--- a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -35,7 +35,6 @@
import org.apache.logging.log4j.message.StringFormatterMessageFactory;
import ch.qos.logback.core.testUtil.StringListAppender;
import ch.qos.logback.classic.LoggerContext;
-import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
From b30e3bca6498e33769856d62e3bfdb03495ac6ba Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 10 Jan 2013 20:23:34 +0000
Subject: [PATCH 005/363] Add final modifier to local variables.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1431609 13f79535-47bb-0310-9956-ffa450edef68
---
.../main/java/org/apache/logging/slf4j/SLF4JLogger.java | 8 ++++----
.../test/java/org/apache/logging/slf4j/LoggerTest.java | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
index 547315c..d269ad3 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
@@ -75,9 +75,9 @@ private org.slf4j.Marker getMarker(Marker marker) {
if (marker == null) {
return null;
}
- Marker parent = marker.getParent();
- org.slf4j.Marker parentMarker = parent == null ? null : getMarker(parent);
- org.slf4j.Marker slf4jMarker = MarkerFactory.getMarker(marker.getName());
+ final Marker parent = marker.getParent();
+ final org.slf4j.Marker parentMarker = parent == null ? null : getMarker(parent);
+ final org.slf4j.Marker slf4jMarker = MarkerFactory.getMarker(marker.getName());
if (parentMarker != null && !slf4jMarker.contains(parentMarker)) {
slf4jMarker.add(parentMarker);
}
@@ -127,7 +127,7 @@ protected boolean isEnabled(Level level, Marker marker, Message data, Throwable
}
private boolean isEnabledFor(Level level, Marker marker) {
- org.slf4j.Marker slf4jMarker = getMarker(marker);
+ final org.slf4j.Marker slf4jMarker = getMarker(marker);
switch (level) {
case DEBUG :
return logger.isDebugEnabled(slf4jMarker);
diff --git a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index 0873849..16a9fd0 100644
--- a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -67,7 +67,7 @@ public static void setupClass() throws Exception {
}
private static void configure(String file) throws JoranException {
- JoranConfigurator jc = new JoranConfigurator();
+ final JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
jc.doConfigure(file);
}
@@ -157,7 +157,7 @@ public void testImpliedThrowable() {
logger.debug("This is a test", new Throwable("Testing"));
final List msgs = list.strList;
assertTrue("Incorrect number of messages. Expected 1, actual " + msgs.size(), msgs.size() == 1);
- String expected = "java.lang.Throwable: Testing";
+ final String expected = "java.lang.Throwable: Testing";
assertTrue("Incorrect message data", msgs.get(0).contains(expected));
}
@Test
From 76ba16241a1297eb410879e75d6136aa9c35012f Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Fri, 11 Jan 2013 05:33:44 +0000
Subject: [PATCH 006/363] Add final modifier to method parameters.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1431898 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/logging/slf4j/MDCContextMap.java | 8 ++++----
.../org/apache/logging/slf4j/SLF4JLogger.java | 18 +++++++++---------
.../logging/slf4j/SLF4JLoggerContext.java | 6 +++---
.../org/apache/logging/slf4j/LoggerTest.java | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
index 67af884..5eabba4 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
@@ -25,15 +25,15 @@
* Bind the ThreadContextMap to the SLF4J MDC.
*/
public class MDCContextMap implements ThreadContextMap {
- public void put(String key, String value) {
+ public void put(final String key, final String value) {
MDC.put(key, value);
}
- public String get(String key) {
+ public String get(final String key) {
return MDC.get(key);
}
- public void remove(String key) {
+ public void remove(final String key) {
MDC.remove(key);
}
@@ -41,7 +41,7 @@ public void clear() {
MDC.clear();
}
- public boolean containsKey(String key) {
+ public boolean containsKey(final String key) {
return MDC.getCopyOfContextMap().containsKey(key);
}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
index d269ad3..307acff 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
@@ -46,7 +46,7 @@ public SLF4JLogger(final String name, final MessageFactory messageFactory, final
}
@Override
- protected void log(Marker marker, String fqcn, Level level, Message data, Throwable t) {
+ protected void log(final Marker marker, final String fqcn, final Level level, final Message data, final Throwable t) {
if (locationAwareLogger != null) {
if (data instanceof LoggerNameAwareMessage) {
((LoggerNameAwareMessage) data).setLoggerName(getName());
@@ -71,7 +71,7 @@ protected void log(Marker marker, String fqcn, Level level, Message data, Throwa
}
}
- private org.slf4j.Marker getMarker(Marker marker) {
+ private org.slf4j.Marker getMarker(final Marker marker) {
if (marker == null) {
return null;
}
@@ -84,7 +84,7 @@ private org.slf4j.Marker getMarker(Marker marker) {
return slf4jMarker;
}
- private int convertLevel(Level level) {
+ private int convertLevel(final Level level) {
switch (level) {
case DEBUG :
return LocationAwareLogger.DEBUG_INT;
@@ -102,31 +102,31 @@ private int convertLevel(Level level) {
}
@Override
- protected boolean isEnabled(Level level, Marker marker, String data) {
+ protected boolean isEnabled(final Level level, final Marker marker, final String data) {
return isEnabledFor(level, marker);
}
@Override
- protected boolean isEnabled(Level level, Marker marker, String data, Throwable t) {
+ protected boolean isEnabled(final Level level, final Marker marker, final String data, final Throwable t) {
return isEnabledFor(level, marker);
}
@Override
- protected boolean isEnabled(Level level, Marker marker, String data, Object... p1) {
+ protected boolean isEnabled(final Level level, final Marker marker, final String data, final Object... p1) {
return isEnabledFor(level, marker);
}
@Override
- protected boolean isEnabled(Level level, Marker marker, Object data, Throwable t) {
+ protected boolean isEnabled(final Level level, final Marker marker, final Object data, final Throwable t) {
return isEnabledFor(level, marker);
}
@Override
- protected boolean isEnabled(Level level, Marker marker, Message data, Throwable t) {
+ protected boolean isEnabled(final Level level, final Marker marker, final Message data, final Throwable t) {
return isEnabledFor(level, marker);
}
- private boolean isEnabledFor(Level level, Marker marker) {
+ private boolean isEnabledFor(final Level level, final Marker marker) {
final org.slf4j.Marker slf4jMarker = getMarker(marker);
switch (level) {
case DEBUG :
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
index d25e32c..6f98ec0 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContext.java
@@ -34,21 +34,21 @@ public Object getExternalContext() {
return null;
}
- public Logger getLogger(String name) {
+ public Logger getLogger(final String name) {
if (!loggers.containsKey(name)) {
loggers.putIfAbsent(name, new SLF4JLogger(name, LoggerFactory.getLogger(name)));
}
return loggers.get(name);
}
- public Logger getLogger(String name, MessageFactory messageFactory) {
+ public Logger getLogger(final String name, final MessageFactory messageFactory) {
if (!loggers.containsKey(name)) {
loggers.putIfAbsent(name, new SLF4JLogger(name, messageFactory, LoggerFactory.getLogger(name)));
}
return loggers.get(name);
}
- public boolean hasLogger(String name) {
+ public boolean hasLogger(final String name) {
return loggers.containsKey(name);
}
}
diff --git a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index 16a9fd0..873c986 100644
--- a/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -66,7 +66,7 @@ public static void setupClass() throws Exception {
rootLogger.detachAppender("console");
}
- private static void configure(String file) throws JoranException {
+ private static void configure(final String file) throws JoranException {
final JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
jc.doConfigure(file);
From 5cf2f217c9c8c693ced5f773ae3387a4e3893fdc Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Sat, 19 Jan 2013 15:03:30 +0000
Subject: [PATCH 007/363] Fix some of the checkstyle errors that have recently
been introduced.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1435569 13f79535-47bb-0310-9956-ffa450edef68
---
.../main/java/org/apache/logging/slf4j/SLF4JLogger.java | 9 ++++++++-
.../apache/logging/slf4j/SLF4JLoggerContextFactory.java | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
index 307acff..e516651 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
@@ -46,7 +46,8 @@ public SLF4JLogger(final String name, final MessageFactory messageFactory, final
}
@Override
- protected void log(final Marker marker, final String fqcn, final Level level, final Message data, final Throwable t) {
+ protected void log(final Marker marker, final String fqcn, final Level level, final Message data,
+ final Throwable t) {
if (locationAwareLogger != null) {
if (data instanceof LoggerNameAwareMessage) {
((LoggerNameAwareMessage) data).setLoggerName(getName());
@@ -57,16 +58,22 @@ protected void log(final Marker marker, final String fqcn, final Level level, fi
switch (level) {
case DEBUG :
logger.debug(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
case TRACE :
logger.trace(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
case INFO :
logger.info(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
case WARN :
logger.warn(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
case ERROR :
logger.error(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
default :
logger.error(getMarker(marker), data.getFormattedMessage(), data.getParameters(), t);
+ break;
}
}
}
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
index d9c9c4a..893610d 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
@@ -25,7 +25,7 @@
public class SLF4JLoggerContextFactory implements LoggerContextFactory {
private static LoggerContext context = new SLF4JLoggerContext();
- public LoggerContext getContext(final String FQCN, final ClassLoader loader, final boolean currentContext) {
+ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
return context;
}
}
From 8a3ab27712853e35a19de4e23a82a2ba8f0251fc Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Sun, 20 Jan 2013 20:54:05 +0000
Subject: [PATCH 008/363] [maven-release-plugin] prepare release
log4j-2.0-beta4
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1435954 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index e6ead03..ad1ea57 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -20,7 +20,7 @@
org.apache.logging.log4j
log4j
- 2.0-beta4-SNAPSHOT
+ 2.0-beta4
../
org.apache.logging.log4j.adapters
From e1cf9659082b26aa8c6e16e4c6539a3a8a769b18 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Sun, 20 Jan 2013 20:54:16 +0000
Subject: [PATCH 009/363] [maven-release-plugin] prepare for next development
iteration
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1435956 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index ad1ea57..0578c40 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -20,7 +20,7 @@
org.apache.logging.log4j
log4j
- 2.0-beta4
+ 2.0-beta5-SNAPSHOT
../
org.apache.logging.log4j.adapters
From f9726fbdef44808a3baff9e083eef29d4acbbf18 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Tue, 22 Jan 2013 07:21:57 +0000
Subject: [PATCH 010/363] revert release version
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1436775 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index 0578c40..e6ead03 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -20,7 +20,7 @@
org.apache.logging.log4j
log4j
- 2.0-beta5-SNAPSHOT
+ 2.0-beta4-SNAPSHOT
../
org.apache.logging.log4j.adapters
From 91ad7d9fbc87e2d935d05a11f4e74191622ee385 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Mon, 28 Jan 2013 07:43:38 +0000
Subject: [PATCH 011/363] [maven-release-plugin] prepare release
log4j-2.0-beta4
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1439284 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index e6ead03..ad1ea57 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -20,7 +20,7 @@
org.apache.logging.log4j
log4j
- 2.0-beta4-SNAPSHOT
+ 2.0-beta4
../
org.apache.logging.log4j.adapters
From 5a33bee8b64df0f38a2711bc8559f1601068c768 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Mon, 28 Jan 2013 07:43:58 +0000
Subject: [PATCH 012/363] [maven-release-plugin] prepare for next development
iteration
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1439286 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index ad1ea57..0578c40 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -20,7 +20,7 @@
org.apache.logging.log4j
log4j
- 2.0-beta4
+ 2.0-beta5-SNAPSHOT
../
org.apache.logging.log4j.adapters
From 8dc0c80058ecbf871c20f122ba5112305cee6faf Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Sun, 3 Mar 2013 21:42:59 +0000
Subject: [PATCH 013/363] LOG4J2-161 - Modify ClassLoaderContextSelector to use
the first ClassLoader in the child parent hierarchy that has a Context with a
configuration to allow JSPs to use the WebApp's context and configuration.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1452133 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/logging/slf4j/SLF4JLoggerContextFactory.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
index 893610d..ddf6ef9 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLoggerContextFactory.java
@@ -19,6 +19,8 @@
import org.apache.logging.log4j.spi.LoggerContext;
import org.apache.logging.log4j.spi.LoggerContextFactory;
+import java.net.URI;
+
/**
*
*/
@@ -28,4 +30,9 @@ public class SLF4JLoggerContextFactory implements LoggerContextFactory {
public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext) {
return context;
}
+
+ public LoggerContext getContext(final String fqcn, final ClassLoader loader, final boolean currentContext,
+ URI configLocation) {
+ return context;
+ }
}
From 6c45bd4e2be965e9cf67a3f2e7561c31428ce3a2 Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
Date: Thu, 11 Apr 2013 14:28:39 +0000
Subject: [PATCH 014/363] [LOG4J2-206] Use the same Maven group ID for all
artifacts: org.apache.logging.log4j. The group ID
org.apache.logging.log4j.adapters is no longer used.
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1466901 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index 0578c40..8a8a0fa 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -23,7 +23,7 @@
2.0-beta5-SNAPSHOT
../
- org.apache.logging.log4j.adapters
+ org.apache.logging.log4j
log4j-to-slf4j
jar
Apache Log4j to SLF4J Adapter
From 246060a8c54d29979c14e03bb88242875b439396 Mon Sep 17 00:00:00 2001
From: Ralph Goers
Date: Sat, 20 Apr 2013 14:55:41 +0000
Subject: [PATCH 015/363] LOG4J2-199 - Fix Site Navigation
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1470168 13f79535-47bb-0310-9956-ffa450edef68
---
log4j-to-slf4j/src/site/site.xml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/log4j-to-slf4j/src/site/site.xml b/log4j-to-slf4j/src/site/site.xml
index 09a9352..62632f3 100644
--- a/log4j-to-slf4j/src/site/site.xml
+++ b/log4j-to-slf4j/src/site/site.xml
@@ -22,6 +22,28 @@
+
+
+
+
+
+
+