Uploaded image for project: 'Log Tool'
  1. Log Tool
  2. LOGTOOL-20

Detect parameters being inconsistent with log message template

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Beta8
    • None
    • None

      In both Infinispan and Hibernate we had reports of issues following the same patterns, as in code like:

      @LogMessage(level = ERROR)
      @Message(id = 21, value = "Unable to synchronize source of %s for entity %s")
      void unableToSynchronizeSource(String indexName, @Cause Exception e);
      

      People might do mistakes in the string template, forget to pass enough parameters, or not use the positional %1$s variants. We can hardly write tests to cover all log messages, while I think it would be quite cool if the annotation processor could verify messages consistency with parameters at compile time.
      It would be just awesome if it could check for type consistency as well.

              jperkins-rhn James Perkins
              sgrinove Sanne Grinovero (Inactive)
              Archiver:
              rhn-support-sthamilt Stacey Hamilton

                Created:
                Updated:
                Resolved:
                Archived: