[logback-dev] [JIRA] Commented: (LBCLASSIC-182) Evaluable properties

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Tue Feb 2 00:40:33 CET 2010


    [ http://jira.qos.ch/browse/LBCLASSIC-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11505#action_11505 ] 

Ceki Gulcu commented on LBCLASSIC-182:
--------------------------------------

In logback 0.9.19-SNAPSHOT, the HOSTNAME variable is defined automatically. This feature was added only last week. 

Your suggestion is a more extensible mechanism. I would propose the addition of a new action called "define".  The XML syntax would be:

<define name="somename" class="some.class.defining.the.property">
  <parameterA>...</parameterA>
  <parameterB>...</parameterB>
</define>

The DefineAction would instantiate the class specified by the class attribute, push it onto the stack. That class would be expected to implement an interface, say PropertyDefiner (see below). Joran will take care of injecting the whatever parameters as given by the parameterA and parameterB elements onto the object found on top of the stack. The DefineAction would then pop the stack, get a value returned by the PropertyDefiner  instance and set a context property corresponding to the name attribute and the value returned by PropertyDefiner .

Here is a possible PropertyDefiner interface:

interface PropertyDefinier {
  public String getValue();
}

Let me know if any of the above is unclear.

> Evaluable properties
> --------------------
>
>                 Key: LBCLASSIC-182
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-182
>             Project: logback-classic
>          Issue Type: New Feature
>          Components: Other
>    Affects Versions: 0.9.18
>            Reporter: Aleksey Didik
>            Assignee: Ceki Gulcu
>            Priority: Minor
>
> Necessary to have properties which could be evaluated dynamically in time of configuration file read.
> Currently we have statical defined property values (by property tag or files) or we could get properties from System properties.
> In version 0.9.17 was made possibility to save formatted timestamp in property.
> May be possible to create property evaluator tag, to define some properties value dynamically?
> Something like this:
> <property name="hostName" evaluator="a.b.c.HostPropertyEvaluator">
>       <parameter name="host_type">ip</parameter>
> </property>
> Evaluator will be called on property initialization with listed parameters.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list