Skip to content
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

LazyResolutionMessage does not implement proper toString #21265

Closed
spring-projects-issues opened this issue Apr 13, 2018 · 1 comment
Closed
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

John opened SPR-16724 and commented

When JMS listerner configured in spring reads JMS from queue/topic it can log the message just by enabling corresponding logger.
For produced (outgoing) messages it works without problem.
For consumed (incoming) messages logging is done by MessagingMessageListenerAdapter in method: onMessage but it is logged after transformation to MessagingMessage which is by default LazyResolutionMessage which means it breaks logging as no payload or headers are logged from this message class.
Is there some easy way to log messages and avoud this lazy message?


Affects: 4.3.10, 5.0.5

@spring-projects-issues spring-projects-issues added in: messaging Issues in messaging modules (jms, messaging) status: waiting-for-triage An issue we've not yet triaged or decided on type: enhancement A general enhancement and removed type: enhancement A general enhancement labels Jan 11, 2019
@snicoll snicoll changed the title Incoming JMS not logged correctly by MessagingMessageListenerAdapter [SPR-16724] MessagingMessageListenerAdapter does not log incoming JMS message properly Sep 19, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 19, 2023
@snicoll snicoll added this to the 6.x Backlog milestone Sep 19, 2023
@snicoll snicoll changed the title MessagingMessageListenerAdapter does not log incoming JMS message properly LazyResolutionMessage does not implement proper toString Sep 19, 2023
@snicoll snicoll self-assigned this Sep 19, 2023
@snicoll
Copy link
Member

snicoll commented Sep 19, 2023

Thanks for the report. Yes, I can see how that's really annoying that the toString doesn't log the message properly. I've scheduled it for 6.x

@snicoll snicoll modified the milestones: 6.x Backlog, 6.0.13 Sep 26, 2023
@jhoeller jhoeller added the for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x label Oct 9, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x Marks an issue as a candidate for backport to 5.3.x labels Oct 9, 2023
@jhoeller jhoeller changed the title LazyResolutionMessage does not implement proper toString LazyResolutionMessage does not implement proper toString Oct 10, 2023
jhoeller pushed a commit that referenced this issue Oct 10, 2023
Previously, MessagingMessageListenerAdapter or any adapter relying on
the default MessagingMessageConverter would log an incoming message
with a toString of the Message that does not provide any extra
information. This is due to the default implementation providing a
lazy resolution message that only attempts to extract the payload
when necessary.

This commit implements a toString method that uses the raw JMS message
if the payload is not available. If it is, the payload is used instead.

Closes gh-21265

(cherry picked from commit a37abd5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants