Use web application name in logback configuration

Hi, Can I use my Spring web application name in the logback configuration dynamically? I know logback can read from properties file specified under <property> or it can read from the system variables but is it possible to use some dynamic data like web application name in the configuration? Thanks, Pradnya

Yes, you can define properties dynamically. See http://logback.qos.ch/manual/configuration.html#definingPropsOnTheFly On 22.11.2010 16:39, Pradnya Gawade wrote:
Hi,
Can I use my Spring web application name in the logback configuration dynamically? I know logback can read from properties file specified under <property> or it can read from the system variables but is it possible to use some dynamic data like web application name in the configuration?
Thanks, Pradnya

Thank you. Yes, I was looking for some thing like this. - Pradnya On Mon, Nov 22, 2010 at 12:38 PM, Ceki Gulcu <ceki@qos.ch> wrote:
Yes, you can define properties dynamically. See http://logback.qos.ch/manual/configuration.html#definingPropsOnTheFly
On 22.11.2010 16:39, Pradnya Gawade wrote:
Hi,
Can I use my Spring web application name in the logback configuration dynamically? I know logback can read from properties file specified under <property> or it can read from the system variables but is it possible to use some dynamic data like web application name in the configuration?
Thanks, Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Hi, I am having difficulty in defining the web app name property. I think I am doing some thing wrong when specifying the value for property name from the class implementing the PropertyDefiner interface. My configuration for property definition looks like: *<define name="WEBAPP" class="org.akaza.openclinica.control.WebAppNamePropertyDefiner"> <aProperty>webAppProperty</aProperty> </define>* and the class implementing PropertyDefiner interface looks like: *import ch.qos.logback.core.PropertyDefinerBase; /** * @author pgawade Class defined to return the web application name */ public class WebAppNamePropertyDefiner extends PropertyDefinerBase { static String webAppProperty; public WebAppNamePropertyDefiner() { // super(); } public WebAppNamePropertyDefiner(String webAppName) { if (webAppProperty == null) { webAppProperty = webAppName; } } public String getPropertyValue() { return webAppProperty; } }* I am not clear about what should me mentioned for element <aProperty>. Or it should element name be actual property name? I did not get any example of this on internet. Any inputs? Is it possible to define multiple properties in the same class *WebAppNamePropertyDefiner *or there needs to be one class per property definition? On a side note, I realized that probably I can put the web application name in MDC context and use that variable in the configuration. Thanks, Pradnya On Mon, Nov 22, 2010 at 1:22 PM, Pradnya Gawade <pradnya.gawade7@gmail.com>wrote:
Thank you. Yes, I was looking for some thing like this.
- Pradnya
On Mon, Nov 22, 2010 at 12:38 PM, Ceki Gulcu <ceki@qos.ch> wrote:
Yes, you can define properties dynamically. See http://logback.qos.ch/manual/configuration.html#definingPropsOnTheFly
On 22.11.2010 16:39, Pradnya Gawade wrote:
Hi,
Can I use my Spring web application name in the logback configuration dynamically? I know logback can read from properties file specified under <property> or it can read from the system variables but is it possible to use some dynamic data like web application name in the configuration?
Thanks, Pradnya
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (2)
-
Ceki Gulcu
-
Pradnya Gawade