[jboss-jira] [JBoss JIRA] Commented: (LOGTOOL-20) Detect parameters being inconsistent with log message template

Sanne Grinovero (JIRA) jira-events at lists.jboss.org
Wed Jun 15 14:00:29 EDT 2011


    [ https://issues.jboss.org/browse/LOGTOOL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608945#comment-12608945 ] 

Sanne Grinovero commented on LOGTOOL-20:
----------------------------------------

FYI, this is the output with my patch: those are clearly invalid messages from Infinispan, not in your validation. Or feel free to use them as tests.

{quote}[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ infinispan-core ---
[INFO] Compiling 613 source files to /home/sanne/workspaces/infinispan/infinispan/core/target/classes
Format specifier 's' Parameter count does not match for format 'Could not register object with name: %s (%s)'. Required: 2 Provided: 1
Format specifier 's' Parameter count does not match for format 'Found WebSphere TransactionManager factory class [%s], but couldn't invoke its static 'getTransactionManager' method'. Required: 1 Provided: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
{quote}

> Detect parameters being inconsistent with log message template
> --------------------------------------------------------------
>
>                 Key: LOGTOOL-20
>                 URL: https://issues.jboss.org/browse/LOGTOOL-20
>             Project: Log Tool
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Sanne Grinovero
>            Assignee: James Perkins
>             Fix For: 1.0.0.Beta8
>
>
> In both Infinispan and Hibernate we had reports of issues following the same patterns, as in code like:
> {code}
> @LogMessage(level = ERROR)
> @Message(id = 21, value = "Unable to synchronize source of %s for entity %s")
> void unableToSynchronizeSource(String indexName, @Cause Exception e);
> {code}
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list