You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Andrei Ivanov <an...@gmail.com> on 2016/03/11 15:23:09 UTC

Fwd: default value for empty ${web:contextPath}

Hi,
As I didn't receive any answer, I hope I can send my questions here.

Have a nice day.

---------- Forwarded message ----------
From: Andrei Ivanov <an...@gmail.com>
Date: Tue, Mar 8, 2016 at 5:12 PM
Subject: default value for empty ${web:contextPath}
To: log4j-user@logging.apache.org


Hello,
In the hope that someone else might have a better solution, I'm trying here.

As you can see in
http://stackoverflow.com/questions/35729590/log4j2-lookup-default-value-with-empty-contextpath,
I'm trying to set the filename of an appender using the context path
of the web application.

It works except the case when the app is deployed as the root of the
virtual host, case when the contextPath is an empty string (not null).

The default (specified in the Properties section) is only used when
the lookup returns null.

Is there anything else I can do besides writing a plugin just for this?

Regards

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


Re: default value for empty ${web:contextPath}

Posted by Ralph Goers <ra...@dslextreme.com>.
Yes, please create a Jira issue for this.  I have my doubts that anyone really wants to use the value if it is a zero length string.

Ralph

> On Mar 11, 2016, at 9:06 AM, Andrei Ivanov <an...@gmail.com> wrote:
> 
> Hi,
> Yes, I did see that it's only checking for null.
> 
> My question is how to proceed to obtain the behavior I need :-)
> Should I create a ticket with an enhancement request of some sort?
> Maybe others need this too.
> 
> Regards
> 
> 
> On Fri, Mar 11, 2016 at 6:03 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> The Interpolator is only checking for null. Likewise, I believe
>> StrSubstitutor will only use the default value if the lookup returns null,
>> not an empty string.
>> 
>> Ralph
>> 
>> On Mar 11, 2016, at 7:23 AM, Andrei Ivanov <an...@gmail.com> wrote:
>> 
>> Hi,
>> As I didn't receive any answer, I hope I can send my questions here.
>> 
>> Have a nice day.
>> 
>> ---------- Forwarded message ----------
>> From: Andrei Ivanov <an...@gmail.com>
>> Date: Tue, Mar 8, 2016 at 5:12 PM
>> Subject: default value for empty ${web:contextPath}
>> To: log4j-user@logging.apache.org
>> 
>> 
>> Hello,
>> In the hope that someone else might have a better solution, I'm trying here.
>> 
>> As you can see in
>> http://stackoverflow.com/questions/35729590/log4j2-lookup-default-value-with-empty-contextpath,
>> I'm trying to set the filename of an appender using the context path
>> of the web application.
>> 
>> It works except the case when the app is deployed as the root of the
>> virtual host, case when the contextPath is an empty string (not null).
>> 
>> The default (specified in the Properties section) is only used when
>> the lookup returns null.
>> 
>> Is there anything else I can do besides writing a plugin just for this?
>> 
>> Regards
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 



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


Re: default value for empty ${web:contextPath}

Posted by Andrei Ivanov <an...@gmail.com>.
Hi,
Yes, I did see that it's only checking for null.

My question is how to proceed to obtain the behavior I need :-)
Should I create a ticket with an enhancement request of some sort?
Maybe others need this too.

Regards


On Fri, Mar 11, 2016 at 6:03 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> The Interpolator is only checking for null. Likewise, I believe
> StrSubstitutor will only use the default value if the lookup returns null,
> not an empty string.
>
> Ralph
>
> On Mar 11, 2016, at 7:23 AM, Andrei Ivanov <an...@gmail.com> wrote:
>
> Hi,
> As I didn't receive any answer, I hope I can send my questions here.
>
> Have a nice day.
>
> ---------- Forwarded message ----------
> From: Andrei Ivanov <an...@gmail.com>
> Date: Tue, Mar 8, 2016 at 5:12 PM
> Subject: default value for empty ${web:contextPath}
> To: log4j-user@logging.apache.org
>
>
> Hello,
> In the hope that someone else might have a better solution, I'm trying here.
>
> As you can see in
> http://stackoverflow.com/questions/35729590/log4j2-lookup-default-value-with-empty-contextpath,
> I'm trying to set the filename of an appender using the context path
> of the web application.
>
> It works except the case when the app is deployed as the root of the
> virtual host, case when the contextPath is an empty string (not null).
>
> The default (specified in the Properties section) is only used when
> the lookup returns null.
>
> Is there anything else I can do besides writing a plugin just for this?
>
> Regards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>

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


Re: default value for empty ${web:contextPath}

Posted by Ralph Goers <ra...@dslextreme.com>.
The Interpolator is only checking for null. Likewise, I believe StrSubstitutor will only use the default value if the lookup returns null, not an empty string.

Ralph

> On Mar 11, 2016, at 7:23 AM, Andrei Ivanov <an...@gmail.com> wrote:
> 
> Hi,
> As I didn't receive any answer, I hope I can send my questions here.
> 
> Have a nice day.
> 
> ---------- Forwarded message ----------
> From: Andrei Ivanov <andrei.ivanov@gmail.com <ma...@gmail.com>>
> Date: Tue, Mar 8, 2016 at 5:12 PM
> Subject: default value for empty ${web:contextPath}
> To: log4j-user@logging.apache.org <ma...@logging.apache.org>
> 
> 
> Hello,
> In the hope that someone else might have a better solution, I'm trying here.
> 
> As you can see in
> http://stackoverflow.com/questions/35729590/log4j2-lookup-default-value-with-empty-contextpath,
> I'm trying to set the filename of an appender using the context path
> of the web application.
> 
> It works except the case when the app is deployed as the root of the
> virtual host, case when the contextPath is an empty string (not null).
> 
> The default (specified in the Properties section) is only used when
> the lookup returns null.
> 
> Is there anything else I can do besides writing a plugin just for this?
> 
> Regards
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org <ma...@logging.apache.org>
> For additional commands, e-mail: log4j-dev-help@logging.apache.org <ma...@logging.apache.org>