Ria*_*its 7 java osgi logback equinox sling
我正在尝试在Equinox项目中使用Apache Sling日志记录.它工作正常,但我不能让Sling使用我的配置文件.我正在使用标准的logback配置xml,它应该根据Sling文档工作.但无论我在哪里放置配置文件Sling只是不使用它.
我的logback配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} *%level* [%thread] %logger %message%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我设法让 Sling 使用我的配置文件的唯一方法是将配置文件的位置作为 VM 参数传递,如下所示:-Dorg.apache.sling.commons.log.configurationFile=/path/to/logbackconfigfile,其中路径是配置文件位置的完整路径。不幸的是,我还没有设法让它与相对路径一起工作。
| 归档时间: |
|
| 查看次数: |
209 次 |
| 最近记录: |