Logback config with properties

Brent Putman putmanb at georgetown.edu
Mon Jun 23 21:19:17 EDT 2014


On 6/23/14, 7:53 PM, Tom Zeller wrote:
> Thanks, Brent.
>
> Do you know if it is possible, given an ApplicationContext set via
> ApplicationContextAware, to iterate over all properties by name ?

No, not that I know of, and I don't see anything obvious glancing at the
relevant interfaces (Environment, PropertySources, etc).  But as with
all things Spring, it's entirely possible there's some way to do it....

I just glanced at what you did with the LogbackLoggingService. If there
is no way to iterate the context properties like you asked about: IMHO,
rather than hardcoding 'idp.home' into the Java code, it might be
cleaner to externalize the specific set of properties that you want to
provide to Logback by wiring up a Properties instance in the Spring
config (with values coming from property replacement) and injecting that
straight into the LLS.

Something like the below, and then inject that into the LLS directly. 
That way you get to pick exactly what you want to expose to Logback,
which I imagine is only a handful of props (maybe even 1?).

    <util:properties>
        <prop key="idp.home">${idp.home}</prop>
    </util:properties>

Then the code in the LLS is very simple and generic.  Just my $.02.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20140623/61473ec8/attachment.html 


More information about the dev mailing list