You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "sschuberth (via GitHub)" <gi...@apache.org> on 2025/09/30 15:05:11 UTC
[I] Provide an annotation for auto-generating an extension property for a logger [logging-log4j-kotlin]
sschuberth opened a new issue, #139:
URL: https://github.com/apache/logging-log4j-kotlin/issues/139
As discussed [here](https://github.com/apache/logging-log4j-kotlin/issues/136#issuecomment-3352105291) with @rocketraman, another possibility to solve both the "auto-pollution" of any class with a `logger` property and the performance hit introduced by getting a cached logger instance could be to provide a KSP-based compiler plugin that auto-generates code for annotated classes.
It could work a bit similar to projects like [this](https://github.com/darkxanter/kdatamapper) which auto-generate extension functions for annotated classes. A difference would be that instead of an extension *function* a *property* is generated. As the property is generated at compile-time, it can hard-code the class / logger name, avoiding the need to look up a cached logger for a specific class.
To avoid each instance of a class to get its own logger property, probably some more logic needs to be added to statically add the property to a (dummy) companion object instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Provide an annotation for auto-generating an extension property for a logger [logging-log4j-kotlin]
Posted by "rocketraman (via GitHub)" <gi...@apache.org>.
rocketraman commented on issue #139:
URL: https://github.com/apache/logging-log4j-kotlin/issues/139#issuecomment-3362178266
One note: we should allow project-wide configuration with a per-annotation override to specify the logger name. Some people prefer `log` to `logger`, for example.
We should also think about how this capability/feature will integrate with:
* https://github.com/apache/logging-log4j-kotlin/issues/36
* https://github.com/apache/logging-log4j-kotlin/issues/71
I'm thinking an annotation like `@BaseLogger` would create a logger which is then configurable in the consuming class via DSL. But perhaps there are other approaches.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org