Hi,
I'm using logback in application to log the http request/response into the DataBase (logging_event) table.
Below given is the Java configuration class for DbAppender.
In my application, I have another configuration class that has some configuration properties and the values of those properties can change dynamically.
I'm using the @RefreshScope (org.springframework.cloud.
context.config.annotation.RefreshScope) annotation to get the new values of the config properties changed on the fly using https://www.consul.io/.The DBAppender works fine, except that when I make any changes to the configuration properties externally (changing the value of an existing property or adding a new config property in Consul) while the app is running. After I make any changes to a config property externally, the DbAppender will not insert logs into the DB table. These config properties are not related to the logging functionality.
@Configuration
public class LogbackConfiguration {
@Bean
public DBAppender dbAppender(DataSource ds){
DBAppender dbAppender = new DBAppender();
DataSourceConnectionSource connectionSource = new DataSourceConnectionSource();
connectionSource.setDataSource(ds );
connectionSource.start();
dbAppender.setConnectionSource(connectionSource);
dbAppender.start();
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger logger = loggerContext.getLogger("org.zalando.logbook");
logger.addAppender(dbAppender);
return dbAppender;
}
}
Below given is the configurations related to logging in my application.yml file -
logbook:
minimum-status: 100
exclude:
- /actuator/**
- /favicon.ico
- /swagger-resources/**
- /swagger-ui.html
- /webjars/**
logging:
level:
org.zalando.logbook: TRACE
Could you please guide me to identify the root cause of this issue?
Thanks