我正在使用eclipse osgi jar。 如何将由osgi生成的日志重定向到文件?配置eclipse osgi日志
每当我启动osgi框架,它会生成一个类似1317008078357.log的日志。如何将此日志重定向到custome文件。我需要使用log4j作为osgi包吗?什么是log4j.xml配置?
日志文件包含:
!SESSION 2011-09-26 11:34:38.232 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -configuration D:/CommonNBI/Trunck/release_structure/server/nbi/snmp/conf -console
!ENTRY org.eclipse.osgi 2 0 2011-09-26 11:34:44.029
!MESSAGE While loading class .... may not be fully initialized.
!STACK 0
org.osgi.framework.BundleException: State change in progress for bundle ..
感谢您的答复。但是,“osgi.logfile”参数在页面中不存在http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options html的。看来,月蚀想要隐藏它!另外,您可以告诉我们如何给日志文件一个合适的名称,因为我们可以在log4j中为日志文件名分配日期。我不想放一个静态名称。我已经在谷歌搜索“osgi.logfile”进一步的细节,但谷歌也未能找到任何东西! – Sanmoy
我在当前项目中使用osgi.logfile。我使用文件的静态名称:例如-Dosgi.logfile =。/ config/equinox.log –
请注意,日志文件中的数字是时间戳日期(即历元以来的秒数)。如果你愿意,可以很容易地转换成日期。 – AlBlue