Dariusz Kuc
06/04/2020, 2:43 AM@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
<?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