简体   繁体   中英

Log4j2 with webstart

I have a webstart application that works fine with Log4j 1. Now I have migrated it to Log4J2. In Eclipse everything works fine. But if I start it as WebStart application, I always get the message:

 "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. " 

What I'm doing wrong?

My jnlp looks like:

<?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>

And the log4j.configuration is placed in the 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>

I found the soulution.

In log4j2 the propertyName was changed to log4j.configurationFile .

Thats the only thing I had to change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM