Я хочу использовать logback. xml для структурирования моих журналов из моего java кода. Зависимость logback (Maven), которую я сейчас использую в моем pom. xml -
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.3</version>
</dependency>
В моих зависимостях maven я также получил ядро logback и sfl4j.
У меня есть два logback. xml доступно в моем java коде. Один из зависимости от jar, а другой - от указанного c path {active_directory_java_code} \ configuration
Первый вход в систему (из зависимости jar):
<configuration scan="true" scanPeriod="10 seconds">
<include file="${configuration.directory}/logback.xml"/>
</configuration>
Второй logback (находится в {active_directory_java_code} \ configuration):
<included>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{yyyyMMdd HHmmss.SSS} [%.-1level] %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>TRACE</level>
</filter> <file>${log_file_name}</file>
<encoder>
<pattern>%d{yyyyMMdd HHmmss.SSS} [%-5level] %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="TRACE">
<appender-ref ref="STDOUT" />
</root>
</included>
Я запускаю свой основной класс с помощью командной строки:
@call "%javapath%" -Dconfiguration.root=%exepath%\configuration -cp main/*;configuration;lib/* main.Main
, где main это папка, в которую я помещаю main.jar, Main - это основной метод main.jar, а lib - это папка, в которой находятся все jar зависимостей (где одна содержит другую Logback. xml). Общий logback (второй) помещается в {configuration.directory} и вызывает logback. xml.
Когда я запускаю командную строку. Я получил эту ошибку:
12:22:38,815 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
12:22:38,816 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
12:22:38,816 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:{configuration.root}/logback.xml]
12:22:38,817 |-WARN in ch.qos.logback.classic.LoggerContext[default] – Resource [logback.xml] occurs multiple times on the classpath.
12:22:38,817 |-WARN in ch.qos.logback.classic.LoggerContext[default] – Resource [logback.xml] occurs at [file:{configuration.root}/logback.xml]
12:22:38,817 |-WARN in ch.qos.logback.classic.LoggerContext[default] – Resource [logback.xml] occurs at [jar:file:{active_directory_java_code}/lib/logback.jar!/logback.xml]
12:22:38,913 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@1:11 - no applicable action for [included], current ElementPath is [[included]]
12:22:38,913 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@2:70 - no applicable action for [appender], current ElementPath is [[included][appender]]
12:22:38,914 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:65 - no applicable action for [filter], current ElementPath is [[included][appender][filter]]
12:22:38,914 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:11 - no applicable action for [level], current ElementPath is [[included][appender][filter][level]]
12:22:38,914 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:12 - no applicable action for [encoder], current ElementPath is [[included][appender][encoder]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:13 - no applicable action for [pattern], current ElementPath is [[included][appender][encoder][pattern]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:44 - no applicable action for [appender], current ElementPath is [[included][appender]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@13:65 - no applicable action for [filter], current ElementPath is [[included][appender][filter]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:11 - no applicable action for [level], current ElementPath is [[included][appender][filter][level]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@16:9 - no applicable action for [file], current ElementPath is [[included][appender][file]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@17:12 - no applicable action for [encoder], current ElementPath is [[included][appender][encoder]]
12:22:38,915 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@18:13 - no applicable action for [pattern], current ElementPath is [[included][appender][encoder][pattern]]
12:22:38,916 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@43:22 - no applicable action for [root], current ElementPath is [[included][root]]
12:22:38,928 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@44:32 - no applicable action for [appender-ref], current ElementPath is [[included][root][appender-ref]]
12:22:38,928 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@45:29 - no applicable action for [appender-ref], current ElementPath is [[included][root][appender-ref]]
12:22:38,931 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@e6ea0c6 -Registering current configuration as safe fallback point
Кто-нибудь знает, откуда возникла ошибка? Почему он не может обрабатывать включенные теги и другие теги?