File tree Expand file tree Collapse file tree 3 files changed +69
-1
lines changed
spring-boot-project/spring-boot-docs/src
docs/antora/modules/reference/pages/actuator
java/org/springframework/boot/docs/actuator/loggers/opentelemetry/logback
kotlin/org/springframework/boot/docs/actuator/loggers/opentelemetry/logback Expand file tree Collapse file tree 3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -52,5 +52,5 @@ You have to add the appender to your logback-spring.xml or log4j-spring.xml.
5252
5353In order to function, OpenTelemetryAppender needs access to an OpenTelemetry instance. This must be set programmatically during application startup as follows:
5454
55- include-code::opentelemetry /OpentelemetryLoggerConfiguration[]
55+ include-code::logback /OpentelemetryLoggerConfiguration[]
5656
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2012-2022 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package org .springframework .boot .docs .actuator .loggers .opentelemetry .logback ;
17+
18+ import org .springframework .boot .context .event .ApplicationReadyEvent ;
19+ import org .springframework .context .ApplicationListener ;
20+ import org .springframework .context .annotation .Bean ;
21+ import org .springframework .context .annotation .Configuration ;
22+
23+ import io .opentelemetry .api .OpenTelemetry ;
24+ import io .opentelemetry .instrumentation .logback .appender .v1_0 .OpenTelemetryAppender ;
25+
26+ @ Configuration
27+ public class OpentelemetryLoggerConfiguration {
28+
29+ @ Bean
30+ public ApplicationListener <ApplicationReadyEvent > logbackOtelAppenderInitializer (OpenTelemetry openTelemetry ) {
31+ return event -> OpenTelemetryAppender .install (openTelemetry );
32+ }
33+
34+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2012-2022 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package org.springframework.boot.docs.actuator.loggers.opentelemetry.logback
18+
19+ import org.springframework.boot.context.event.ApplicationReadyEvent
20+ import org.springframework.context.ApplicationListener
21+ import org.springframework.context.annotation.Bean
22+ import org.springframework.context.annotation.Configuration
23+
24+ import io.opentelemetry.api.OpenTelemetry
25+ import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender
26+
27+ @Configuration
28+ class OpentelemetryLoggerConfiguration {
29+
30+ @Bean
31+ fun logbackOtelAppenderInitializer (openTelemetry : OpenTelemetry ): ApplicationListener <ApplicationReadyEvent > {
32+ return ApplicationListener { OpenTelemetryAppender .install(openTelemetry) }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments