This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch main-remove-jcl-and-appserver in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 8b519093a17d45baf4b67e2a80629750c27e335a Author: Volkan Yazıcı <[email protected]> AuthorDate: Mon Jan 29 20:31:35 2024 +0100 Remove `log4j-jcl` and `log4j-appserver` modules --- log4j-appserver/pom.xml | 73 ------- .../log4j/appserver/jetty/Log4j2Logger.java | 217 --------------------- .../log4j/appserver/jetty/package-info.java | 27 --- .../log4j/appserver/tomcat/TomcatLogger.java | 190 ------------------ .../log4j/appserver/tomcat/package-info.java | 25 --- log4j-jcl/pom.xml | 71 ------- .../org/apache/logging/log4j/jcl/Log4jLog.java | 125 ------------ .../org/apache/logging/log4j/jcl/LogAdapter.java | 45 ----- .../apache/logging/log4j/jcl/LogFactoryImpl.java | 86 -------- .../org/apache/logging/log4j/jcl/package-info.java | 25 --- .../services/org.apache.commons.logging.LogFactory | 1 - .../logging/log4j/jcl/CallerInformationTest.java | 58 ------ .../org/apache/logging/log4j/jcl/LoggerTest.java | 58 ------ .../src/test/resources/CallerInformationTest.xml | 42 ---- log4j-jcl/src/test/resources/LoggerTest.xml | 55 ------ pom.xml | 2 - src/changelog/.3.x.x/remove_appserver.xml | 7 + src/changelog/.3.x.x/remove_jcl.xml | 7 + src/site/_release-notes/_3.x.x.adoc | 1 + src/site/asciidoc/faq.adoc | 3 - src/site/asciidoc/runtime-dependencies.adoc | 14 -- src/site/markdown/log4j-appserver.md.vm | 59 ------ src/site/markdown/log4j-flume-ng.md.vm | 10 - src/site/markdown/log4j-jcl.md | 33 ---- src/site/markdown/maven-artifacts.md.vm | 7 - src/site/site.xml | 2 - 26 files changed, 15 insertions(+), 1228 deletions(-) diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml deleted file mode 100644 index df0ce0067d..0000000000 --- a/log4j-appserver/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j</artifactId> - <version>${revision}</version> - <relativePath>../log4j-parent</relativePath> - </parent> - - <artifactId>log4j-appserver</artifactId> - <packaging>jar</packaging> - <name>Apache Log4j App Server Support</name> - <description>Provide Log4j as the logging implementation for application servers</description> - - <properties> - - <!-- - ~ OSGi and JPMS options - --> - <bnd-extra-package-options> - <!-- - ~ The Tomcat Log interface hasn't changed in a long time. Since 8.x ServiceLoader is used. - --> - org.apache.juli.logging;version="[8.0,12)";resolution:=optional, - <!-- - ~ Jetty's AbstractLogger is available since version 7.6. - ~ Jetty 10.x uses SLF4J. - --> - org.eclipse.jetty.util.log;version="[7.6,10)";resolution:=optional - </bnd-extra-package-options> - <bnd-extra-module-options> - <!-- Non-transitive --> - org.apache.tomcat.juli;transitive=false, - org.eclipse.jetty.util;transitive=false - </bnd-extra-module-options> - </properties> - - <dependencies> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-util</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-juli</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - </dependency> - </dependencies> -</project> diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java deleted file mode 100644 index 953b11f023..0000000000 --- a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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.log4j.appserver.jetty; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.spi.ExtendedLogger; -import org.apache.logging.log4j.spi.LoggerContext; -import org.eclipse.jetty.util.log.AbstractLogger; -import org.eclipse.jetty.util.log.Logger; - -/** - * Provides a native Apache Log4j 2 logger for Eclipse Jetty logging. - * - * <p> - * To direct Jetty to use this class, set the system property {{org.eclipse.jetty.util.log.class}} to this class name. - * </p> - * - * <p> - * From the command line with: - * </p> - * <pre>-Dorg.eclipse.jetty.util.log.class = org.apache.logging.log4j.appserver.jetty.Log4j2Logger</pre> - * - * <p> - * Programmatically with: - * </p> - * <pre>System.setProperty("org.eclipse.jetty.util.log.class", "org.apache.logging.log4j.appserver.jetty.Log4j2Logger");</pre> - * - * @since Apache Log4j 2.10.0 - */ -public class Log4j2Logger extends AbstractLogger { - - private static final String PARENT_FQCN = AbstractLogger.class.getName(); - /** - * Internal LogManager. Applications call AbstractLogger's getLogger() method so that class must be used - * as the parent to locate the caller's ClassLoader. - */ - private static class PrivateManager extends LogManager { - - public static LoggerContext getContext() { - final ClassLoader cl = AbstractLogger.class.getClassLoader(); - return getContext(PARENT_FQCN, cl, false); - } - - public static ExtendedLogger getLogger(final String name) { - return getContext().getLogger(name); - } - } - - static final String FQCN = Log4j2Logger.class.getName(); - private final ExtendedLogger logger; - - private final String name; - - public Log4j2Logger() { - this(""); - } - - public Log4j2Logger(final String name) { - this.name = name; - this.logger = PrivateManager.getLogger(name); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String, java.lang.Object[]) - */ - @Override - public void debug(final String msg, final Object... args) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, msg, args); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String, java.lang.Throwable) - */ - @Override - public void debug(final String msg, final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, msg, thrown); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.Throwable) - */ - @Override - public void debug(final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, (Object) null, thrown); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#getName() - */ - @Override - public String getName() { - return name; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.Throwable) - */ - @Override - public void ignore(final Throwable ignored) { - // Really do nothing - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String, java.lang.Object[]) - */ - @Override - public void info(final String msg, final Object... args) { - logger.logIfEnabled(FQCN, Level.INFO, null, msg, args); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String, java.lang.Throwable) - */ - @Override - public void info(final String msg, final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.INFO, null, msg, thrown); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#info(java.lang.Throwable) - */ - @Override - public void info(final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.INFO, null, (Object) null, thrown); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled() - */ - @Override - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.AbstractLogger#newLogger(java.lang.String) - */ - @Override - protected Logger newLogger(final String fullname) { - return new Log4j2Logger(fullname); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(boolean) - */ - @Override - public void setDebugEnabled(final boolean enabled) { - warn("setDebugEnabled not implemented"); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String, java.lang.Object[]) - */ - @Override - public void warn(final String msg, final Object... args) { - logger.logIfEnabled(FQCN, Level.WARN, null, msg, args); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String, java.lang.Throwable) - */ - @Override - public void warn(final String msg, final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.WARN, null, msg, thrown); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.Throwable) - */ - @Override - public void warn(final Throwable thrown) { - logger.logIfEnabled(FQCN, Level.WARN, null, (Object) null, thrown); - } -} diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/package-info.java b/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/package-info.java deleted file mode 100644 index 41b7bce811..0000000000 --- a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/jetty/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ -/** - * Log4j integration with Eclipse Jetty. - */ -@Open -@Export -@Version("2.20.1") -package org.apache.logging.log4j.appserver.jetty; - -import aQute.bnd.annotation.jpms.Open; -import org.osgi.annotation.bundle.Export; -import org.osgi.annotation.versioning.Version; diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/TomcatLogger.java b/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/TomcatLogger.java deleted file mode 100644 index 2c546a22c4..0000000000 --- a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/TomcatLogger.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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.log4j.appserver.tomcat; - -import aQute.bnd.annotation.Resolution; -import aQute.bnd.annotation.spi.ServiceProvider; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import org.apache.juli.logging.Log; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.spi.ExtendedLogger; -import org.apache.logging.log4j.spi.LoggerContext; - -/** - * Implements the Log interface from Tomcat 8.5 and greater. - * - * In order to use this class to cause Tomcat to use Log4j for logging, the jar containing this class as well as the - * log4j-api and log4j-core jars must be added to Tomcat's boot classpath. This is most easily accomplished by - * placing these jars in a directory and then adding the contents of that directory to the CLASSPATH - * environment variable in setenv.sh in Tomcat's bin directory. - * - * The Log4j configuration file must also be present on the classpath. This implementation will use the - * first file it finds with one of the following file names: log4j2-tomcat.xml, log4j2-tomcat.json, - * log4j2-tomcat.yaml, log4j2-tomcat.yml, log4j2-tomcat.properties. Again, this can be accomplished by adding - * this file to a directory and then adding that directory to the CLASSPATH environment variable in setenv.sh. - * - * @since 2.10.0 - */ -@ServiceProvider(value = Log.class, resolution = Resolution.OPTIONAL) -public class TomcatLogger implements Log { - - private static final long serialVersionUID = 1L; - private static final String FQCN = TomcatLogger.class.getName(); - private static final String[] FILE_NAMES = { - "log4j2-tomcat.xml", "log4j2-tomcat.json", "log4j2-tomcat.yaml", "log4j2-tomcat.yml", "log4j2-tomcat.properties" - }; - - private final ExtendedLogger logger; - - /** - * This constructor is used by ServiceLoader to load an instance of the class. - */ - public TomcatLogger() { - logger = null; - } - - /** - * This constructor is used by LogFactory to create a new Logger. - * @param name The name of the Logger. - */ - public TomcatLogger(final String name) { - this.logger = PrivateManager.getLogger(name); - } - - @Override - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - @Override - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - - @Override - public boolean isFatalEnabled() { - return logger.isFatalEnabled(); - } - - @Override - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - @Override - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - @Override - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - @Override - public void trace(final Object o) { - logger.logIfEnabled(FQCN, Level.TRACE, null, o, null); - } - - @Override - public void trace(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.TRACE, null, o, throwable); - } - - @Override - public void debug(final Object o) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, o, null); - } - - @Override - public void debug(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, o, throwable); - } - - @Override - public void info(final Object o) { - logger.logIfEnabled(FQCN, Level.INFO, null, o, null); - } - - @Override - public void info(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.INFO, null, o, throwable); - } - - @Override - public void warn(final Object o) { - logger.logIfEnabled(FQCN, Level.WARN, null, o, null); - } - - @Override - public void warn(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.WARN, null, o, throwable); - } - - @Override - public void error(final Object o) { - logger.logIfEnabled(FQCN, Level.ERROR, null, o, null); - } - - @Override - public void error(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.ERROR, null, o, throwable); - } - - @Override - public void fatal(final Object o) { - logger.logIfEnabled(FQCN, Level.FATAL, null, o, null); - } - - @Override - public void fatal(final Object o, final Throwable throwable) { - logger.logIfEnabled(FQCN, Level.FATAL, null, o, throwable); - } - - /** - * Internal LogManager. - */ - private static class PrivateManager extends LogManager { - - public static LoggerContext getContext() { - final ClassLoader cl = TomcatLogger.class.getClassLoader(); - URI uri = null; - for (final String fileName : FILE_NAMES) { - try { - final URL url = cl.getResource(fileName); - if (url != null) { - uri = url.toURI(); - break; - } - } catch (final URISyntaxException ex) { - // Ignore the exception. - } - } - if (uri == null) { - return getContext(FQCN, cl, false); - } - return getContext(FQCN, cl, false, uri, "Tomcat"); - } - - public static ExtendedLogger getLogger(final String name) { - return getContext().getLogger(name); - } - } -} diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/package-info.java b/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/package-info.java deleted file mode 100644 index d8d724f4eb..0000000000 --- a/log4j-appserver/src/main/java/org/apache/logging/log4j/appserver/tomcat/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ -/** - * Log4j integration with Apache Tomcat 8.5 or greater. - */ -@Export -@Version("2.20.1") -package org.apache.logging.log4j.appserver.tomcat; - -import org.osgi.annotation.bundle.Export; -import org.osgi.annotation.versioning.Version; diff --git a/log4j-jcl/pom.xml b/log4j-jcl/pom.xml deleted file mode 100644 index acc7c8d8a3..0000000000 --- a/log4j-jcl/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j</artifactId> - <version>${revision}</version> - <relativePath>../log4j-parent</relativePath> - </parent> - <artifactId>log4j-jcl</artifactId> - <packaging>jar</packaging> - <name>Apache Log4j Commons Logging Bridge</name> - <description>The Apache Log4j Commons Logging Adapter</description> - <properties> - <bnd-extra-module-options> - <!-- Filebase module names: MUST be static --> - commons.logging;substitute="commons-logging";transitive=false;static=true - </bnd-extra-module-options> - </properties> - <dependencies> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java b/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java deleted file mode 100644 index 2f235ac8e0..0000000000 --- a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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.log4j.jcl; - -import org.apache.commons.logging.Log; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.spi.ExtendedLogger; - -/** - * - */ -public class Log4jLog implements Log { - - private static final String FQCN = Log4jLog.class.getName(); - - private final ExtendedLogger logger; - - public Log4jLog(final ExtendedLogger logger) { - this.logger = logger; - } - - @Override - public boolean isDebugEnabled() { - return logger.isEnabled(Level.DEBUG, null, null); - } - - @Override - public boolean isErrorEnabled() { - return logger.isEnabled(Level.ERROR, null, null); - } - - @Override - public boolean isFatalEnabled() { - return logger.isEnabled(Level.FATAL, null, null); - } - - @Override - public boolean isInfoEnabled() { - return logger.isEnabled(Level.INFO, null, null); - } - - @Override - public boolean isTraceEnabled() { - return logger.isEnabled(Level.TRACE, null, null); - } - - @Override - public boolean isWarnEnabled() { - return logger.isEnabled(Level.WARN, null, null); - } - - @Override - public void trace(final Object message) { - logger.logIfEnabled(FQCN, Level.TRACE, null, message, null); - } - - @Override - public void trace(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.TRACE, null, message, t); - } - - @Override - public void debug(final Object message) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, message, null); - } - - @Override - public void debug(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.DEBUG, null, message, t); - } - - @Override - public void info(final Object message) { - logger.logIfEnabled(FQCN, Level.INFO, null, message, null); - } - - @Override - public void info(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.INFO, null, message, t); - } - - @Override - public void warn(final Object message) { - logger.logIfEnabled(FQCN, Level.WARN, null, message, null); - } - - @Override - public void warn(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.WARN, null, message, t); - } - - @Override - public void error(final Object message) { - logger.logIfEnabled(FQCN, Level.ERROR, null, message, null); - } - - @Override - public void error(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.ERROR, null, message, t); - } - - @Override - public void fatal(final Object message) { - logger.logIfEnabled(FQCN, Level.FATAL, null, message, null); - } - - @Override - public void fatal(final Object message, final Throwable t) { - logger.logIfEnabled(FQCN, Level.FATAL, null, message, t); - } -} diff --git a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogAdapter.java b/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogAdapter.java deleted file mode 100644 index 108c4d070b..0000000000 --- a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.log4j.jcl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.spi.AbstractLoggerAdapter; -import org.apache.logging.log4j.spi.LoggerContext; -import org.apache.logging.log4j.util.StackLocatorUtil; - -/** - * Commons Logging adapter registry. - * - * @since 2.1 - */ -public class LogAdapter extends AbstractLoggerAdapter<Log> { - - @Override - protected Log newLogger(final String name, final LoggerContext context) { - return new Log4jLog(context.getLogger(name)); - } - - @Override - protected LoggerContext getContext() { - return getContext( - LogManager.getFactory().isClassLoaderDependent() - ? StackLocatorUtil.getCallerClass(LogFactory.class) - : null); - } -} diff --git a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java b/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java deleted file mode 100644 index 8d73091ba4..0000000000 --- a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/LogFactoryImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.log4j.jcl; - -import aQute.bnd.annotation.Resolution; -import aQute.bnd.annotation.spi.ServiceProvider; -import java.io.IOException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogConfigurationException; -import org.apache.commons.logging.LogFactory; -import org.apache.logging.log4j.spi.LoggerAdapter; -import org.apache.logging.log4j.util.Strings; - -/** - * Log4j binding for Commons Logging. - * {@inheritDoc} - */ -@ServiceProvider(value = LogFactory.class, resolution = Resolution.OPTIONAL) -public class LogFactoryImpl extends LogFactory { - - private final LoggerAdapter<Log> adapter = new LogAdapter(); - - private final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<>(); - - @Override - public Log getInstance(final String name) throws LogConfigurationException { - return adapter.getLogger(name); - } - - @Override - public Object getAttribute(final String name) { - return attributes.get(name); - } - - @Override - public String[] getAttributeNames() { - return attributes.keySet().toArray(Strings.EMPTY_ARRAY); - } - - @Override - public Log getInstance(@SuppressWarnings("rawtypes") final Class clazz) throws LogConfigurationException { - return getInstance(clazz.getName()); - } - - /** - * This method is supposed to clear all loggers. In this implementation it will clear all the logger - * wrappers but the loggers managed by the underlying logger context will not be. - */ - @Override - public void release() { - try { - adapter.close(); - } catch (final IOException ignored) { - } - } - - @Override - public void removeAttribute(final String name) { - attributes.remove(name); - } - - @Override - public void setAttribute(final String name, final Object value) { - if (value != null) { - attributes.put(name, value); - } else { - removeAttribute(name); - } - } -} diff --git a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/package-info.java b/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/package-info.java deleted file mode 100644 index 3f8f8ea632..0000000000 --- a/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ -/** - * Log4j 2 adapter for Commons Logging. - */ -@Export -@Version("2.20.1") -package org.apache.logging.log4j.jcl; - -import org.osgi.annotation.bundle.Export; -import org.osgi.annotation.versioning.Version; diff --git a/log4j-jcl/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory b/log4j-jcl/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory deleted file mode 100644 index 7e9c8a6659..0000000000 --- a/log4j-jcl/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory +++ /dev/null @@ -1 +0,0 @@ -org.apache.logging.log4j.jcl.LogFactoryImpl diff --git a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java deleted file mode 100644 index ba6987b137..0000000000 --- a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/CallerInformationTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.log4j.jcl; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.apache.logging.log4j.core.test.junit.LoggerContextSource; -import org.junit.jupiter.api.Test; - -public class CallerInformationTest { - - @Test - @LoggerContextSource("CallerInformationTest.xml") - public void testClassLogger(final LoggerContext ctx) { - final ListAppender app = ctx.getConfiguration().getAppender("Class"); - app.clear(); - final Log logger = LogFactory.getLog("ClassLogger"); - logger.info("Ignored message contents."); - logger.warn("Verifying the caller class is still correct."); - logger.error("Hopefully nobody breaks me!"); - final List<String> messages = app.getMessages(); - assertThat(messages).hasSize(3).allMatch(c -> getClass().getName().equals(c)); - } - - @Test - @LoggerContextSource("CallerInformationTest.xml") - public void testMethodLogger(final LoggerContext ctx) { - final ListAppender app = ctx.getConfiguration().getAppender("Method"); - app.clear(); - final Log logger = LogFactory.getLog("MethodLogger"); - logger.info("More messages."); - logger.warn("CATASTROPHE INCOMING!"); - logger.error("ZOMBIES!!!"); - logger.warn("brains~~~"); - logger.info("Itchy. Tasty."); - final List<String> messages = app.getMessages(); - assertThat(messages).hasSize(5).allMatch("testMethodLogger"::equals); - } -} diff --git a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java b/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java deleted file mode 100644 index e9c405342a..0000000000 --- a/log4j-jcl/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.log4j.jcl; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.apache.logging.log4j.core.test.junit.LoggerContextSource; -import org.apache.logging.log4j.util.Strings; -import org.junit.jupiter.api.Test; - -class LoggerTest { - - @Test - void testFactory() { - final LogFactory factory = LogFactory.getFactory(); - assertThat(factory).isInstanceOf(LogFactoryImpl.class); - } - - @Test - @LoggerContextSource("LoggerTest.xml") - void testLog(final LoggerContext context) { - final Log logger = LogFactory.getLog("LoggerTest"); - logger.debug("Test message"); - verify(context, "o.a.l.l.j.LoggerTest Test message MDC{}" + Strings.LINE_SEPARATOR); - logger.debug("Exception: ", new NullPointerException("Test")); - verify(context, "o.a.l.l.j.LoggerTest Exception: MDC{}" + Strings.LINE_SEPARATOR); - logger.info("Info Message"); - verify(context, "o.a.l.l.j.LoggerTest Info Message MDC{}" + Strings.LINE_SEPARATOR); - logger.info("Info Message {}"); - verify(context, "o.a.l.l.j.LoggerTest Info Message {} MDC{}" + Strings.LINE_SEPARATOR); - } - - private static void verify(final LoggerContext context, final String expected) { - final ListAppender listApp = context.getConfiguration().getAppender("List"); - final List<String> events = listApp.getMessages(); - assertThat(events).hasSize(1).containsExactly(expected); - listApp.clear(); - } -} diff --git a/log4j-jcl/src/test/resources/CallerInformationTest.xml b/log4j-jcl/src/test/resources/CallerInformationTest.xml deleted file mode 100644 index 997aaa7049..0000000000 --- a/log4j-jcl/src/test/resources/CallerInformationTest.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<Configuration name="CallerInformationTest" status="OFF"> - <Appenders> - <List name="Class"> - <PatternLayout pattern="%class"/> - </List> - <List name="Method"> - <PatternLayout pattern="%method"/> - </List> - <List name="Fqcn"> - <PatternLayout pattern="%fqcn"/> - </List> - </Appenders> - <Loggers> - <Logger name="ClassLogger" level="info"> - <AppenderRef ref="Class"/> - </Logger> - <Logger name="MethodLogger" level="info"> - <AppenderRef ref="Method"/> - </Logger> - <Logger name="FqcnLogger" level="info"> - <AppenderRef ref="Fqcn"/> - </Logger> - <Root level="off"/> - </Loggers> -</Configuration> diff --git a/log4j-jcl/src/test/resources/LoggerTest.xml b/log4j-jcl/src/test/resources/LoggerTest.xml deleted file mode 100644 index d439c2e5ef..0000000000 --- a/log4j-jcl/src/test/resources/LoggerTest.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<Configuration status="OFF" name="LoggerTest"> - <properties> - <property name="filename">target/test.log</property> - </properties> - <ThresholdFilter level="trace"/> - - <Appenders> - <List name="EventLogger"> - <PatternLayout pattern="%C{1.} %m%n"/> - </List> - <Console name="STDOUT"> - <PatternLayout pattern="%C{1.} %m MDC%X%n"/> - </Console> - <File name="File" fileName="${filename}"> - <PatternLayout> - <pattern>%d %p %C{1.} [%t] %m%n</pattern> - </PatternLayout> - </File> - <List name="List"> - <PatternLayout pattern="%C{1.} %m MDC%X%n%ex{0}"/> - </List> - </Appenders> - - <Loggers> - <Logger name="EventLogger" level="info" additivity="false"> - <AppenderRef ref="EventLogger"/> - </Logger>> - - <Logger name="org.apache.logging.log4j.test2" level="debug" additivity="false"> - <AppenderRef ref="File"/> - </Logger>> - - <Root level="trace"> - <AppenderRef ref="List"/> - </Root> - </Loggers> - -</Configuration> diff --git a/pom.xml b/pom.xml index f4fd649db7..9a092e0125 100644 --- a/pom.xml +++ b/pom.xml @@ -235,7 +235,6 @@ <module>log4j-1.2-api</module> <module>log4j-api</module> <module>log4j-api-test</module> - <module>log4j-appserver</module> <module>log4j-async-logger</module> <module>log4j-config-jackson</module> <module>log4j-config-properties</module> @@ -247,7 +246,6 @@ <module>log4j-flume-ng</module> <module>log4j-gc-test</module> <module>log4j-iostreams</module> - <module>log4j-jcl</module> <module>log4j-jctools</module> <module>log4j-jdbc</module> <module>log4j-jdbc-dbcp2</module> diff --git a/src/changelog/.3.x.x/remove_appserver.xml b/src/changelog/.3.x.x/remove_appserver.xml new file mode 100644 index 0000000000..974bba3d01 --- /dev/null +++ b/src/changelog/.3.x.x/remove_appserver.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://logging.apache.org/log4j/changelog" + xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.3.xsd" + type="removed"> + <description format="asciidoc">Remove `log4j-appserver` module</description> +</entry> diff --git a/src/changelog/.3.x.x/remove_jcl.xml b/src/changelog/.3.x.x/remove_jcl.xml new file mode 100644 index 0000000000..b588b66a8f --- /dev/null +++ b/src/changelog/.3.x.x/remove_jcl.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://logging.apache.org/log4j/changelog" + xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.3.xsd" + type="removed"> + <description format="asciidoc">Remove `log4j-jcl` module</description> +</entry> diff --git a/src/site/_release-notes/_3.x.x.adoc b/src/site/_release-notes/_3.x.x.adoc index 7ff71077bd..55041d0ca5 100644 --- a/src/site/_release-notes/_3.x.x.adoc +++ b/src/site/_release-notes/_3.x.x.adoc @@ -31,6 +31,7 @@ This release contains... === Changed * Change the order of evaluation of `FormattedMessage` formatters. Messages are evaluated using `java.util.Format` only if they don't comply to the `java.text.MessageFormat` or `ParameterizedMessage` format. (https://github.com/apache/logging-log4j2/issues/1223[1223]) +* Split off async logger support into a new `log4j-async-logger` module. * Split off YAML configuration into a new `log4j-config-yaml` module. * Update `com.google.code.java-allocation-instrumenter:java-allocation-instrumenter` to version `3.3.4` (https://github.com/apache/logging-log4j2/pull/2102[2102]) * Update `com.google.guava:guava` to version `33.0.0-jre` (https://github.com/apache/logging-log4j2/pull/2108[2108]) diff --git a/src/site/asciidoc/faq.adoc b/src/site/asciidoc/faq.adoc index 37ea84cf75..b98a3b3718 100644 --- a/src/site/asciidoc/faq.adoc +++ b/src/site/asciidoc/faq.adoc @@ -78,9 +78,6 @@ be safely excluded (given in the format `groupId:artifactId`). |ch.qos.logback:logback-core |org.apache.logging.log4j:log4j-to-slf4j -|log4j-jcl -3+|org.slf4j:jcl-over-slf4j - |log4j-jul 3+|org.slf4j:jul-to-slf4j diff --git a/src/site/asciidoc/runtime-dependencies.adoc b/src/site/asciidoc/runtime-dependencies.adoc index 8ae1e384e0..48abf2c56f 100644 --- a/src/site/asciidoc/runtime-dependencies.adoc +++ b/src/site/asciidoc/runtime-dependencies.adoc @@ -224,10 +224,6 @@ The module info definition may be modified in the future to export these only to |org.apache.log4j |Automatic Module - It is unlikely any application using JPMS would use Log4j 1.x. -|log4j-appserver -|org.apache.logging.log4j.appserver -|Automatic Module - |log4j-docker |org.apache.logging.log4j.docker |Automatic Module @@ -240,10 +236,6 @@ The module info definition may be modified in the future to export these only to |org.apache.logging.log4j.iostreams |Automatic Module -|log4j-jcl -|org.apache.logging.log4j.jcl -|Automatic Module - |log4j-jpl |org.apache.logging.log4j.jpl | @@ -520,12 +512,6 @@ for the exact list of JAR files needed. |The Log4j link:log4j-iostreams/index.html[IO Streams] module has no external dependencies. This only requires the Log4j API. -|log4j-jcl[[log4j-jcl]] -|The link:log4j-jcl/index.html[Commons Logging Bridge] requires -http://commons.apache.org/proper/commons-logging/[Commons Logging]. See -the link:log4j-jcl/dependencies.html#Dependency_Tree[Dependency Tree] -for the exact list of JAR files needed. - |log4j-jmx-gui[[log4j-jmx-gui]] |The Log4j link:log4j-jmx-gui/index.html[JMX GUI] requires the JConsole jar when run as a JConsole plugin. Otherwise it has no external diff --git a/src/site/markdown/log4j-appserver.md.vm b/src/site/markdown/log4j-appserver.md.vm deleted file mode 100644 index 7128bc22ed..0000000000 --- a/src/site/markdown/log4j-appserver.md.vm +++ /dev/null @@ -1,59 +0,0 @@ -<!-- vim: set syn=markdown : --> -<!-- - 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. ---> -<!-- TODO: turn this into a velocity template for all the version numbers --> - -#set($h1 = '#') -#set($h2 = '##') -#set($h3 = '###') -#set($h4 = '####') - -$h1 Application Server Integration - -The Application Server module provides support for integrating Log4j into various Java Application Servers. - -$h2 Apache Tomcat - -Log4j may be used as the logging framework for Apache Tomcat. This support is implemented automatically by including -the log4j-api, log4j-core, and log4j-appserver jars in the boot classpath. A file named log4j2-tomcat.xml, -log4j2-tomcat.json, log4j2-tomcat.yaml, log4j2-tomcat.yml, or log4j2-tomcat.properties must also be placed -in the boot classpath. This is most easily done by: - -1. Creating a set of directories in catalina home named log4j2/lib and log4j2/conf. -2. Placing log4j2-api-${Log4jReleaseVersion}.jar, log4j2-core-${Log4jReleaseVersion}.jar, and -log4j2-appserver-${Log4jReleaseVersion}.jar in the log4j2/lib directory. -3. Creating a file named log4j2-tomcat.xml, log4j2-tomcat.json, log4j2-tomcat.yaml, log4j2-tomcat.yml, or -log4j2-tomcat.properties in the log4j2/conf directory. -4. Create or modify setenv.sh in the tomcat bin directory to include -```CLASSPATH=$CATALINA_HOME/log4j2/lib/*:$CATALINA_HOME/log4j2/conf``` - -$h3 Requirements - -Requires Tomcat 8.5 or later. - -$h2 Eclipse Jetty - -Log4j may be used as the logging framework for Eclipse Jetty. - -To direct Jetty to use this class, set the system property `org.eclipse.jetty.util.log.class` to `org.apache.logging.log4j.appserver.jetty.Log4j2Logger`. - -From the command line with: -```-Dorg.eclipse.jetty.util.log.class = org.apache.logging.log4j.appserver.jetty.Log4j2Logger``` - -Programmatically with: -```System.setProperty("org.eclipse.jetty.util.log.class", "org.apache.logging.log4j.appserver.jetty.Log4j2Logger");``` - \ No newline at end of file diff --git a/src/site/markdown/log4j-flume-ng.md.vm b/src/site/markdown/log4j-flume-ng.md.vm index 87a073a876..1a775789d7 100644 --- a/src/site/markdown/log4j-flume-ng.md.vm +++ b/src/site/markdown/log4j-flume-ng.md.vm @@ -118,11 +118,6 @@ Flume Embedded Appender into an application. <artifactId>log4j-slf4j-impl</artifactId> <version>${dollar}{log4j.version}</version> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - <version>${dollar}{log4j.version}</version> - </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> @@ -177,11 +172,6 @@ Flume Embedded Appender into an application. <groupId>org.slf4j</groupId> <artifactId>slf4j-ext</artifactId> </dependency> - <!-- Commson Logging to Log4j 2 binding --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - </dependency> <!-- Avro transport protocol - required for Flume --> <dependency> <groupId>org.apache.avro</groupId> diff --git a/src/site/markdown/log4j-jcl.md b/src/site/markdown/log4j-jcl.md deleted file mode 100644 index fdb15bfbbe..0000000000 --- a/src/site/markdown/log4j-jcl.md +++ /dev/null @@ -1,33 +0,0 @@ -<!-- vim: set syn=markdown : --> -<!-- - 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. ---> - -# Commons Logging Bridge - -The Commons Logging Bridge allows applications coded to the Commons Logging API to use -Log4j 2 as the implementation. - -## Requirements - -The Commons Logging Bridge is dependent on the Log4j 2 API and Commons Logging. -For more information, see [Runtime Dependencies](runtime-dependencies.html). - -## Usage - -Using the Commons Logging Bridge is straightforward. Simply add the bridge jar along with -the other Log4j 2 jars and the Commons Logging jar, and all logging done using the -Commons Logging API will be routed to Log4j. diff --git a/src/site/markdown/maven-artifacts.md.vm b/src/site/markdown/maven-artifacts.md.vm index 4270641b78..472d2b1a56 100644 --- a/src/site/markdown/maven-artifacts.md.vm +++ b/src/site/markdown/maven-artifacts.md.vm @@ -183,13 +183,6 @@ then remove any log4j 1.x dependencies and add the following. #dependencies(['log4j-1.2-api']) -$h3 Apache Commons Logging Bridge - -If existing components use Apache Commons Logging 1.x and you want to have this logging routed to Log4j 2, -then add the following but do not remove any Commons Logging 1.x dependencies. - -#dependencies(['log4j-jcl']) - $h3 SLF4J Bridge If existing components use SLF4J and you want to have this logging routed to Log4j 2, then add the diff --git a/src/site/site.xml b/src/site/site.xml index 032120a8c2..87aa7647f4 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -280,7 +280,6 @@ <menu name="Internal Components" inherit="top" img="img/glyphicons/layers.png"> <item name="API" href="log4j-api.html"/> <item name="Implementation" href="log4j-core.html"/> - <item name="Commons Logging Bridge" href="log4j-jcl.html"/> <item name="Log4j 1.2 API" href="log4j-1.2-api.html"/> <item name="SLF4J Binding" href="log4j-slf4j-impl.html"/> <item name="JUL Adapter" href="log4j-jul.html"/> @@ -288,7 +287,6 @@ <item name="Log4j 2 to SLF4J Adapter" href="log4j-to-slf4j.html"/> <item name="JDBC Appender" href="log4j-jdbc-dbcp2.html"/> <item name="Apache Flume Appender" href="log4j-flume-ng.html"/> - <item name="Application Server Integration" href="log4j-appserver.html"/> <item name="MongoDB 4 appender" href="log4j-mongodb4.html"/> <item name="IO Streams" href="log4j-iostreams.html"/> <item name="Docker Support" href="log4j-docker.html"/>
