相对路径在 lobgack.xml 包含文件中不起作用
Relative path not working in lobgack.xml include file
我已将 logback.xml 放在 war 之外,并将该文件包含在主 logback.xml.
问题是绝对路径与 include 文件 一起工作,但 相对路径不工作
下面是代码:
<configuration scan="true" scanPeriod="30 seconds">
<include file="..//..//..//..//logback-new.xml" />
</configuration>
包含的文件路径:C:\Users\MB0000038\Documents\vuliv-server-development - 2\theapp\logback files
war 中的资源文件夹:C:\Users\MB0000038\Documents\vuliv-server-development - 2\theapp\AnalyticsAPI\src\main\resources
感谢任何帮助
根据Logback docs文件包含...
can use relative paths but note that the current directory is defined by the application and is not necessarily related to the path of the configuration file.
因此,给定您的相对路径:..//..//..//..//logback-new.xml
Logback 将查找应用程序当前工作目录上方 logback-new.xml
四个目录。
我怀疑您正在定义相对路径,就好像应该相对于 WAR 中的资源文件夹,但这不是定义它的方式。相反,它应该相对于应用程序的当前工作目录进行定义。如果 Logback 找不到要包含的文件,它将发出一条状态消息告诉您。
我已将 logback.xml 放在 war 之外,并将该文件包含在主 logback.xml.
问题是绝对路径与 include 文件 一起工作,但 相对路径不工作 下面是代码:
<configuration scan="true" scanPeriod="30 seconds">
<include file="..//..//..//..//logback-new.xml" />
</configuration>
包含的文件路径:C:\Users\MB0000038\Documents\vuliv-server-development - 2\theapp\logback files
war 中的资源文件夹:C:\Users\MB0000038\Documents\vuliv-server-development - 2\theapp\AnalyticsAPI\src\main\resources
感谢任何帮助
根据Logback docs文件包含...
can use relative paths but note that the current directory is defined by the application and is not necessarily related to the path of the configuration file.
因此,给定您的相对路径:..//..//..//..//logback-new.xml
Logback 将查找应用程序当前工作目录上方 logback-new.xml
四个目录。
我怀疑您正在定义相对路径,就好像应该相对于 WAR 中的资源文件夹,但这不是定义它的方式。相反,它应该相对于应用程序的当前工作目录进行定义。如果 Logback 找不到要包含的文件,它将发出一条状态消息告诉您。