Closed SingKS8 closed 5 years ago
My guess is it is not specific to spring-cloud-bus, but probably spring-cloud-commons. Can you try with that instead and see if the same problem persists?
Thanks for helping. I reviewed the code, and found I missed a point, because someone designed logback.xml has some code like this:
<if condition='isDefined("catalina.base")'>
<then>
<property name="log_dir" value="${catalina.base}/logs" />
</then>
<else>
<if condition='isDefined("appPath")'>
<then>
<property name="log_dir" value="${appPath}/logs" />
</then>
<else>
<property name="log_dir" value="./logs" />
</else>
</if>
</else>
</if>
Then I removed this condition and just set a property
<property name="log_dir" value="./logs" />
It worked, apiLogger cloud the log info in the log file. Maybe spring-cloud-bus or spring-cloud-commons somewhere has a conflict of logback condition.
We don't do anything specifically with log back
Yes spring cloud do nothing specifically with logback. And I found what has happened in my case. Thanks for helping.
This is the version that I have used. spring boot : 2.0.9.RELEASE spring cloud: Finchley.SR2
In my case, I have a filter that logging the request body and response body, like this:
And logback configuration like this:
When my project was only a spring-boot-starter-web Or spring cloud bus was disable , apiLogger cloud write the log info in the log file. But if the project integrated spring cloud and spring cloud bus was enable, apiLogger cloud not the log info in the log file. And I have updated spring boot and spring cloud version,
spring boot : 2.1.5.RELEASE spring cloud: Greenwich.SR1
writing log file is still not working. After debugged, I found when spring cloud bus was enable, writing log file is not working in all http threads, wherever Filter or Controller, for example controller like this:
apiLogger can not the log info in the log file.
Does it not recommend using the log file when use the spring cloud bus ??