To follow up, this worked as expected
<File name="F" fileName="${sys:proc:-unknown.log}">

If system property "proc" is not defined then a file named "unknown.log" is 
created. 

This is documented in StrSubstitutor but may be good to emphasize on the 
lookups manual page. 


Sent from my iPhone

> On 29 Nov 2016, at 10:05, Gary Gregory <[email protected]> wrote:
> 
> I know the separator is a problem in some cases. But I though it was the
> minus sign, which causes problems like
> https://issues.apache.org/jira/browse/LOG4J2-1013 which I am not sure how
> to best solve :-(
> 
> Gary
> 
>> On Mon, Nov 28, 2016 at 4:52 PM, Remko Popma <[email protected]> wrote:
>> 
>> Aha!
>> Looks like <File name="F" fileName="${sys:proc}"> works, but
>> <File name="F" fileName="${sys:proc:unknown}"> doesn't.
>> For some reason I thought a default value could be specified after a
>> second colon ':'.
>> I guess I got confused with something else.
>> 
>> I can see the FileAppender plugin being initialized with the resolved
>> lookup string. The status log doesn't show that the lookup was invoked. It
>> may be good to improve this.
>> 
>> Anyway, this solves my immediate problem.
>> 
>> Thanks!
>> 
>> Sent from my iPhone
>> 
>>> On 28 Nov 2016, at 22:50, Apache <[email protected]> wrote:
>>> 
>>> Using a single $ works as that is resolved during configuration. As I
>> recall, ‘$${nnn:…}’ does not work.  I specify ${sys:catalina.home} in the
>> filename for all of my web apps.
>>> 
>>> Ralph
>>> 
>>>> On Nov 27, 2016, at 11:10 PM, Remko Popma <[email protected]>
>> wrote:
>>>> 
>>>> Does the FileAppender support lookups in the configured file name?
>>>> 
>>>> Something like
>>>> <File name="F" fileName="${sys:procName:unknown}">
>>>> ...
>>>> 
>>>> Does a JIRA ticket already exist for this? (Couldn't find it...)
>>>> 
>>>> I have a number of processes that are configured almost identically;
>> with the log4j2.xml inside one of the jars. Trying to let the different
>> processes log to separate files. Not as easy as I thought it would be. :-)
>>>> 
>>>> Remko
>>>> 
>>>> Sent from my iPhone
>>>> ---------------------------------------------------------------------
>>>> 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]
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected]
> Java Persistence with Hibernate, Second Edition
> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
> 
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
> JUnit in Action, Second Edition
> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
> 
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
> Spring Batch in Action
> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to