Copy link to clipboard
Copied
Is there a way I can suppress all the [flexPmd] INFO output from the ANT task?
Thanks!
Brian
You can also specify you own logging configuration:
http://java.ociweb.com/mark/programming/JavaLogging.html
HTH
Xavier
Copy link to clipboard
Copied
You mean entirely?
FYI, I move the log level from INFO to WARNING in RC4.
Xavier
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
You can also specify you own logging configuration:
http://java.ociweb.com/mark/programming/JavaLogging.html
HTH
Xavier
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Java Logging can be configured in three ways.
- from Java code
- from $JAVA_HOME/lib/logging.properties
- 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 thejava
command. When running from ant, add the following as a child of thejava
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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>