带有 webstart 的 Log4j2
Log4j2 with webstart
我有一个与 Log4j 1 配合使用的 webstart 应用程序。
现在我已经将它迁移到 Log4J2。在 Eclipse 中一切正常。但是如果我将它作为 WebStart 应用程序启动,我总是会收到消息:
"ERROR StatusLogger No log4j2 configuration file found.
Using default configuration:
logging only errors to the console.
Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level'
to TRACE to show Log4j2 internal initialization logging.
"
我做错了什么?
我的 jnlp 看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8085/MyApp/" href="client.jnlp">
<information>
<title>My new App</title>
<vendor>MyCompany</vendor>
<icon kind="splash" href="img/splash.jpg"/>
<icon href="img/logo.png"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<extension name="dependencies" href="dependencies.jnlp" />
<extension name="properties" href="properties.jnlp" />
</resources>
<application-desc main-class="com.client.MyApp">
<argument>-webstart</argument>
</application-desc>
</jnlp>
而 log4j.configuration 放在 properties.jnlp:
<jnlp spec="1.0+" href="properties.jnlp">
<information>
<title>My new App</title>
<vendor>MyCompany</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<!-- Properties -->
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<property name="client.ini" value="http://localhost:8085/MyApp/cfg/client.ini"/>
<property name="log4j.configuration" value="http://localhost:8085/MyApp/cfg/log4j2.xml"/>
</resources>
<component-desc/>
</jnlp>
我找到了解决方案。
在 log4j2 中,propertyName 已更改为 log4j.configurationFile。
这是我唯一需要更改的地方。
我有一个与 Log4j 1 配合使用的 webstart 应用程序。 现在我已经将它迁移到 Log4J2。在 Eclipse 中一切正常。但是如果我将它作为 WebStart 应用程序启动,我总是会收到消息:
"ERROR StatusLogger No log4j2 configuration file found.
Using default configuration:
logging only errors to the console.
Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level'
to TRACE to show Log4j2 internal initialization logging.
"
我做错了什么?
我的 jnlp 看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8085/MyApp/" href="client.jnlp">
<information>
<title>My new App</title>
<vendor>MyCompany</vendor>
<icon kind="splash" href="img/splash.jpg"/>
<icon href="img/logo.png"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<extension name="dependencies" href="dependencies.jnlp" />
<extension name="properties" href="properties.jnlp" />
</resources>
<application-desc main-class="com.client.MyApp">
<argument>-webstart</argument>
</application-desc>
</jnlp>
而 log4j.configuration 放在 properties.jnlp:
<jnlp spec="1.0+" href="properties.jnlp">
<information>
<title>My new App</title>
<vendor>MyCompany</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<!-- Properties -->
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<property name="client.ini" value="http://localhost:8085/MyApp/cfg/client.ini"/>
<property name="log4j.configuration" value="http://localhost:8085/MyApp/cfg/log4j2.xml"/>
</resources>
<component-desc/>
</jnlp>
我找到了解决方案。
在 log4j2 中,propertyName 已更改为 log4j.configurationFile。
这是我唯一需要更改的地方。