[jboss-jira] [JBoss JIRA] (WFCORE-606) Accessing attribute message from class LoggingEvent always returns class String
James Perkins (JIRA)
issues at jboss.org
Wed Mar 18 18:43:19 EDT 2015
[ https://issues.jboss.org/browse/WFCORE-606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Perkins moved WFLY-3111 to WFCORE-606:
--------------------------------------------
Project: WildFly Core (was: WildFly)
Key: WFCORE-606 (was: WFLY-3111)
Issue Type: Enhancement (was: Bug)
Affects Version/s: (was: 8.0.0.Final)
Component/s: Logging
(was: Logging)
> Accessing attribute message from class LoggingEvent always returns class String
> -------------------------------------------------------------------------------
>
> Key: WFCORE-606
> URL: https://issues.jboss.org/browse/WFCORE-606
> Project: WildFly Core
> Issue Type: Enhancement
> Components: Logging
> 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 was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the jboss-jira
mailing list