Check out lookups:
http://logging.apache.org/log4j/2.x/manual/lookups.html


On 22 August 2014 09:45, Manfred Dohmen <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Matt Sicker <[email protected]>

Reply via email to