Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-3180

Provide MessageFormat based logging method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • configadmin-1.2.8
    • configadmin-1.4.0
    • Configuration Admin
    • None

    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.

      Attachments

        Activity

          People

            fmeschbe Felix Meschberger
            fmeschbe Felix Meschberger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: