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

[ANCHOR-610] Fix log level #1268

Merged
merged 3 commits into from
Feb 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ subprojects {

allprojects {
group = "org.stellar.anchor-sdk"
version = "1.2.21"
version = "1.2.22"

tasks.jar {
manifest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.stellar.anchor.platform.configurator;

import org.jetbrains.annotations.NotNull;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.PropertiesPropertySource;
Expand All @@ -11,6 +13,16 @@ public class SpringFrameworkConfigurator extends AbstractConfigurator
public void initialize(@NotNull ConfigurableApplicationContext applicationContext) {
// Load and add the data access settings to Spring `Environment`
PropertiesPropertySource pps = createPrefixedPropertySource("spring");
pps.getSource()
.forEach(
(String cfgName, Object cfgValue) -> {
if (cfgName.startsWith("logging.level") && cfgValue instanceof String) {
LoggingSystem system =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do we need to call this for every source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not, but it's just for one partner in the legacy branch (and most likely they will only use it for debug logs), so I decided to keep it simple

LoggingSystem.get(SpringFrameworkConfigurator.class.getClassLoader());
system.setLogLevel(
cfgName.replace("logging.level.", ""), LogLevel.valueOf((String) cfgValue));
}
});
applicationContext.getEnvironment().getPropertySources().addFirst(pps);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,4 @@ Configutation:
level: info
AppenderRef:
- ref: ${env:LOG_APPENDER:-console_appender}
Logger:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the log levels set to after removing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is always INFO

- name: org.stellar
level: debug
- name: org.apache
level: warn
- name: org.hibernate
level: warn
- name: com.zaxxer
level: warn

Loading