Vitalii
Vitalii

Reputation: 11071

Setting level to a logger in spring-boot

In logback-spring.xml file of a project that is new to me I see this configuration

 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
 ......
 </appender>
 <logger name="com.myproject.myclass" level="${APP_LOGGING_LEVEL:-INFO}" additivity="false">
       <appender-ref ref="STDOUT"/>
 </logger>

As far as I understand, all logs from com.myproject.myclass class will be sent to <appender name="STDOUT"> that is console.

Could someone explain me what will be the level of this log with this config level="${APP_LOGGING_LEVEL:-INFO}"? In documentation I see only constants like WARN, DEBUG, etc

Upvotes: 0

Views: 296

Answers (1)

pvpkiran
pvpkiran

Reputation: 27048

In Spring ${APP_LOGGING_LEVEL:-INFO} means APP_LOGGING_LEVEL is a dynamic variable. The value for which can be set from properties file or from command line when running the project or from any other place accessible. If not set whatever after : is selected.
In your case if not set INFO is selected

Upvotes: 1

Related Questions