I have deployed springboot application in PCF . I want to log the message based on the environment variable .What should I do so that the run time log level change will work without restarting the application?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The default logging provider is logback. To setup your system so that the logging level can be changed at runtime you need to perform the following steps:
Firstly in
src/main/resources
create a custom logback configuration namedlogback-spring.xml
that includes spring's default configurator and then adds the directive that exposes logback configuration over JMX:Now add a dependency on the Jolokia JMX-over-HTTP bridge:
org.jolokia:jolokia-core
.You should now be able to hit
/jolokia
endpoints on your spring boot application. The protocol is documented here. It's not pretty. To get you started, here's a fewGET
examples that you can hit straight from a browser:Show ROOT logger level:
Change ROOT logger level to debug:
spring-boot-actuator is aware of the
/jolokia
endpoint and it is markedsensitive=true
so if you have spring-security on the classpath then it will require authentication.