Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BND configuration for log4j-core #1821

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions log4j-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,54 @@
~ OSGi and JPMS options
-->
<bnd-multi-release>true</bnd-multi-release>
<bnd-extra-package-options>
<!-- External optional dependencies -->
com.conversantmedia.util.concurrent;resolution:=optional;
com.fasterxml.jackson.*;resolution:=optional,
com.lmax.disruptor.*;resolution:=optional,
javax.activation;resolution:=optional,
javax.jms;version="[1.1,3)";resolution:=optional,
javax.mail.*;version="[1.6,2)";resolution:=optional,
org.apache.commons.compress.*;resolution:=optional,
org.apache.commons.csv;resolution:=optional,
org.apache.kafka.*;resolution:=optional,
org.codehaus.stax2;resolution:=optional,
org.fusesource.jansi;resolution:=optional,
org.jctools.*;resolution:=optional,
org.zeromq;resolution:=optional,
<!-- `java.compiler` is optional -->
javax.annotation.processing;resolution:=optional,
javax.lang.model.*;resolution:=optional,
javax.tools;resolution:=optional,
<!-- `java.sql`, which depends on `java.logging` is optional -->
javax.sql;resolution:=optional,
java.util.logging;resolution:=optional,
<!-- `java.naming` is optional -->
javax.naming;resolution:=optional
</bnd-extra-package-options>
<bnd-extra-module-options>
<!-- OSGI is optional in JPMS -->
org.osgi.core;static=true,
<!-- BND seems to always add `java.logging` (dependency of `java.sql`) -->
java.logging;static=true,
java.sql;static=true,
<!-- Remove `transitive` from optional dependencies -->
com.fasterxml.jackson.annotation;transitive=false,
com.lmax.disruptor;transitive=false,
disruptor;transitive=false,
jackson-core;transitive=false,
jackson-databind;transitive=false,
jackson-dataformat-xml;transitive=false,
jackson-dataformat-yaml;transitive=false,
java.compiler;transitive=false,
java.naming;transitive=false,
javax.jms-api;transitive=false,
javax.mail-api;transitive=false,
jeromq;transitive=false,
kafka-clients;transitive=false,
org.apache.commons.csv;transitive=false,
org.fusesource.jansi;transitive=false
</bnd-extra-module-options>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -209,6 +257,9 @@
</goals>
<phase>process-classes</phase>
<configuration>
<annotationProcessors>
<processor>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</processor>
</annotationProcessors>
<compilerArgs combine.self="override" />
<proc>only</proc>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
* The JDBC Appender supports writing log events to a relational database using standard JDBC connections. You will need
* a JDBC driver on your classpath for the database you wish to log to.
*/
@Export
package org.apache.logging.log4j.core.appender.db.jdbc;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
* The classes in this package and sub packages provide appenders for various types of databases and methods for
* accessing databases.
*/
@Export
package org.apache.logging.log4j.core.appender.db;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.4
*/
@Export
package org.apache.logging.log4j.core.appender.mom.jeromq;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.4
*/
@Export
package org.apache.logging.log4j.core.appender.mom.kafka;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.1
*/
@Export
package org.apache.logging.log4j.core.appender.mom;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
* {@link org.apache.logging.log4j.core.appender.nosql.NoSqlConnection NoSqlConnection}, and
* {@link org.apache.logging.log4j.core.appender.nosql.NoSqlProvider NoSqlProvider}.
*/
@Export
package org.apache.logging.log4j.core.appender.nosql;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Log4j 2 Appenders.
*/
@Export
package org.apache.logging.log4j.core.appender;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Apache Flume Appender. Requires the user specifically include Flume and its dependencies.
*/
@Export
package org.apache.logging.log4j.core.appender.rewrite;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Support classes for the Rolling File Appender.
*/
@Export
package org.apache.logging.log4j.core.appender.rolling.action;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Rolling File Appender and support classes.
*/
@Export
package org.apache.logging.log4j.core.appender.rolling;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Apache Flume Appender. Requires the user specifically include Flume and its dependencies.
*/
@Export
package org.apache.logging.log4j.core.appender.routing;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Provides Asynchronous Logger classes and interfaces for low-latency logging.
*/
@Export
package org.apache.logging.log4j.core.async;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
@@ -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.
*/
@Export
package org.apache.logging.log4j.core.config.arbiters;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
*
* @since 2.4
*/
@Export
package org.apache.logging.log4j.core.config.builder.api;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
*
* @since 2.4
*/
@Export
package org.apache.logging.log4j.core.config.builder.impl;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
/**
* Support for composite configurations.
*/
@Export
package org.apache.logging.log4j.core.config.composite;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Classes and interfaces supporting configuration of Log4j 2 with JSON.
*/
@Export
package org.apache.logging.log4j.core.config.json;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Configuration of Log4j 2.
*/
@Export
package org.apache.logging.log4j.core.config;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
* TypeConverter plugins for converter strings into various types. These plugins are used for parsing plugin
* attributes in plugin factory methods.
*/
@Export
package org.apache.logging.log4j.core.config.plugins.convert;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
/**
* Annotations for Log4j 2 plugins.
*/
@Export
package org.apache.logging.log4j.core.config.plugins;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Messager;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
Expand All @@ -39,6 +40,8 @@
import javax.tools.FileObject;
import javax.tools.StandardLocation;

import aQute.bnd.annotation.Resolution;
import aQute.bnd.annotation.spi.ServiceProvider;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAliases;
import org.apache.logging.log4j.util.Strings;
Expand All @@ -48,6 +51,7 @@
/**
* Annotation processor for pre-scanning Log4j 2 plugins.
*/
@ServiceProvider(value = Processor.class, resolution = Resolution.OPTIONAL)
@SupportedAnnotationTypes("org.apache.logging.log4j.core.config.plugins.*")
public class PluginProcessor extends AbstractProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
* Java annotation processor for pre-scanning Log4j 2 plugins. This is provided as an alternative to using the
* executable {@link org.apache.logging.log4j.core.config.plugins.util.PluginManager} class in your build process.
*/
@Export
package org.apache.logging.log4j.core.config.plugins.processor;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
/**
* Utility and manager classes for Log4j 2 plugins.
*/
@Export
package org.apache.logging.log4j.core.config.plugins.util;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.1
*/
@Export
package org.apache.logging.log4j.core.config.plugins.validation.constraints;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.1
*/
@Export
package org.apache.logging.log4j.core.config.plugins.validation;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
*
* @since 2.1
*/
@Export
package org.apache.logging.log4j.core.config.plugins.validation.validators;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
* and the corresponding annotation must be annotated with
* {@link org.apache.logging.log4j.core.config.plugins.PluginVisitorStrategy}.
*/
@Export
package org.apache.logging.log4j.core.config.plugins.visitors;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Configuration using Properties files.
*/
@Export
package org.apache.logging.log4j.core.config.properties;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
/**
* Configuration classes for the {@link org.apache.logging.log4j.status.StatusLogger} API.
*/
@Export
package org.apache.logging.log4j.core.config.status;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Classes and interfaces supporting configuration of Log4j 2 with XML.
*/
@Export
package org.apache.logging.log4j.core.config.xml;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
/**
* Classes and interfaces supporting configuration of Log4j 2 with YAML.
*/
@Export
package org.apache.logging.log4j.core.config.yaml;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
@@ -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.
*/
@Export
package org.apache.logging.log4j.core.filter.mutable;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
* {@linkplain org.apache.logging.log4j.core.config.plugins.Plugin#elementType() element type}
* {@link org.apache.logging.log4j.core.Filter#ELEMENT_TYPE filter}.
*/
@Export
package org.apache.logging.log4j.core.filter;

import org.osgi.annotation.bundle.Export;
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
*/
package org.apache.logging.log4j.core.impl;

import aQute.bnd.annotation.Resolution;
import aQute.bnd.annotation.spi.ServiceProvider;
import org.apache.logging.log4j.spi.Provider;

/**
* Binding for the Log4j API.
*/
@ServiceProvider(value = Provider.class, resolution = Resolution.OPTIONAL)
public class Log4jProvider extends Provider {
public Log4jProvider() {
super(10, "2.6.0", Log4jContextFactory.class);
Expand Down