将Logback与在ServiceMix下运行的Karaf 3.0.5一起使用 [英] Using logback with Karaf 3.0.5 running under ServiceMix

查看:136
本文介绍了将Logback与在ServiceMix下运行的Karaf 3.0.5一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ServiceMix下运行的Karaf 3.0.5中使用logback.这是我到目前为止所做的,正如中提到的那样问题.

I am trying to use logback with Karaf 3.0.5 running under ServiceMix. This is what I have done till now as mentioned in this question.

这是我到目前为止所做的:-

This is what I have done till now:-

  1. 通过执行uninstall <pax-logging-bundle-id>
  2. 删除了pax-logging-service
  3. 已删除lib/bin/karaf-client.jar
  4. lib内侧放置了以下罐子:-jcl-over-slf4j-1.7.13jul-to-slfj-17.13.jarlogback-classic-1.0.13.jarlogback-core-1.0.13.jar& osgi-over-slf4j-1.7.13.jar
  5. /etc/startup.properties-删除了对pax-logging-servicepax-logging-api
  6. 的引用
  7. org.osgi.framework.system.packages.extra下的etc/config.properties中添加了以下软件包:- ch.qos.logback; version="1.0.13", \ org.slf4j; version="1.7.13", \
  8. 创建一个logback.xml并将其放置在/etc内.
  9. 评论了etc/org.ops4j.pax.logging.cfg
  10. 中的所有内容
  11. etc/system.properties中添加logback.configurationFile="etc/logback.xml"
  1. Removed pax-logging-service by doing uninstall <pax-logging-bundle-id>
  2. Removed lib/bin/karaf-client.jar
  3. Inside lib placed the following jars:- jcl-over-slf4j-1.7.13, jul-to-slfj-17.13.jar, logback-classic-1.0.13.jar, logback-core-1.0.13.jar & osgi-over-slf4j-1.7.13.jar
  4. From /etc/startup.properties - removed references to pax-logging-service and pax-logging-api
  5. In etc/config.properties under org.osgi.framework.system.packages.extraadded the following packages:- ch.qos.logback; version="1.0.13", \ org.slf4j; version="1.7.13", \
  6. Created a logback.xml and and placed it inside /etc.
  7. Commented out everything in etc/org.ops4j.pax.logging.cfg
  8. In etc/system.properties add logback.configurationFile="etc/logback.xml"

我的logback.xml如下所示:-

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    </appender>
    <appender name="FILE"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/var/log/workflow/WorkFlow.%d{yyyy-MM-dd}.log
            </fileNamePattern>
            <maxHistory>7</maxHistory>
        </rollingPolicy>
    </appender>
    <root level="info">
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="FILE"/>
    </root>
</configuration>

Karaf信息报告以下内容:-

Karaf info reports the following:-

karaf@root>info
Karaf
  Karaf version               3.0.5
  Karaf home                  /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0
  Karaf base                  /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0
  Karaf etc                   /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0/etc
  OSGi Framework              org.apache.felix.framework - 4.2.1

但是进行了上述更改之后,我们没有在/var/log/workflow下看到任何日志文件,也没有看到信息日志.

But after making the above changes we are not seeing any log file under /var/log/workflow nor I am seeing the info logs.

推荐答案

要解决此问题,可以将pax-logging-logback jar放在karaf/servicemix的系统目录下,然后可以替换org.ops4j .pax.logging具有以下配置.

To resolve this issue, you could place your pax-logging-logback jar under the system directory of the karaf/servicemix and then you could replace your org.ops4j.pax.logging with below configuration.

# use logback config
org.ops4j.pax.logging.logback.config.file=${karaf.base}/config/logback.xml
# set default 'osgi' logging level
org.ops4j.pax.logging.DefaultServiceLog.level=WARN

并将您的logback.xml放在config文件夹下.

And place your logback.xml under config folder.

这篇关于将Logback与在ServiceMix下运行的Karaf 3.0.5一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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