-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d0a0d6
commit ecbfe54
Showing
13 changed files
with
73 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 3 additions & 11 deletions
14
...tics/implementation/DefaultLogConfig.java → ...ion/selfdiagnostics/DefaultLogConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../implementation/ExecutionEnvSelfDiag.java → ...selfdiagnostics/ExecutionEnvSelfDiag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ing/cloud/autoconfigure/monitor/implementation/selfdiagnostics/LogbackSelfDiagConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.spring.cloud.autoconfigure.monitor.implementation.selfdiagnostics; | ||
|
||
import ch.qos.logback.classic.Level; | ||
import ch.qos.logback.classic.LoggerContext; | ||
import org.slf4j.ILoggerFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnClass(ch.qos.logback.classic.LoggerContext.class) | ||
class LogbackSelfDiagConfig { | ||
|
||
@Bean | ||
Logger selfDiagnosticsLogger(SelfDiagnosticsLevel selfDiagnosticsLevel) { | ||
Logger slf4jLog = LoggerFactory.getLogger(SelfDiagnostics.class); | ||
ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) slf4jLog; | ||
Level logbackLevel = Level.toLevel(selfDiagnosticsLevel.name()); | ||
logbackLogger.setLevel(logbackLevel); | ||
return logbackLogger; | ||
} | ||
|
||
@Bean | ||
CommandLineRunner autoConfigureDistroCommandLine(SelfDiagnosticsLevel selfDiagnosticsLevel) { | ||
return args -> { | ||
ILoggerFactory loggerFactorySpi = LoggerFactory.getILoggerFactory(); | ||
if (!(loggerFactorySpi instanceof LoggerContext)) { | ||
return; | ||
} | ||
|
||
LoggerContext loggerContext = (LoggerContext) loggerFactorySpi; | ||
|
||
Level selfDiagLogbackLevel = Level.toLevel(selfDiagnosticsLevel.name()); | ||
|
||
ch.qos.logback.classic.Logger azureMonitorOTelLogger = loggerContext.getLogger("com.azure.monitor.opentelemetry"); | ||
azureMonitorOTelLogger.setLevel(selfDiagLogbackLevel); | ||
}; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...gnostics/implementation/OtelSelfDiag.java → ...ntation/selfdiagnostics/OtelSelfDiag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...stics/implementation/SelfDiagnostics.java → ...tion/selfdiagnostics/SelfDiagnostics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ring/cloud/autoconfigure/monitor/implementation/selfdiagnostics/SelfDiagnosticsLevel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.spring.cloud.autoconfigure.monitor.implementation.selfdiagnostics; | ||
|
||
enum SelfDiagnosticsLevel { | ||
|
||
ERROR, | ||
WARN, | ||
INFO, | ||
DEBUG, | ||
TRACE, | ||
OFF | ||
} |
33 changes: 0 additions & 33 deletions
33
...va/com/azure/spring/cloud/autoconfigure/monitor/selfdiagnostics/SelfDiagnosticsLevel.java
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
...ing/cloud/autoconfigure/monitor/selfdiagnostics/implementation/LogbackSelfDiagConfig.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
.../main/java/com/azure/spring/cloud/autoconfigure/monitor/selfdiagnostics/package-info.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
com.azure.spring.cloud.autoconfigure.monitor.implementation.AzureSpringMonitorAutoConfiguration | ||
com.azure.spring.cloud.autoconfigure.monitor.selfdiagnostics.implementation.SelfDiagAutoConfig | ||
com.azure.spring.cloud.autoconfigure.monitor.implementation.selfdiagnostics.SelfDiagAutoConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters