diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleLogRecordExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleLogRecordExporterProvider.java new file mode 100644 index 00000000000..e9911c8fd86 --- /dev/null +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleLogRecordExporterProvider.java @@ -0,0 +1,30 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.exporter.logging.internal; + +import io.opentelemetry.exporter.logging.SystemOutLogRecordExporter; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider; +import io.opentelemetry.sdk.logs.export.LogRecordExporter; + +/** + * {@link LogRecordExporter} SPI implementation for {@link SystemOutLogRecordExporter}. + * + *
This class is internal and is hence not for public use. Its APIs are unstable and can change + * at any time. + */ +public final class ConsoleLogRecordExporterProvider + implements ConfigurableLogRecordExporterProvider { + @Override + public LogRecordExporter createExporter(ConfigProperties config) { + return SystemOutLogRecordExporter.create(); + } + + @Override + public String getName() { + return "console"; + } +} diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleMetricExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleMetricExporterProvider.java new file mode 100644 index 00000000000..66983914a56 --- /dev/null +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleMetricExporterProvider.java @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.exporter.logging.internal; + +import io.opentelemetry.exporter.logging.LoggingMetricExporter; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider; +import io.opentelemetry.sdk.metrics.export.MetricExporter; + +/** + * {@link MetricExporter} SPI implementation for {@link LoggingMetricExporter}. + * + *
This class is internal and is hence not for public use. Its APIs are unstable and can change + * at any time. + */ +public final class ConsoleMetricExporterProvider implements ConfigurableMetricExporterProvider { + @Override + public MetricExporter createExporter(ConfigProperties config) { + return LoggingMetricExporter.create(); + } + + @Override + public String getName() { + return "console"; + } +} diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleSpanExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleSpanExporterProvider.java new file mode 100644 index 00000000000..220bd2d6ef0 --- /dev/null +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/ConsoleSpanExporterProvider.java @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.exporter.logging.internal; + +import io.opentelemetry.exporter.logging.LoggingSpanExporter; +import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; +import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider; +import io.opentelemetry.sdk.trace.export.SpanExporter; + +/** + * {@link SpanExporter} SPI implementation for {@link LoggingSpanExporter}. + * + *
This class is internal and is hence not for public use. Its APIs are unstable and can change + * at any time. + */ +public final class ConsoleSpanExporterProvider implements ConfigurableSpanExporterProvider { + @Override + public SpanExporter createExporter(ConfigProperties config) { + return LoggingSpanExporter.create(); + } + + @Override + public String getName() { + return "console"; + } +} diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingLogRecordExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingLogRecordExporterProvider.java index e6fbd6fbc8d..d84c4a9c0e8 100644 --- a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingLogRecordExporterProvider.java +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingLogRecordExporterProvider.java @@ -15,8 +15,13 @@ * *
This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. + * + * @deprecated The name {@code logging} is a deprecated alias for {@code console}, which is provided + * via {@link ConsoleLogRecordExporterProvider}. */ -public class LoggingLogRecordExporterProvider implements ConfigurableLogRecordExporterProvider { +@Deprecated +public final class LoggingLogRecordExporterProvider + implements ConfigurableLogRecordExporterProvider { @Override public LogRecordExporter createExporter(ConfigProperties config) { return SystemOutLogRecordExporter.create(); diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingMetricExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingMetricExporterProvider.java index 47605ac1154..479e7625202 100644 --- a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingMetricExporterProvider.java +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingMetricExporterProvider.java @@ -15,8 +15,12 @@ * *
This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. + * + * @deprecated The name {@code logging} is a deprecated alias for {@code console}, which is provided + * via {@link ConsoleMetricExporterProvider}. */ -public class LoggingMetricExporterProvider implements ConfigurableMetricExporterProvider { +@Deprecated +public final class LoggingMetricExporterProvider implements ConfigurableMetricExporterProvider { @Override public MetricExporter createExporter(ConfigProperties config) { return LoggingMetricExporter.create(); diff --git a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingSpanExporterProvider.java b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingSpanExporterProvider.java index 5854a12fe64..24f40ce1867 100644 --- a/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingSpanExporterProvider.java +++ b/exporters/logging/src/main/java/io/opentelemetry/exporter/logging/internal/LoggingSpanExporterProvider.java @@ -15,8 +15,12 @@ * *
This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
+ *
+ * @deprecated The name {@code logging} is a deprecated alias for {@code console}, which is provided
+ * via {@link ConsoleSpanExporterProvider}.
*/
-public class LoggingSpanExporterProvider implements ConfigurableSpanExporterProvider {
+@Deprecated
+public final class LoggingSpanExporterProvider implements ConfigurableSpanExporterProvider {
@Override
public SpanExporter createExporter(ConfigProperties config) {
return LoggingSpanExporter.create();
diff --git a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider
index 8d8842825ba..29f8e2db2da 100644
--- a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider
+++ b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.logs.ConfigurableLogRecordExporterProvider
@@ -1 +1,2 @@
io.opentelemetry.exporter.logging.internal.LoggingLogRecordExporterProvider
+io.opentelemetry.exporter.logging.internal.ConsoleLogRecordExporterProvider
diff --git a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider
index 3ad21a55ccd..3bdcd20b33f 100644
--- a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider
+++ b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider
@@ -1 +1,2 @@
io.opentelemetry.exporter.logging.internal.LoggingMetricExporterProvider
+io.opentelemetry.exporter.logging.internal.ConsoleMetricExporterProvider
diff --git a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider
index 8806e4b9608..682519c7938 100644
--- a/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider
+++ b/exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider
@@ -1 +1,2 @@
io.opentelemetry.exporter.logging.internal.LoggingSpanExporterProvider
+io.opentelemetry.exporter.logging.internal.ConsoleSpanExporterProvider
diff --git a/sdk-extensions/autoconfigure/README.md b/sdk-extensions/autoconfigure/README.md
index fdd3855b82d..8e6e68cbabc 100644
--- a/sdk-extensions/autoconfigure/README.md
+++ b/sdk-extensions/autoconfigure/README.md
@@ -143,9 +143,14 @@ The logging exporter prints the name of the span along with its attributes to st
| System property | Environment variable | Description |
|-------------------------------|-------------------------------|----------------------------------------------------------------------|
-| otel.traces.exporter=logging | OTEL_TRACES_EXPORTER=logging | Select the logging exporter for tracing |
-| otel.metrics.exporter=logging | OTEL_METRICS_EXPORTER=logging | Select the logging exporter for metrics |
-| otel.logs.exporter=logging | OTEL_LOGS_EXPORTER=logging | Select the logging exporter for logs |
+| otel.traces.exporter=console | OTEL_TRACES_EXPORTER=console | Select the logging exporter for tracing |
+| otel.metrics.exporter=console | OTEL_METRICS_EXPORTER=console | Select the logging exporter for metrics |
+| otel.logs.exporter=console | OTEL_LOGS_EXPORTER=console | Select the logging exporter for logs |
+
+The logging exporter is also set when `otel.traces.exporter`, `otel.metrics.exporter`,
+or `otel.logs.exporter` is set to `logging`. `logging` is a deprecated alias for `console`, the
+preferred value
+as [defined in the specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#exporter-selection).
#### Logging OTLP JSON exporter
diff --git a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LogRecordExporterConfiguration.java b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LogRecordExporterConfiguration.java
index b0eeb2481c0..eacdf9d7c9a 100644
--- a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LogRecordExporterConfiguration.java
+++ b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LogRecordExporterConfiguration.java
@@ -27,6 +27,7 @@ final class LogRecordExporterConfiguration {
static {
EXPORTER_ARTIFACT_ID_BY_NAME = new HashMap<>();
+ EXPORTER_ARTIFACT_ID_BY_NAME.put("console", "opentelemetry-exporter-logging");
EXPORTER_ARTIFACT_ID_BY_NAME.put("logging", "opentelemetry-exporter-logging");
EXPORTER_ARTIFACT_ID_BY_NAME.put("logging-otlp", "opentelemetry-exporter-logging-otlp");
EXPORTER_ARTIFACT_ID_BY_NAME.put("otlp", "opentelemetry-exporter-otlp");
diff --git a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LoggerProviderConfiguration.java b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LoggerProviderConfiguration.java
index ff94550ecbb..f762915dc41 100644
--- a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LoggerProviderConfiguration.java
+++ b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/LoggerProviderConfiguration.java
@@ -21,6 +21,7 @@
import java.io.Closeable;
import java.time.Duration;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,6 +29,9 @@
final class LoggerProviderConfiguration {
+ private static final List