HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavaspringCritical

How can I set the logging level with application.properties?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
loggingwithhowlevelsetpropertiesthecanapplication

Problem

This is very simple question, but I cannot find information. (Maybe my knowledge about Java frameworks is severely lacking.)

How can I set the logging level with application.properties? And logging file location, etc?

Solution

Update: Starting with Spring Boot v1.2.0.RELEASE, the settings in application.properties or application.yml do apply. See the Log Levels section of the reference guide.

logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR


For earlier versions of Spring Boot you cannot. You simply have to use the normal configuration for your logging framework (log4j, logback) for that. Add the appropriate config file (log4j.xml or logback.xml) to the src/main/resources directory and configure to your liking.

You can enable debug logging by specifying --debug when starting the application from the command-line.

Spring Boot provides also a nice starting point for logback to configure some defaults, coloring etc. the base.xml file which you can simply include in your logback.xml file. (This is also recommended from the default logback.xml in Spring Boot.

Code Snippets

logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR
<include resource="org/springframework/boot/logging/logback/base.xml"/>

Context

Stack Overflow Q#20485059, score: 557

Revisions (0)

No revisions yet.