Log4j2与webstart

时间:2017-09-29 09:18:35

标签: java log4j2 java-web-start

我有一个适用于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>

1 个答案:

答案 0 :(得分:0)

我找到了洗液。

在log4j2中,propertyName已更改为 log4j.configurationFile

这是我唯一需要改变的地方。