rocketraman commented on issue #136: URL: https://github.com/apache/logging-log4j-kotlin/issues/136#issuecomment-3352105291
@sschuberth Updated the PR > , I wonder whether we could have an annotation / Kotlin compiler plugin that auto-generates code for classes that should support logging. E.g. annotating a class with `@Logger` would then hard-code a `logger` property to the class with proper naming and without any cache lookup / additional function call. I like this idea. Do you mind creating a separate issue / feature request for it? And obviously if you have some time to help with an implementation that would be great. > What'd be the ETA for 2 major releases if you're going with the deprecated approach? @t52053518 We'd deprecate it now in the current release (as that is a non-breaking change), and then remove it in the next major release. That could happen relatively soon if we wanted. > That said, I don't think you can fully achieve this with ReplaceWith, and I think this might create a new bug in the intermediary build, if this is a valid use case: Don't think its an issue. Importing `org.apache.logging.log4j.kotlin.*` in addition to the new package `logger` is fine. Importing `org.apache.logging.log4j.kotlin.loggerOf` is fine. Importing `org.apache.logging.log4j.kotlin.logger` fails, but these are logger factory methods for the extension function and deprecated extension property, so I don't see any reason a user would need to import these at the same time as the property extension in the new package. > They have this nice 1-liner: [Logging](https://logging.apache.org/log4j/kotlin/index.html#extend-companion) but just before I suggested it I decided to take a look, and heh, it's [cached too...](https://github.com/apache/logging-log4j-kotlin/blob/main/log4j-api-kotlin/src/main/kotlin/org/apache/logging/log4j/kotlin/Logging.kt#L56) Yes, unfortunately. If we add a compile-time option as suggested by @sschuberth I'm thinking we should then deprecate this option as well. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
