0

I am using Spring boot application. When I try to add the https://github.com/SumoLogic/sumologic-logback-appender to my project and added configuration in logback.xml as below

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="SumoAppender" class="com.sumologic.logback.SumoLogicAppender">
        <encoder>
            <Pattern>
                %date{ISO8601,UTC} [%t] %-5p %c - %m%n
            </Pattern>
        </encoder>
        <url>[collector-url]</url>
    </appender>
    <Logger name="SumoLogger" level="info">
        <appender-ref ref="SumoAppender" />
    </Logger>
</configuration>

I got this below error and unable to proceed

ERROR in ch.qos.logback.core.joran.action.AppenderAction - Could not create an Appender of type [com.sumologic.logback.SumoLogicAppender]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type com.sumologic.logback.SumoLogicAppender
ERROR in ch.qos.logback.core.joran.spi.Interpreter@52:79 - ActionException in Action for tag [appender] ch.qos.logback.core.joran.spi.ActionException: ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type com.sumologic.logback.SumoLogicAppender
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [SumoAppender]. Did you define it below instead of above in the configuration file?
ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.

Maven dependency link - https://mvnrepository.com/artifact/com.sumologic.plugins.log4j/sumologic-log4j2-appender/1.13

Any help would be useful

Galet
  • 5,853
  • 21
  • 82
  • 148

2 Answers2

1

I found answer for my question. It is my mistake. I was using the log4j jar and looking for logback class file. I fixed by using the logback jar as below

// https://mvnrepository.com/artifact/com.sumologic.plugins.logback/sumologic-logback-appender
implementation group: 'com.sumologic.plugins.logback', name: 'sumologic-logback-appender', version: '1.8'
Galet
  • 5,853
  • 21
  • 82
  • 148
0

My hunch is that you are missing the sumologic-logback-appender jar from the classpath at runtime.

Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106
  • I have added the following in build.gradle . implementation group: 'com.sumologic.plugins.log4j', name: 'sumologic-log4j2-appender', version: '1.13' – Galet Oct 18 '22 at 07:26
  • 1
    OK, so you were missing the jar, but for a different reason :) Glad to see you have solved it. – Grzegorz Oledzki Oct 18 '22 at 08:25