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.

Logback configuration error detected when using openFeign

See original GitHub issue

Trying to use openFeign as our rest client. Followed the various guides online to set up. Tried using slf4j plugin too. No matter what I try AppContext won’t load and I see the following error:


ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [loggingAppender_IS_UNDEFINED]. Did you define it below instead of above in the configuration file?

application.yaml:

logging.level.com.moneysupermarket.energyrequoteconsumer.token.TokenServiceClient: DEBUG

feign:
  client:
    config:
      TokenServiceClient:
        connectTimeout: 5000
        readTimeout: 5000
        loggerLevel: basic

service:

    public TokenService(...) {
        ...
        this.client = Feign.builder()
                .decoder(new GsonDecoder())
                .logger(new Slf4jLogger(TokenServiceClient.class))
                .target(TokenServiceClient.class, baseURL);
    }

    public String getAutoLoginToken(...) {
        ...
        return client.getToken(request);
    }

client:

@FeignClient(value = "tokenServiceClient")
public interface TokenServiceClient {
    @RequestMapping(method = RequestMethod.POST, value = "/tokens")
    @Headers("Content-Type: application/json")
    String getToken(AutoLoginTokenRequest request);
}

build.gradle

...
"org.springframework.cloud:spring-cloud-starter-openfeign:2.1.2.RELEASE",
"org.springframework.cloud:spring-cloud-dependencies:Greenwich.SR2",
"com.netflix.feign:feign-gson:7.2.1",
"io.github.openfeign:feign-slf4j:10.3.0"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
collabintelcommented, Jan 6, 2020

Hi everyone, for those who still experience this and similar problems with logback, I wanted to share my solution. I had experienced a similar problem with the springProperty feature in logback configuration and after my investigations I found out that it wasn’t because of feign, it was because of spring-cloud-starter dependency added with spring-cloud-starter-openfeign dependency. We didn’t have spring-cloud dependency before, until we’ve added spring-cloud-starter-openfeign dependency to the project. The problem occurs because of a change in the way that spring-cloud initializes the logback configuration: With only spring-boot, it was able to load properties in application.yml files, but after adding the spring-cloud dependency, it was not able to load these properties from these files. However, it was able to load the properties from bootstrap.yml file. My solution to fix this problem with the properties from application.yml, is to initialize logging after the spring properties are loaded in the context, using logging.config in the spring property file, as shown here: https://stackoverflow.com/questions/33505624/logback-and-spring-boots-new-springproperty-lookup-mechanism-not-working/48383482#48383482

0reactions
kdavisk6commented, Nov 15, 2019

@JoniSykes Were you able to resolve this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting java.lang.IllegalStateException: Logback configuration ...
The error can be resolved by using <appender name="Console" class="ch.qos.logback.core.ConsoleAppender">. instead of
Read more >
Logback configuration error detected 报错处理方式 - CSDN博客
Logback configuration error detected : 报错原因:. Logback 配置错误:. 解决方式:. 其实也很简单Logback 配置日志输出路径错误,默认 ...
Read more >
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, ...
Read more >
Spring Boot: error when activating profile in YAML file ...
The root cause of the problem is due to no having Spring Boot profile for the required environment. The profile named 'dev' shown...
Read more >
Using logstash-logging-spring-boot-starter for logging with ...
If such appender won't be found, the library uses Spring Boot default ... If you provide your own Logback configuration file you should ......
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