I have a build file that is based on several taskdes as part of the build job. Ideally, I want to be able to provide a separate log4j configuration file for each, but these at least the Taskell items (for example, WebDockets and Jasper 2) use logger 4J as loggers, but at least, I want to be able to specify which log4j configuration file is used.
What I did to get to work was to put in front of the squares of the directory containing log4j.xml which I wanted to use taskdef. For example:
& lt; Target name = "define.jasper2"> & lt; Path id = "jspc.classpath"> & lt ;! - Put it first so that Jasper log-in 4 j.xml is created in the directory -> & lt; Pathelement location = "build" /> & lt; Fileset dir = "$ {tomcat.libs}"> .... & lt; / Fileset> & lt; Patient Location = "$ {log4j.jar}" /> .... & lt; / Path> & lt; Taskdef name = "jasper2" classname = "org.apache.jasper.jspC" classpathref = "jspc.classpath" /> and
I've verified that in fact, the "build" directory Is in front of the class and there is a log4j.xml in that directory. However, when I run Verbose mode with log4j in debug, then I think log4j is selecting log 4 j.xml which is in the current working directory , which I do not want to log4j The default log4j.xml appears to not use Classpath to resolve.
I am using log4j 1.2.8 (embedded within a larger framework, so I can not upgrade it) and some of these taskdefs build 1.0.3 to rely on commons logging Process Sun uses Java 5.
If I set ANT_OPTS = -Dog4j.configuration = build / log4j.xml
before running the ant, taskdefs load the desired log4j.xml correctly.
For the workdefs used to work, entering the "build" directory in front of classpath, I do not know what can I do to change - build.In the XML - Is the log4j configuration file used for the work done? To find log4j to find the correct log4j.xml file, there is no other way than setting ANT_OPTS to rearrange the files to move log 4 J.XML to the application from the current working directory to get log4j?
< I like using a code file url with sysproperty
I am able to specify a configuration file:
& lt; Java classname = "com.lunatech.MainClass" & gt; & Lt; Sysproperty key = "log4j.configuration" value = "file: src / log4j-debug.properties" /> & Lt; Classpath refid = "runtime.classpath" /> & Lt; / Java & gt;
Comments
Post a Comment