I have a spring boot application with logging via org.slf4j.Logger
and I have a Mono
as seen below in a class in package com.mycompanyname
.
Mono
.just("some text")
.log(
"category",
Level.FINEST,
SignalType.ON_SUBSCRIBE, SignalType.ON_NEXT, SignalType.ON_COMPLETE
);
I set my logging in the applicaton.yaml like this:
logging:
level:
com.mycompanyname: TRACE
I would expect to see log statements if I subscribe to the Mono
but I do not. For what package do I have to set the log level to TRACE
?
If I change my config in the application.yaml to
logging:
level:
ROOT: TRACE
then I can see the log messages from my Mono
stream.
If the configuration in the application.yaml looks like this
logging:
level:
com.mycompanyname: TRACE
then the logging in the Mono
has to be defined like this:
Mono
.just("some text")
.log(
"com.mycompanyname.myclassname",
Level.FINEST,
SignalType.ON_SUBSCRIBE, SignalType.ON_NEXT, SignalType.ON_COMPLETE
);
or
Mono
.just("some text")
.log(
this.getClass().getName(),
Level.FINEST,
SignalType.ON_SUBSCRIBE, SignalType.ON_NEXT, SignalType.ON_COMPLETE
);
The category
parameter of the log
method has to match the logging configuration name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.