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 OOMS DIRK <Ex...@siemens.be> on 2005/02/16 17:17:01 UTC
using properties inside log4j configs
Hello,
I would like to have several processes use the same log4j.xml, but that e.g.
the name of the log file to which they output is slightly different. I tried
to achieve this by putting a System Property "processName" into the
description of a FileAppender in log4j.xml
<param name="FileNamePattern"
value="/var/log/${processName}-log.%d{yyyy-MM}.gz"/>
I also tried to set an MDC value "processName" and do (in analogy to the %d)
<param name="FileNamePattern"
value="/var/log/%X{processName}-log.%d{yyyy-MM}.gz"/>
But none of this seems to work/be supported.
Do people have any other suggestion to fulfil my requirement?
Cheers,
dirk
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: using properties inside log4j configs
Posted by Jacob Kjome <ho...@visi.com>.
When you say "several processes", do you mean separate VM's? If so, then
providing a system propery before configuration should work just fine in your
case. Please clarify.
Jake
Quoting OOMS DIRK <Ex...@siemens.be>:
> Hello,
>
> I would like to have several processes use the same log4j.xml, but that e.g.
> the name of the log file to which they output is slightly different. I tried
> to achieve this by putting a System Property "processName" into the
> description of a FileAppender in log4j.xml
>
> <param name="FileNamePattern"
> value="/var/log/${processName}-log.%d{yyyy-MM}.gz"/>
>
> I also tried to set an MDC value "processName" and do (in analogy to the %d)
> <param name="FileNamePattern"
> value="/var/log/%X{processName}-log.%d{yyyy-MM}.gz"/>
>
> But none of this seems to work/be supported.
>
> Do people have any other suggestion to fulfil my requirement?
>
> Cheers,
> dirk
>
> ---------------------------------------------------------------------
> 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
Re: using properties inside log4j configs
Posted by Sushil Sureka <su...@gmail.com>.
Actually I am using the system property and it works for me. Also I am
using the same syntax ${<<property name>>} as you do. Are you sure
your property is set? Also turning on the log4j debug flag might help.
Sushil
On Wed, 16 Feb 2005 17:17:01 +0100, OOMS DIRK <Ex...@siemens.be> wrote:
> Hello,
>
> I would like to have several processes use the same log4j.xml, but that e.g.
> the name of the log file to which they output is slightly different. I tried
> to achieve this by putting a System Property "processName" into the
> description of a FileAppender in log4j.xml
>
> <param name="FileNamePattern"
> value="/var/log/${processName}-log.%d{yyyy-MM}.gz"/>
>
> I also tried to set an MDC value "processName" and do (in analogy to the %d)
> <param name="FileNamePattern"
> value="/var/log/%X{processName}-log.%d{yyyy-MM}.gz"/>
>
> But none of this seems to work/be supported.
>
> Do people have any other suggestion to fulfil my requirement?
>
> Cheers,
> dirk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
Thanks
Sushil
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org