question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring cloud configuration server starts without using logging.file property

See original GitHub issue

I have an application that start a configuration server. It uses Spring-boot and Spring-cloud. I also use logback to write logs in a file. I use Spring-boot 1.3.7 and spring-cloud-config-server version Brixton.SR4. (Same problem with Brixton.SR3 and Brixton.RELEASE)

In the resources folder, I have this application.yml file :

server:
  port: 8888
spring:
  application:
    name: geodis-configuration-server
  cloud:
    config:
      server:
        git:
          uri: git://my-repository-url.git
          searchPaths: runtime-configurations/dev,runtime-configurations/rct
logging:
  file: D:/PathToLogFile/configuration-server.log
  level:
    ROOT: 'INFO'
  config: classpath:logback-spring.xml

In the same folder, there is the logback-spring.xml :

<?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>

My problem is when I start the configuration it start without using the logging.file property and write the first two log lines in a LOG_FILE_IS_UNDEFINED file. After this, it write the logs normally in the configuration-server.log file. I don’t understand why the first two lines are not written is the configuration-server.log file.

Here is the beggining of the logs when the server start :

2016-08-17 14:26:46 INFO [main] o.s.c.a.AnnotationConfigApplicationContext Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@52af26ee: startup date [Wed Aug 17 14:26:46 CEST 2016]; root of context hierarchy
2016-08-17 14:26:46 INFO [main] o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e63d7b64] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

    CONFIGURATION-SERVER

Application : my-configuration-server 
Spring boot :  (v1.3.7.RELEASE)

--------------------------------------------
2016-08-17 14:26:47 INFO [main] c.g.r.c.s.ConfigurationServer No active profile set, falling back to default profiles: default
2016-08-17 14:26:47 INFO [main] o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2a3c96e3: startup date [Wed Aug 17 14:26:47 CEST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@52af26ee
2016-08-17 14:26:48 WARN [main] o.s.c.a.ConfigurationClassPostProcessor Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-08-17 14:26:48 INFO [main] o.s.c.c.s.GenericScope BeanFactory id=725dcee0-eb42-375b-9cca-8fe922431dc2
2016-08-17 14:26:48 INFO [main] o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e63d7b64] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-17 14:26:48 INFO [main] o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker Bean 'org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$8f9c7d5a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-08-17 14:26:48 INFO [main] o.s.b.c.e.t.TomcatEmbeddedServletContainer Tomcat initialized with port(s): 8888 (http)
2016-08-17 14:26:48 INFO [main] o.a.c.c.StandardService Starting service Tomcat
2016-08-17 14:26:48 INFO [main] o.a.c.c.StandardEngine Starting Servlet Engine: Apache Tomcat/8.0.36
2016-08-17 14:26:49 INFO [localhost-startStop-1] o.a.c.c.C.[.[.[/] Initializing Spring embedded WebApplicationContext
2016-08-17 14:26:49 INFO [localhost-startStop-1] o.s.w.c.ContextLoader Root WebApplicationContext: initialization completed in 1940 ms
2016-08-17 14:26:49 INFO [localhost-startStop-1] o.s.b.c.e.ServletRegistrationBean Mapping servlet: 'dispatcherServlet' to [/]

The lines before the banner (first two line) are in the LOG_FILE_IS_UNDEFINED file.

How can I solve this issue ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dsyercommented, Aug 17, 2016

If you use logback-spring.xml I believe you have to define all the properties you need in that file in bootstrap.yml because it is initialized earlier.

0reactions
YLombardicommented, Jul 16, 2018

No problem with Finchley.RELEASE. The issue seems fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring cloud config server not honoring logging.file property ...
In the spring boot 2.3.3 RELEASE documentation the logging properties that specify where the location should be is indicated using the ...
Read more >
2. Spring Cloud Config Server
Spring Cloud Config Server provides an HTTP resource-based API for external configuration (name-value pairs or equivalent YAML content). The server is ...
Read more >
Quick Intro to Spring Cloud Configuration - Baeldung
To complete our server, we have to initialize a Git repository under the configured url, create some new properties files, and populate them...
Read more >
Reading properties from Spring Cloud Config Server - Quarkus
The end result of that process is a running Config Server that will provide the Hello world value for a configuration property named...
Read more >
Spring Cloud Config with File System Backend - Medium
Note: If you do not provide server.contextPath in your application.properties file, it will be empty by default. ... Notice that the content of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found