jar外部的spring boot log4j文件? [英] spring boot log4j file external to jar?

查看:109
本文介绍了jar外部的spring boot log4j文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过?我能让它工作的唯一方法是将log4j.xml放在类路径上。

how to pass? The only way I can get this to work is to put log4j.xml on the classpath.

传递:命令行上的-Dlog4j.configuration = file:/// c:\ log4j2.xml不起作用(尽管它在非弹簧中运行) - 启动测试应用程序就好了。

passing: -Dlog4j.configuration=file:///c:\log4j2.xml on the command line doesn't work (although it does in a non spring-boot test application just fine).

我也尝试在春季将它作为环境变量/属性。

I also tried putting this as an environment variable/property in spring.

推荐答案

尝试将此行放入 application.properties

logging.config=file:log4j.xml

第二个选项是将系统变量传递给 -Dlogging.config = file:log4j.xml

Second option is to pass system variable to -Dlogging.config=file:log4j.xml

在这种情况下,它是预期的位于JAR文件之外的当前目录中。

In this case it is expected to be located in current directory outside of the JAR file.

这篇关于jar外部的spring boot log4j文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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