Previous patch did not completely integrate our logging markers,
this patch finishes the job by adding them to the baseline karaf-empty
distribution.
Furthermore add some documentation and move Markers into a separate
package, forming a proper JPMS module.
JIRA: ODLPARENT-231
Change-Id: I902d7b87c67fa84cc1f84bb06031952951f98a93
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
471914379dfe5abdc82654f2d37167135ca5c5bf)
<artifactId>bcprov-framework-ext</artifactId>
<scope>runtime</scope>
</dependency>
+
+ <!-- SLF4J logging markers -->
+ <dependency>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>logging-markers</artifactId>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
mvn\:org.apache.felix/org.apache.felix.metatype/1.2.2 = 8
mvn\:org.opendaylight.odlparent/bcprov-framework-ext/${project.version} = 14
mvn\:org.opendaylight.odlparent/bcpkix-framework-ext/${project.version} = 14
+mvn\:org.opendaylight.odlparent/logging-markers/${project.version} = 14
mvn\:org.apache.aries.blueprint/org.apache.aries.blueprint.core.compatibility/1.0.0 = 14
</echo>
<copy file="${project.build.directory}/assembly/etc/startup.properties"
<?xml version="1.0" encoding="UTF-8"?>
-<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">
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<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.opendaylight.odlparent</groupId>
<artifactId>logging-markers</artifactId>
<packaging>bundle</packaging>
<name>OpenDaylight :: Logging Markers</name>
+ <description>OpenDaylight-specific SLF4J Markers</description>
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>org.opendaylight.odlparent.logging.markers</Automatic-Module-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
+++ /dev/null
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.odlparent;
-
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-
-public final class Markers {
-
- private Markers() {
- }
-
- public static Marker confidential() {
- return Confidential.MARKER;
- }
-
- private static final class Confidential {
- private static String CONFIDENTIAL_TAG = "CONFIDENTIAL";
- static final Marker MARKER = MarkerFactory.getMarker(CONFIDENTIAL_TAG);
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.odlparent.logging.markers;
+
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+/**
+ * Common markers for SLF4J. See individual methods for available markers and their use.
+ */
+public final class Markers {
+ private Markers() {
+ // Hidden on purpose
+ }
+
+ /**
+ * Return the SLF4J marker for reporting messages which may contain sensitive information, such as credentials
+ * used with an external system. This marker should be used by code components when dumping protocol data, such
+ * as NETCONF messages, which may contain user passwords and similar. Logging provider should be configured to
+ * redirect messages marked with this marker to a separate location which enjoys a higher level of confidentiality
+ * and protection than other messages.
+ *
+ * @return The confidential marker.
+ */
+ public static Marker confidential() {
+ return Confidential.MARKER;
+ }
+
+ // https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom
+ private static final class Confidential {
+ static final Marker MARKER = MarkerFactory.getMarker("CONFIDENTIAL");
+ }
+}
<!-- javax.annotation -->
<excludedArtifactId>activation</excludedArtifactId>
<excludedArtifactId>jakarta.activation-api</excludedArtifactId>
+
+ <!-- Our slf4j logging markers -->
+ <excludedArtifactId>logging-markers</excludedArtifactId>
</excludedArtifactIds>
</configuration>
</plugin>