Logging reactive operations
So far, we have crafted a domain object for MongoDB, defined a reactive repository, and updated our ImageService
to use it. If we fire things up, though, how can we see what's happening? Apart from viewing the web page, what can we expect to see in the console logs?
So far, this appears to be the most we get:
We see some log messages about connecting to an instance of MongoDB, but that's it! Not much there to debug things, ehh? Never fear, Spring Boot to the rescue.
Spring Boot comes with extensive logging support. Off the cuff, we can create a logback.xml
file, and add it to our configuration in src/main/resources
. Spring Boot will read it, and override its default logging policy. That's nice if we want to totally overhaul the log settings.
But often times, we just want to adjust some logging levels for specific packages. Spring Boot grants us a more fine-grained way to alter what gets logged.
Simply add this to src/main/resources/application.properties
:
logging...