Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set logging level for spring cloud config

I am trying to debug some issues I'm having with my spring cloud configuration, but I'm not sure how to correctly set the logging level for it. I have tried setting the logging level "org.springframework.cloud to trace, but that doesn't seem to have any effect. What is the correct package for logging spring cloud?

Update I'm hoping to see basic information like if properties were found.

Update2 The issue turned out to be related to my JBoss appender. I was setting the log level of the correct package, but the logging level of the console appender was set to info, so none of the cloud config info was being logged.

like image 422
mad_fox Avatar asked Dec 01 '17 13:12

mad_fox


2 Answers

Example using .yml file:

logging:
  level:
    ROOT: INFO
    org.springframework.cloud.config: DEBUG

By the way, if you are debugging from the client, there isn't a ton of code: https://github.com/spring-cloud/spring-cloud-config/tree/master/spring-cloud-config-client/src/main/java/org/springframework/cloud/config

So, whatever you are hoping for may be in a different package.

like image 89
Eric Swanson Avatar answered Nov 07 '22 20:11

Eric Swanson


We have to set the Log configuration details in .yml file as shown below

logging:
  file: D:/PathToLogFile/configuration-server.log
  level:
    ROOT: 'INFO'
  config: classpath:logback-springtest.xml

Here is complete logback-springtest.xml defination.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_FILE}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_FILE}-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
            <maxHistory>30</maxHistory>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>50MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
        </rollingPolicy>
        <encoder>
            <pattern>%date{YYYY-MM-dd HH:mm:ss} %level [%thread] %logger{10} %msg%n</pattern>
        </encoder>
    </appender>

    <logger name="org.springframework" level="INFO">
        <appender-ref ref="FILE"/>
    </logger>

    <logger name="org.apache" level="INFO">
        <appender-ref ref="FILE"/>
    </logger>
</configuration>
like image 2
Lova Chittumuri Avatar answered Nov 07 '22 21:11

Lova Chittumuri