1 Reply Latest reply on Oct 31, 2012 6:28 PM by 970961

    Debug logging when deploying using nativebundles

      I have a javafx 2 application that we're deploying to customers soon as a 64-bit or 32-bit Windows application, built the using "nativebundles=all" described elsewhere. We are logging errors, debug statements and info using slf4j. When I run the project through netbeans, the application can and does write the logging statements to a file, although when I build an exe of the application, the log statements are no longer being written to file.

      I can, however, see that the logger is working by running the application exe from the command prompt and adding the "/Debug" flag, as suggested here.

      In netbeans, the VM options for this project are,
      -enableassertions -Djava.util.logging.config.file="logging.properties" 
      I would like to be able to have the slf4j logger output write this info to file so that when the customer's app crashes, we can have them send us the log.

      Does anyone have any ideas for deploying an exe that can write debug info to file?

      netbeans 7.2.1
      jdk 1.7_08
        • 1. Re: Debug logging when deploying using nativebundles
          I have found a solution to this problem that involves the following additions to build.xml, where logging.properties is the properties file for slf4j, and the jvmarg values are from the VM arguments in netbeans:
          <fx:fileset dir="${basedir}" includes="logging.properties"/>
                  <fx:platform javafx="2.1+">
                      <fx:jvmarg value="-enableassertions"/>
                      <fx:jvmarg value="-Djava.util.logging.config.file=logging.properties"/>
          The fx:fileset line causes the logging.properties file to be copied to the installation directory on the target machine.

          All together, the following is the main part of the ant build script:
           <target name="-post-jfx-deploy">
                 <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}" 
                           outdir="${basedir}/${dist.dir}" embedJNLP="${javafx.deploy.embedJNLP}" outfile="${application.title}" verbose="true">
                    <fx:application name="${application.title}" mainClass="${javafx.main.class}" version="0.0.0"/>
                        <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
                        <fx:fileset dir="${basedir}" includes="logging.properties"/>
                    <fx:info title="${application.title}" vendor="${application.vendor}">
                      <fx:icon href="AppIcon.ico" kind="shortcut"
                              width="32" height="32" depth="8"/> 
                  <fx:platform javafx="2.1+">
                      <fx:jvmarg value="-enableassertions"/>
                      <fx:jvmarg value="-Djava.util.logging.config.file=logging.properties"/>
          <target name="-pre-jar">
              <unzip src="dist/lib/slf4j-api-1.6.4.jar" dest="${build.classes.dir}"/>  
              <unzip src="dist/lib/slf4j-jdk14-1.6.4.jar" dest="${build.classes.dir}"/>  
          Edited by: billy.clint99 on Oct 31, 2012 11:28 AM