New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a uniform Log4j 1.x message factory #767
Conversation
((ExtendedLogger) logger).logMessage(fqcn, lvl, null, msg, t); | ||
} else { | ||
final ObjectRenderer renderer = get(message.getClass()); | ||
final Message msg = message instanceof Message ? (Message) message | ||
: renderer != null ? new RenderedMessage(renderer, message) : new ObjectMessage(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RenderedMessage
case is omitted, since this would require a stateful MessageFactory
(per category).
Anyway there is currently no way to add elements to the RendererMap
.
58ef81c
to
bdcf321
Compare
* @param map a generic map | ||
* @return a {@link StringMap} | ||
*/ | ||
public static SortedArrayStringMap fromGenericMap(final Map<?, ?> map) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed, would you check your tests against HEAD, without any main changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garydgregory: after your fix it is not needed anymore.
This PR provides a factory method that decides the type of message based on the runtime type of the logged object (cf. [LOG4J2-3080]( https://issues.apache.org/jira/browse/LOG4J2-3080)). These are applied to both `maybeLog` and `forceLog`.
bdcf321
to
2858c49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR provides a factory method that decides the type of message based on the runtime type of the logged object (cf. LOG4J2-3080).
Before the implementations of
maybeLog
andforcedLog
created different types of messages.