没有从依赖的JAR应用程序生成日志文件 [英] Log file not getting generated from dependent JAR application

查看:47
本文介绍了没有从依赖的JAR应用程序生成日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Maven应用程序,该应用程序生成JAR并使用Apache登录.当我独立运行JAR时,将成功生成日志文件.

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.

现在在另一个Maven Spring Web应用程序中将此JAR文件用作依赖项,在该Web应用程序中使用了JAR文件类.

Now using this JAR file as dependent in another Maven Spring web application, in which the JAR file classes are consumed.

但是在运行应用程序时,可以看到仅生成了WAR文件日志,而没有生成依赖的JAR日志文件.

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 ?

谢谢.

推荐答案

请在日志文件(例如logback.xml)中将logger标签和相关jar的包名称一起添加

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>

这篇关于没有从依赖的JAR应用程序生成日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆