Jump to content

Recommended Posts

Posted

 Hello,

I'd like to configure a log4j appender for the compilation of my .jrxml files, i.e. the jrc Ant task. I'm sure that I have to put the log4j.properties file on my classpath. I'm unsure how to specify that in my build.xml (sse code).

When I do include my log4j.properties file in my classpath for the jrc task, I get a ZipException because Ant is expecting the properties file to be a jar or zip:

      [jrc] Compiling 2 report design files.
Unable to obtain resource from C:\Documents and Settings\SSolomon\my-report-mana
ger\resources\log4j.properties: java.util.zip.ZipException: error in opening zip
 file
      [jrc] Unable to obtain resource from C:\Documents and Settings\SSolomon\my
-report-manager\resources\log4j.properties:
      [jrc] java.util.zip.ZipException: error in opening zip file
      [jrc]     at java.util.zip.ZipFile.open(Native Method)
      [jrc]     at java.util.zip.ZipFile.<init>(ZipFile.java:127)
      [jrc]     at java.util.jar.JarFile.<init>(JarFile.java:135)
      [jrc]     at java.util.jar.JarFile.<init>(JarFile.java:99)
      [jrc]     at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLo
ader.java:1002)
      [jrc]     at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoade
r.java:883)
 
What is the proper way to put the log4j.properties file on the classpath for the jrc task?
 
Thanks
Code:
<?xml version="1.0" encoding="UTF-8"?><project name="ProjectManager" default="default" basedir=".">    <!-- Define the classpath used for report compilation -->    <path id="jrc.classpath">        <fileset dir="lib" includes="*.jar"/>    </path>    <path id="log4j.classpath">        <file file="resources/log4j.properties"/>    </path>    <target name="compile" description="Compile all Jasper Reports Definitions">	<mkdir dir="./build/reports"/>	<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">               <classpath refid="jrc.classpath"/>               <classpath refid="log4j.classpath"/>	</taskdef>        <jrc destdir="./build/reports">            <src>                <fileset dir="src/main/jasperreports">                    <include name="*.jrxml"/>                </fileset>            </src>            <classpath refid="jrc.classpath"/>        </jrc>    </target>    <target name="clean">        <delete dir="./build" />    </target></project>
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

Create a log4j.properties file, create a jar file (using the jar command) containing the log4j.properties file at the root of the jar. Include this jar in the jrc task classpath. Et voila, compiler logging.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...