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 Manfred Dohmen <ma...@gmail.com> on 2014/08/22 16:45:42 UTC

log4j2 and ch.qos.logback.core.PropertyDefinerBase

Hello,

crossposting from here:
http://stackoverflow.com/q/25426738/492462

Logback's PropertyDefinerBase allows to use dynamic properties within 
logback.xml. I use this to configure a target directory for a 
FileAppender with values from my application config. In my case there's 
an enum instance that contains the value I want to use:

public String getPropertyValue() {return MyConfigEnum.LOGDIR.value();}

Relevant parts of logback.xml:

<fileNamePattern>${logdir}/test.log</fileNamePattern>

... and:

<define name="logdir" class="com.example.MyLogdirDefiner" />

This idiom is now needed for log4j 2. How can I apply the value of 
MyConfigEnum.LOGDIR in a log4j2.xml?

I don't want to set a property upon application start.

Regards!



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


Re: log4j2 and ch.qos.logback.core.PropertyDefinerBase

Posted by Manfred Dohmen <ma...@gmail.com>.
On 08/22/2014 08:24 PM, Matt Sicker wrote:
> Check out lookups:
> http://logging.apache.org/log4j/2.x/manual/lookups.html

Thanks Matt, I now implemented an own StrLookup like the 
SystemPropertiesLookup.

Regards,
mdo



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


Re: log4j2 and ch.qos.logback.core.PropertyDefinerBase

Posted by Matt Sicker <bo...@gmail.com>.
Check out lookups:
http://logging.apache.org/log4j/2.x/manual/lookups.html


On 22 August 2014 09:45, Manfred Dohmen <ma...@gmail.com> wrote:

> Hello,
>
> crossposting from here:
> http://stackoverflow.com/q/25426738/492462
>
> Logback's PropertyDefinerBase allows to use dynamic properties within
> logback.xml. I use this to configure a target directory for a FileAppender
> with values from my application config. In my case there's an enum instance
> that contains the value I want to use:
>
> public String getPropertyValue() {return MyConfigEnum.LOGDIR.value();}
>
> Relevant parts of logback.xml:
>
> <fileNamePattern>${logdir}/test.log</fileNamePattern>
>
> ... and:
>
> <define name="logdir" class="com.example.MyLogdirDefiner" />
>
> This idiom is now needed for log4j 2. How can I apply the value of
> MyConfigEnum.LOGDIR in a log4j2.xml?
>
> I don't want to set a property upon application start.
>
> Regards!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
Matt Sicker <bo...@gmail.com>