Details
-
Enhancement
-
Resolution: Won't Do
-
Minor
-
None
-
None
-
None
Description
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.