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

Current log level not checked by LogAccessor supplier-enabled logging methods #25741

Closed
rschuetz opened this issue Sep 8, 2020 · 0 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@rschuetz
Copy link

rschuetz commented Sep 8, 2020

Affects: Spring Framework version: 5.2.8

org.springframework.kafka.core.KafkaTemplate is using the org.springframework.core.log.LogAccessor Supplier-enabled logging methods (trace etc.). Unfortunately, LogAccessor does not check the currently enabled log level, so it always creates an additional SupplierMessage object even of the data never gets logged. In addition, in case the standard JCL -> SLF4J bridge (jcl-over-slf4j.jar) of the SLF4J project is being used instead of spring-jcl, the SLF4JLog class of this bridge unfortunately also converts the object to a string unconditionally, probably as it assumes the log level has been checked before, which slows down processing dramatically.

Assuming that the LogAccessor Supplier-enabled logging methods are intended to be called without log level check before, wouldn't it be better to at least check the log level in LogAccessor in these methods, to avoid creating objects / converting the objects to String unnecessarily?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 8, 2020
@jhoeller jhoeller self-assigned this Sep 8, 2020
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 8, 2020
@jhoeller jhoeller added this to the 5.2.9 milestone Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants