The reason that it is a bad idea to place log4j.properties
in a jar file is that it may be in multiple jar files, - so which
one is the correct log4j. For example there is a log4j.properties
in bsf.jar (2.4) and in cobertura.jar.

As to where else to place the log4j properties file - it depends!

1) do not use log4j.
2) if the java app is started from a bash script, add the log4j.propeties
    to a directory and add that dit to the class path for the app.
3) if the java app is started from an ant script, use the classpath element
    for junti and for <java>
4) if the java app is started by java -jar, place the log4j.propertes
    in a non-default location and use the log4j api to set the configuration.

Peter


On Tue, May 20, 2008 at 5:22 PM, Tom Corcoran <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot Peter. We were putting it in the top level as log4j needs to
> find it on the class path. is there another way of setting log4j up?
>
>
> Peter Reilly-2 wrote:
>>
>> 1) placing log4j.properties in the top level of a jar file is a crime
>>     against good practice
>>
>> 2) do it by:
>>   <jar destfile="${jar.dir}/${jar.name}.jar">
>>       <fileset dir="${classes.dir}"/>
>>      <fileset dir="."  includes="**/properties/*.groovy" />
>>      <fileset dir="properties" includes="log4j.properties"/>
>> </jar>
>>
>>
>> Peter
>>
>>
>> On Mon, May 19, 2008 at 5:29 PM, Tom Corcoran <[EMAIL PROTECTED]> wrote:
>>>
>>> Doing the following creates a sub directory properties in my jar with my
>>> groovy property files, as desired:
>>>
>>> <jar destfile="${jar.dir}/${jar.name}.jar" update="no"
>>> basedir="${classes.dir}">
>>> <fileset dir="."><include name="**/properties/*.groovy" /></fileset>
>>> </jar>
>>>
>>> However, I have a log4j.properties file which is also located in this the
>>> properties directory on my _file system_ but I want it in the root level
>>> of
>>> the jar (so it can be found in the path) and not in the properties
>>> directory. how can I do that?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Strip-directory-from-fileset-includesfile-jar-location-tp17322626p17322626.html
>>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Strip-directory-from-fileset-includesfile-jar-location-tp17322626p17344510.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to