Hi,
I have written a custom appender extending the log4j2 AbstractAppender. But
I am getting a runtime error[1]. I have added the plugin annotation[2] as
per the manual and the custom appender class contains factory method
createAppender() as well. I also have added the package name to
configuration element.
What am I missing here? Appreciate any input on this.
I have my log4j2.xml file as below:
<Configuration packages="org.my.custom.http.socket.appender">
<Appenders>
...
<Socket name="socket" host="localhost" port="4714">
<!--PatternLayout pattern="[%d] %5p {%c} - %m%ex%n"/-->
</Socket>
<HTTPSocket name="HTTP_APPENDER" host="localhost" port="8888">
<-------------------------------------
New Appender
</HTTPSocket>
</Appenders>
<Loggers>
<Root level="info" includeLocation="true">
...
<AppenderRef ref="HTTP_APPENDER"/>
</Root>
<Logger name="my.custom.deployer" level="info" additivity="true">
<AppenderRef ref="socket"/>
</Logger>
</Loggers>
</Configuration>
[1] ERROR Appenders contains an invalid element or attribute "HTTPSocket"
[2] @Plugin(name = "HTTPSocket", category = "Core", elementType = "appender",
printObject = true)
Thanks,
Nipuni
--
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: [email protected]
Git hub profile: https://github.com/nipuni
Blog : http://nipunipererablog.blogspot.com/
Mobile: +94 (71) 5626680