[logback-user] Externalized Logback configuration for web applications

ceki ceki at qos.ch
Fri Feb 1 19:26:03 CET 2013


Hello Richard,

In principle, you don't have to do anything to get this working, no 
context listeners or filters. There are no steps involved other than 
defining a value in web.xml and fetching the defined value as explained 
in [1]. Please give it a try.

[1] http://logback.qos.ch/manual/configuration.html#insertFromJNDI

-- 
Ceki
65% of statistics are made up on the spot

On 01.02.2013 19:21, Richard Sand wrote:
> Hi Ceki - I guess I was looking for another mechanism than JNDI to expose
> those, simply to avoid needing the extra context listeners and servlet
> filter needed for performance.
>
> Is there some magic we could do when logging is initialized to see if it's
> being loaded by a servlet classloader and finding the base servlet and
> grabbing the servletcontext? Or am I grasping at straws here?
>
> Thanks!
>
> Richard Sand | Managing Director
> PO Box 91824 | Austin | Texas 78709-1824 | USA
> Office: +1 888 612 8820 ext 02 | Fax: +1 866 304 3754
> Mobile: +1 267 984 3651
>
>
>
> -----Original Message-----
> From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On
> Behalf Of ceki
> Sent: Friday, February 01, 2013 1:12 PM
> To: logback users list
> Subject: Re: [logback-user] Externalized Logback configuration for web
> applications
>
>
> Sure. Values for variables can be fetched from JNDI. See [1]. Values
> defined in <context-param> inside the web.xml are available via JNDI. As
> far as I know, all web containers export values defined in <context-param>
> inside the web.xml via JNDI.
>
> Please try the method outlined in [1] and kindly report back on this
> mailing list.
>
> [1] http://logback.qos.ch/manual/configuration.html#insertFromJNDI
>
>
> On 31.01.2013 20:40, Richard Sand wrote:
>> Is it possible to grab the value of the filename from the context of
>> the web application itself, e.g. a <context-param> inside the web.xml?
>> Idea here is that this can be overridden by a context.xml at
>> deployment time, to externalize the filename without disturbing the
>> web application archive, and without needing JNDI.
>>
>> e.g. so:
>>
>> <include file="/opt/logback-A.xml">
>>
>> becomes:
>>
>> <include file="${some-value-from-deployment-descriptor}">
>>
>> Thanks!
>>
>> Best regards,
>>
>> Richard
>>




More information about the Logback-user mailing list