Log file not getting generated from dependent JAR application

拜拜、爱过 提交于 2021-01-29 17:52:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!