[ 
https://issues.apache.org/jira/browse/FELIX-3180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger updated FELIX-3180:
-------------------------------------

    Description: 
Currently there is only a single logging method in the ConfigurationManager 
class:

    log(int level, String message, Throwable t)

This allows fixed strings to be logged at certain levels. If the messages are 
composed of dynamic content (e.g. configuration PIDs) this requires String 
concatenations and thus -- to prevent performance issues -- guarding the calls 
with isEnabled(int level) calls. This clutters the code.

To improve this situation a new logging method

   log(int level, String format, Object[] args)

should be added where format is a MessageFormat pattern and args is the 
MessageFormat argument vector. The message is generated calling

   MessageFormat.format(format, args)

and the result used as the message argument to the existing log method. If the 
last entry in the args array is a Throwable it is used as the Throwable 
argument to the log method. The Throwable is not removed from the argument 
vector so may (theoretically) also be referred to in the format pattern.

  was:
Currently there is only a single logging method in the ConfigurationManager 
class:

    log(int level, String message, Throwable t)

This allows fixed strings to be logged at certain levels. If the messages are 
composed of dynamic content (e.g. configuration PIDs) this requires String 
concatenations and thus -- to prevent performance issues -- guarding the calls 
with isEnabled(int level) calls. This clutters the code.

To improve this situation a new logging method

   log(int level, String format, Object[] args)

should be added where format is a MessageFormat pattern and args is the 
MessageFormat argument vector. The message is generated calling

   MessageFormat.format(format, args)

and the result used as the message argument to the existing log method. If the 
last entry in the args array is a Throwable it is used as the Throwable 
argument to the log method.

    
> Provide MessageFormat based logging method
> ------------------------------------------
>
>                 Key: FELIX-3180
>                 URL: https://issues.apache.org/jira/browse/FELIX-3180
>             Project: Felix
>          Issue Type: Improvement
>          Components: Configuration Admin
>    Affects Versions:  configadmin-1.2.8
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: configadmin-1.4.0
>
>
> Currently there is only a single logging method in the ConfigurationManager 
> class:
>     log(int level, String message, Throwable t)
> This allows fixed strings to be logged at certain levels. If the messages are 
> composed of dynamic content (e.g. configuration PIDs) this requires String 
> concatenations and thus -- to prevent performance issues -- guarding the 
> calls with isEnabled(int level) calls. This clutters the code.
> To improve this situation a new logging method
>    log(int level, String format, Object[] args)
> should be added where format is a MessageFormat pattern and args is the 
> MessageFormat argument vector. The message is generated calling
>    MessageFormat.format(format, args)
> and the result used as the message argument to the existing log method. If 
> the last entry in the args array is a Throwable it is used as the Throwable 
> argument to the log method. The Throwable is not removed from the argument 
> vector so may (theoretically) also be referred to in the format pattern.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to