You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jason Novotny <ja...@gmail.com> on 2015/01/08 01:50:06 UTC

how to override log4j.properties bundled in jar

Hi,

I have a WAR file that contains a jar file that has a log4j.properties 
file baked into it. I want to override that with my own production 
log4j.properties file.

I thought it would be sufficient to just add

-Dlog4j.configuration=/tmp/log4j.properties to my java command line 
parameters

but I see that doesn't work. Any ideas on how to do this?

Thanks, Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: how to override log4j.properties bundled in jar

Posted by Jacob Kjome <ho...@visi.com>.
Actually, that should work if memory serves me correctly.  Are you saying the 
one in the jar file still gets picked up?  One thing you might need to do is 
to define the path as a fully qualified URL, such as....

-Dlog4j.configuration=file:/tmp/log4j.properties

...or, for windows....

-Dlog4j.configuration=file:C:/tmp/log4j.properties


If that doesn't work, for whatever reason, you can stick a log4j.properties 
file into WEB-INF/classes, which will get picked up before the one in the jar, 
therefore the one in the jar will be ignored.


Jake

On Wed, 07 Jan 2015 16:50:06 -0800
 Jason Novotny <ja...@gmail.com> wrote:
> Hi,
> 
> I have a WAR file that contains a jar file that has a log4j.properties file 
>baked into it. I want to override that with my own production 
>log4j.properties file.
> 
> I thought it would be sufficient to just add
> 
> -Dlog4j.configuration=/tmp/log4j.properties to my java command line 
>parameters
> 
> but I see that doesn't work. Any ideas on how to do this?
> 
> Thanks, Jason
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org