You can do that using your application.properties.
logging.level.=ERROR
-> Sets the root logging level to error
...
logging.level.=DEBUG
-> Sets the root logging level to DEBUG
logging.file=${java.io.tmpdir}/myapp.log
-> Sets the absolute log file path to TMPDIR/myapp.log
A sane default set of application.properties regarding logging using profiles would be:
application.properties:
spring.application.name=<your app name here>
logging.level.=ERROR
logging.file=${java.io.tmpdir}/${spring.application.name}.log
application-dev.properties:
logging.level.=DEBUG
logging.file=
When you develop inside your favourite IDE you just add a -Dspring.profiles.active=dev
as VM argument to the run/debug configuration of your app.
This will give you error only logging in production and debug logging during development WITHOUT writing the output to a log file. This will improve the performance during development ( and save SSD drives some hours of operation ;) ).