[jboss-jira] [JBoss JIRA] (WFLY-3111) Accessing attribute message from class LogingEvent always returns class String

Jörg Brück (JIRA) issues at jboss.org
Thu Mar 13 15:18:10 EDT 2014


Jörg Brück created WFLY-3111:
--------------------------------

             Summary: Accessing attribute message from class LogingEvent always returns class String
                 Key: WFLY-3111
                 URL: https://issues.jboss.org/browse/WFLY-3111
             Project: WildFly
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Logging
    Affects Versions: 8.0.0.Final
         Environment: Windows 7, JDK 1.7.0_51
            Reporter: Jörg Brück
            Assignee: James Perkins
            Priority: Minor


After Changing from JBoss 5.1.0 to Wildfly the behaviour of my own written Log4j appenders
have changed while accessing LoggingEvent in the function "append" of
class ApppenderSkeleton.

The reason of this behaviour is the implementation of org.apache.log4j.spi.LoggingEvent

 public LoggingEvent(String fqnOfCategoryClass, Category logger, long timeStamp, Priority level, Object message, Throwable throwable) {
        this.fqnOfCategoryClass = fqnOfCategoryClass;
        this.logger = logger;
        this.level = level;
        logRecord = new ExtLogRecord(JBossLevelMapping.getLevelFor(level), message == null ? null : message.toString(), ExtLogRecord.FormatStyle.NO_FORMAT, fqnOfCategoryClass);

The Object message is converted to string and saved in Class ExtLogRecord.

Here the implementation of getMessage:

 public Object getMessage() {
        return logRecord.getMessage();
    }

Here the implementation of getMessage of ExtLogRecord 

public String getMessage() {
        return message;
    }

Because of this String is always returned.

If I understand this code right you can transfer every object to log4j, but you can not access this objects
in an appender because of the LoggingEvent constructor where method toString is called.

What is the reason of this change in contrast to jboss 5.1.0?
Of course I can reconstruct my objects from the string if I overwrite the toString method.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jboss-jira mailing list