[jboss-jira] [JBoss JIRA] Created: (JBLOGGING-63) Hexadecimal in log message error

Galder Zamarreño (JIRA) jira-events at lists.jboss.org
Wed May 18 09:03:00 EDT 2011


Hexadecimal in log message error
--------------------------------

                 Key: JBLOGGING-63
                 URL: https://issues.jboss.org/browse/JBLOGGING-63
             Project: JBoss Logging
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 3.0.0.Beta5-jboss-logging
            Reporter: Galder Zamarreño
            Assignee: David Lloyd


The following code fails with JBoss Logging:

String message = "Invalid magic number. Expected %#x and received %#x";
log.invalidMagicNumber(message, HotRodConstants.RESPONSE_MAGIC, magic);

With:

java.util.IllegalFormatConversionException: x != java.lang.String
	at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:3999)
	at java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:2709)
	at java.util.Formatter$FormatSpecifier.print(Formatter.java:2661)
	at java.util.Formatter.format(Formatter.java:2433)
	at java.util.Formatter.format(Formatter.java:2367)
	at java.lang.String.format(String.java:2769)
	at org.jboss.logging.Log4jLogger.doLogf(Log4jLogger.java:48)
	at org.jboss.logging.Logger.logf(Logger.java:2130)
	at org.infinispan.client.hotrod.logging.Log_$logger.invalidMagicNumber(Log_$logger.java:820)
	at org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:106)
	at org.infinispan.client.hotrod.impl.operations.AbstractKeyValueOperation.sendPutOperation(AbstractKeyValueOperation.java:70)
	at org.infinispan.client.hotrod.impl.operations.PutOperation.executeOperation(PutOperation.java:49)
	at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:62)
	at org.infinispan.client.hotrod.impl.RemoteCacheImpl.put(RemoteCacheImpl.java:201)
	at org.infinispan.CacheSupport.put(CacheSupport.java:51)
	at org.infinispan.client.hotrod.ServerErrorTest.testErrorWhileDoingPut(ServerErrorTest.java:87)

Whereas the following works:

log.info(String.format("Invalid magic number. Expected %#x and received %#x", HotRodConstants.RESPONSE_MAGIC, magic));

And prints:

2011-05-18 14:58:43,929 INFO  [HotRodOperation] (main) Invalid magic number. Expected 0xa1 and received 0xa1

It seems like JBoss Logging is doing something that avoids hexadecimals to be shown in the same way as you'd do with String.format().

Maybe JBoss Logging is expecting something different here?

--
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