开发者

Reading JNDI properties from Glassfish JavaBeanFactory in Logback

We use logback and slf4j as logging libraries for our application and glassfish v3 as our application server. For the deployment time configuration properties we have created a "JNDI Custom Resource" in glassfish with the factory class as "org.glassfish.resources.custom.factory.JavaBeanFactory".

Specifying this factory class, glassfish creates an instance of the specified custom java bean (termed 开发者_开发百科as resource type in glassfish) and set the user specified properties in this class instance.

My question is - Is there a way to use one of the properties specified for this java bean in logback? i.e. Is there a way to tell logback (in the tag) to read properties from a java bean?

I intend to add a property in the java bean as the "log location" which I can then use in my logback.xml. This property can be set by the application installer team to configure the location of the log files.

Also since we already have one Custom JNDI resource defined in glassfish we intend to use the same one for all the configuration properties for our application.


If you use the SiftAppender, you can configure a discriminator as JNDIBasedDiscriminator and use JNDI resource value to specify the source of the log file.

However it should be too time consuming.

Related info may be found in: http://logback.qos.ch/manual/loggingSeparation.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜