7 Replies Latest reply on Sep 9, 2009 3:33 PM by brian.thomas

    Suppressing ANT Task Output

    brian.thomas Adobe Employee

      Is there a way I can suppress all the [flexPmd] INFO output from the ANT task?

       

      Thanks!

      Brian

        • 1. Re: Suppressing ANT Task Output
          Xavier Agnetti Adobe Employee

          You mean entirely?

           

          FYI, I move the log level from INFO to WARNING in RC4.

           

          Xavier

          1 person found this helpful
          • 2. Re: Suppressing ANT Task Output
            brian.thomas Adobe Employee

            When run from ANT, I'd like to be able to specify not to see output unless there was an error in the process of running FlexPMD. Are these log levels part of ANT's built in logging mechanism? Maybe I just need to dig in an learn more about how that works?

             

            Thanks!

            Brian

            • 3. Re: Suppressing ANT Task Output
              Xavier Agnetti Adobe Employee

              You can also specify you own logging configuration:

              http://java.ociweb.com/mark/programming/JavaLogging.html

               

              HTH

               

              Xavier

              • 4. Re: Suppressing ANT Task Output
                brian.thomas Adobe Employee

                From what I see on the link you posted, I either have to rebuild FlexPMD or pass a properties file to the VM running my build script in order to make this change. These seem like extreme steps for simply modifying the log level of one of the tasks in my script. Is this standard practice for an controlling output from an ANT task?

                 

                Apologies if this has left the realm of a FlexPMD question now, it may be my own lack of knowledge in java logging. Thanks for the help!

                • 5. Re: Suppressing ANT Task Output
                  Xavier Agnetti Adobe Employee

                        Java Logging can be configured in three ways.      

                  1. from Java code
                  2. from $JAVA_HOME/lib/logging.properties
                  3. from a property file located elsewhere

                        The last option is typically preferred.

                   

                  The configuration property file must be specified by       setting the system property       java.util.logging.config.file.       This can be done when an application is run by specifying       -Djava.util.logging.config.file={file-path}       on the java command.       When running from ant, add the following as a child of the       java task.
                                <sysproperty key="java.util.logging.config.file"           value="{file-path}"/>      

                   

                  So you will need to add

                  <sysproperty key="java.util.logging.config.file"           value="{file-path}"/>

                  in your task def, in your project build.xml

                   

                  You won't need to recompile FlexPMD. You only to modify your project build file.

                   

                  HTH

                   

                  Xavier

                  1 person found this helpful
                  • 6. Re: Suppressing ANT Task Output
                    brian.thomas Adobe Employee

                    Hi Xavier,

                     

                    I appreciate your patience in helping me dig through these ant/java issues!

                     

                    The problem is that sysproperty is only available in the java task, but not part of a taskdef or target. At the moment I'm trying to figure out if I can use java/taskdef to fork a new JVM where I can specify separate logging preferences.

                     

                    Brian

                    • 7. Re: Suppressing ANT Task Output
                      brian.thomas Adobe Employee

                      I switched to the command line version to make this happen. Here is what I ended up having success with:

                       

                      <java jar="${flexpmd.dir}/flex-pmd-command-line-${flexpmd.version}.jar" fork="true">
                           <jvmarg value="-Xmx256m"/>
                           <sysproperty key="java.util.logging.config.file" value="${flexpmd.dir}/logging.properties"/>
                           <arg value="-s"/>
                           <arg value="${src.dir}"/>
                           <arg value="-o"/>
                           <arg value="${dir.output.pmd}"/>
                           <arg value="-r"/>
                           <arg value="${dir.build}/pmd_ruleset.xml"/>
                           <classpath>
                                <pathelement location="flex-pmd-command-line-api-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/flex-pmd-ruleset-api-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/flex-pmd-ruleset-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/flex-pmd-core-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/as3-plugin-utils-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/as3-parser-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/pmd-4.2.2.jar"/>
                                <pathelement location="${flexpmd.dir}/commons-lang-2.4.jar"/>
                                <pathelement location="${flexpmd.dir}/flex-pmd-files-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/as3-parser-api-${flexpmd.version}.jar"/>
                                <pathelement location="${flexpmd.dir}/plexus-utils-1.0.2.jar"/>
                           </classpath>
                      </java>