i’ve a spring boot application containerized with docker. I’m using IntelliJ Idea ultimate latest version.
I made a "pipeline" which does mvn clean install and then launches the dockerfile in debug mode. I configured the container with some env vars including LOGS_DIRECTORY so the dir containing logs must be overrided by some value. Every log seems perfect, with the correct level, stored inside the container exactly where I want etc etc..
The problem shows when I launch that pipeline which cleans and reinstall everything: tests are included, so spring creates 15-20 lines of log to prepare the context for them and these lines comes from a "local" execution (which is spring) so no log dir is found, UNDEFINED_LOG_DIR directory is created and they get stored there.
Is there a way to print nothing during test phase or at least to override LOGS_DIRECTORY also during tests and not only with Docker?
Thanks for the patience
2
Answers
Well, I was pretty stupid, the answer was pretty easy but still tricky considering I didn't know it. Still thanks to Basa Deva Reddy but your answer didn't solve the problem.
What I actually had to do was to specify -DLOGS_DIR='logs-directory-you-have' before the command line clean install. Issue resolved :)
In Spring Boot, you can prevent the logging of tests preparation by configuring the logging level for the relevant packages or classes.
One way to do this is by modifying the application.properties or application.yml file in your project. In this file, you can specify the logging level for specific packages or classes.
For example, if you want to prevent the logging of tests preparation for the Spring Framework, you can add the following line in your application.properties file:
”’
logging.level.org.springframework.test=OFF
”’