SumoLogic/sumologic-log4j2-appender

Failed to load SumoLogicAppender when the app is a fat jar

liangde-chen opened this issue · 2 comments

It works if I start the app from IDE, but if I build the app into a fat jar and run it, it doesn't work.
I can confirm the com.sumologic.log4j.SumoLogicAppender.class is included in the fat jar.

It got this error ERROR Error processing element SumoLogicAppender ([Appenders: null]): CLASS_NOT_FOUND

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <SumoLogicAppender
                name="SumoAppender"
                url="xxxx"
                sourceName="mySource"
                sourceHost="myHost2"
                sourceCategory="myCategory"
                messagesPerRequest="1000"
                maxFlushInterval="100"
                flushingAccuracy="10">
            <JsonLayout compact="true"
                        eventEol="true"
                        properties="true">
                <KeyValuePair key="additionalField1" value="constant value"/>
            </JsonLayout>
        </SumoLogicAppender>
        <Console name="console2" target="SYSTEM_OUT">
            <JsonLayout compact="true"
                        eventEol="true"
                        properties="true">
                <KeyValuePair key="additionalField1" value="constant value"/>
            </JsonLayout>

        </Console>

    </Appenders>
    <Loggers>
        <Root level="INFO" additivity="false">
            <AppenderRef ref="console2"/>
            <AppenderRef ref="SumoAppender"/>
        </Root>
    </Loggers>
</Configuration>

Close it since it is a log4j2 implementation bug: https://issues.apache.org/jira/browse/LOG4J2-673

OK, so this is a log4j2 bug, but does this mean I can't use a SumoLogic appender in a fat jar file with Log4J2? Is there a work around? Are there alternatives?