You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
I have two Feign clients in a Spring Boot project, they are both configured like this (Kotlin):
@Configuration
class FirstConfig {
@Bean
fun getFirstClient(): FirstClient {
return Feign.builder()
.logger(Logger.JavaLogger().appendToFile("logs/first.log"))
.logLevel(Logger.Level.FULL)
.decoder(JacksonDecoder())
.encoder(JacksonEncoder())
.target(FirstClient::class.java, "...")
}
}
And similarly for SecondClient and second.log (all the names are changed).
The issue is that I get two log files mixed. Something like that:
logs/second.log:
[FirstClient#someMethod] ---> GET http://.../... HTTP/1.1
...
[FirstClient#someMethod] <--- END HTTP (3629-byte body)
[SecondClient#otherMethod] ---> POST https://.../... HTTP/1.1
...
[SecondClient#send] ---> END HTTP (767-byte body)
[FirstClient#oneMoreMethod] ---> GET http://.../... HTTP/1.1
...
And the second.log is full of FirstClient's logs and vice versa. diff says the files are almost identical, but not completely -- two or three logs from first client does not appear in second's file.
I found that the problem is caused by 165th line in feign\Logger.java: logger = java.util.logging.Logger.getLogger(Logger.class.getName());
So this method returns the same object for both instances of feign\JavaLogger.java. Would the change of an identifier be an appropriate solution?
Hey @Donutellko
I have one suggestion here to solve this problem, rather than using the default constructor of feign\JavaLogger.java we can introduce constructor with a parameter name or class. Something like public JavaLogger(Class<?> clazz) and public JavaLogger(String name). what do you thing @kdavisk6 ?
Hello.
I have two Feign clients in a Spring Boot project, they are both configured like this (Kotlin):
And similarly for
SecondClient
andsecond.log
(all the names are changed).The issue is that I get two log files mixed. Something like that:
logs/second.log:
And the second.log is full of FirstClient's logs and vice versa.
diff
says the files are almost identical, but not completely -- two or three logs from first client does not appear in second's file.I use version 10.1.0:
Thank you.
The text was updated successfully, but these errors were encountered: