hello! by any chance anyone here wrote a log4j2 Pl...
# announcements
d
hello! by any chance anyone here wrote a log4j2 Plugin using Kotlin? Basically trying to do something like this
Copy code
@Plugin(name = "StandardLogLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE)
class StandardLogLayout(config: Configuration?, aCharset: Charset?, headerSerializer: Serializer? = null, footerSerializer: Serializer? = null) : AbstractStringLayout(config, aCharset, headerSerializer, footerSerializer) {

    companion object {
        @PluginFactory
        @JvmStatic
        fun createLayout(
            @PluginConfiguration config: Configuration?,
            @PluginAttribute(value = "charset", defaultString = "UTF-8") charset: Charset?
        ): StandardLogLayout = StandardLogLayout(config, charset)

// actual logging logic that auto formats the message
}
and then in my
log4j2.xml
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
    <Appenders>
        <Console name="standardLayout" target="SYSTEM_OUT" follow="true">
            <StandardLogLayout/>
        </Console>
    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="standardLayout"/>
        </Root>
    </Loggers>
</Configuration>
but unfortunately it doesn’t work. Tried configuring
kapt
with
log4j2-core
as annotation processor but it didn’t work either…. Any help would be appreciated