Describe the bug
When the Java application or the inspectIT Ocelot agent is configured to use a custom configuration file (e.g., -Dlogback.configurationFIle=path/to/logback-config.xml or -Dinspectit.logging.config-file:path/to/logback-config.xml), the agent throws the following exception. This is because the dependency to net.logstash.logback:logstash-logback-encoder is missing in inspectIT Ocelot, which is needed by the logback configuration.
Exception:
07:43:58,896 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [./log/logback-config.xml] at [file:/C:/Users/HHO/dev/inspectit/inspectic-ocelot-playground/./log/logback-config.xml]
07:43:58,950 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
07:43:58,953 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/C:/Users/HHO/dev/inspectit/inspectic-ocelot-playground/./log/logback-config.xml]
07:43:58,953 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 30 minutes
07:43:58,954 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
07:43:58,956 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
07:43:58,960 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
07:43:58,976 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
07:43:58,976 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [StdoutJsonAppender]
07:43:58,977 |-ERROR in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not create component [encoder] of type [net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder] java.lang.ClassNotFoundException: net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder
at java.lang.ClassNotFoundException: net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder
at at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at at ch.qos.logback.core.util.Loader.loadClass(Loader.java:120)
at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.begin(NestedComplexPropertyIA.java:102)
at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:269)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145)
at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:128)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at at rocks.inspectit.ocelot.core.logging.logback.LogbackInitializer.initLogging(LogbackInitializer.java:84)
at at rocks.inspectit.ocelot.core.logging.logback.LogbackInitializer.initDefaultLogging(LogbackInitializer.java:70)
at at rocks.inspectit.ocelot.core.AgentImpl.<clinit>(AgentImpl.java:53)
at at java.lang.Class.forName0(Native Method)
at at java.lang.Class.forName(Class.java:348)
at at rocks.inspectit.ocelot.bootstrap.AgentManager.startOrReplaceInspectitCore(AgentManager.java:40)
at at rocks.inspectit.ocelot.agent.AgentMain.startAgent(AgentMain.java:110)
at at rocks.inspectit.ocelot.agent.AgentMain.lambda$premain$0(AgentMain.java:93)
at at java.lang.Thread.run(Thread.java:748)
Describe the bug When the Java application or the inspectIT Ocelot agent is configured to use a custom configuration file (e.g.,
-Dlogback.configurationFIle=path/to/logback-config.xml
or-Dinspectit.logging.config-file:path/to/logback-config.xml
), the agent throws the following exception. This is because the dependency tonet.logstash.logback:logstash-logback-encoder
is missing in inspectIT Ocelot, which is needed by the logback configuration.Exception:
Logback configuration:
To Reproduce Steps to reproduce the behavior:
-Dlogback.configurationFile=/path/to/logback-configuration.xml
Expected behavior I'd like to be able to use the logback configuration file.
The easiest solution is to add the required dependency to the inspectIT Ocelot agent.