问题
I have a maven application which generates a JAR and used Apache logging in it. When I ran the JAR standalone, log file is getting generated successfully.
Now using this JAR file as dependent in another Maven Spring web application, in which the JAR file classes are consumed.
But while running the application, could see that only WAR file logs are getting generated and not the dependent JAR log files.
Is this the expected behaviour? or am I missing any configuration etc ?
Thanks.
回答1:
Have you tried set the logger by package in application.properties?
Example:
logging.level.org.springframework.web= DEBUG
logging.level.org.hibernate= ERROR
回答2:
Please add the logger tag with the package name of your dependent jar in the logback file (ex. logback.xml)
<logger name="com.your.project.package">
<appender-ref ref="FILE"/>
</logger>
来源:https://stackoverflow.com/questions/57294068/log-file-not-getting-generated-from-dependent-jar-application