Are you getting below Logback Could NOT find resource logback.xml Error?
12:12:08,201 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 12:12:08,201 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 12:12:08,202 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/app/crunchify/github/CrunchifyTutorials/target/classes/logback.xml] 12:12:08,261 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 12:12:08,261 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 12:12:08,266 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CRUNCHIFYOUT] 12:12:08,298 |-WARN in ch.qos.logback.core.ConsoleAppender[CRUNCHIFYOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead. 12:12:08,298 |-WARN in ch.qos.logback.core.ConsoleAppender[CRUNCHIFYOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder. 12:12:08,298 |-WARN in ch.qos.logback.core.ConsoleAppender[CRUNCHIFYOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details 12:12:08,299 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender] 12:12:08,301 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CRUNCHIFYFILE] 12:12:08,301 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 12:12:08,302 |-INFO in ch.qos.logback.core.FileAppender[CRUNCHIFYFILE] - File property is set to [/Users/app/Documents/crunchify.log] ... ... ... 12:12:08,315 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO 12:12:08,315 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CRUNCHIFYOUT] to Logger[ROOT] 12:12:08,315 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CRUNCHIFYFILE] to Logger[ROOT] 12:12:08,315 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CRUNCHIFYROLLING] to Logger[ROOT] 12:12:08,315 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CRUNCHIFYROLLINGFIXEDWINDOW] to Logger[ROOT] 12:12:08,315 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 12:12:08,315 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@741a8937 - Registering current configuration as safe fallback point
How to fix ch.qos.logback.classic.LoggerContext error?
I’m using logback.xml logging framework. We have very detailed tutorial on What is Logback.xml Logging Framework?
Kindly take a look if you want to learn and how to configure logback.xml file.
In short, you have to create logback.xml file and put it under /resources folder. Somehow I was missing logback-test.xml
file under /resources
folder.
In order to fix this error create very simple logback-test.xml
file with below file content.
Create file logback-test.xml
<configuration> </configuration>
That’s it. Rebuild your project and run your Java program. You shouldn’t see this error any more.
Hope this helps.