[logback-user] Issue with PropertyDefinerBase

Basu basavaraj2kalloli at gmail.com
Mon Oct 29 09:39:58 CET 2012


Hi,

I have been trying to setup a property 'applicationUrl' which can be
evaluated at runtime. I have created the PropertyConfigurer as below:

public class LogbackApplicationURLPropertyDefiner
    extends PropertyDefinerBase {

    public String getPropertyValue() {
        LoggerContext lc = (LoggerContext)
LoggerFactory.getILoggerFactory();
        lc.putProperty();

        return ( UserContext.getUserContext() == null
            ? "User context was null, application url could not be
determined"
            : UserContext.getUserContext().getApplicationUrl() );
    }
}

and in the xml as:

<define name="applicationUrl"
class="com.iblogix.analytic.logging.LogbackApplicationURLPropertyDefiner"/>

But it looks like the value is evaluated only once during the logback
configruation. What I want is that the value be evaluated everytime it is
acessed by someone. Is that possible using what i have right now?

Thanks,
Basu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121029/cbf9faf8/attachment.html>


More information about the Logback-user mailing list