[
https://issues.jboss.org/browse/WFLY-3111?page=com.atlassian.jira.plugin....
]
James Perkins commented on WFLY-3111:
-------------------------------------
The only way this will work currently is if you include your own version of log4j. I'm
assuming of course you're including a log4j configuration file in your deployment. If
you're attempting to use an appender as a custom-handler I don't think it will be
possible to work. Have a look at
https://docs.jboss.org/author/display/WFLY8/How+To#HowTo-HowdoIuselog4j.p...
to see how to include your own version of log4j.
Accessing attribute message from class LoggingEvent 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