
I am using logback 1.2.3. I am passing the logback configuration as -Dlogback.configurationFile=$SERVICE_PATH/restapilayer.logback.xml My restapilayer.logback.xml looks like below <?xml version="1.0" encoding="UTF-8"?><configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern> %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n </Pattern> </layout> </appender> <root level="DEBUG"> <appender-ref ref="STDOUT" /> </root> </configuration> In my logs also I am seeing the configuration file being loaded. 16:25:32,564 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [/home/ubuntu/build-target/restapilayer/restapilayer.logback.xml] at [file:/home/ubuntu/build-target/restapilayer/restapilayer.logback.xml]16:25:32,705 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set16:25:32,706 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]16:25:32,716 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]16:25:32,798 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.16:25:32,798 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.16:25:32,798 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details16:25:32,799 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG16:25:32,799 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]16:25:32,800 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.16:25:32,801 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@76707e36 - Registering current configuration as safe fallback point 2018-01-12 16:25:32 [main] INFO com.vnera.common.utils.CommonUtils - adding uncaught exception handler hook... log4j: Default initialization of overridden by log4j.defaultInitOverrideproperty. log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. INFO [2018-01-12 16:25:34] o.e.j.u.log:[?:?:?] - [main] - Logging initialized @1909ms Then while trying to log I am seeing the logback configuration as null and it seems logback is running with default config INFO [2018-01-12 16:25:34] c.v.r.c.v.r.VneraBackendService:[?:?:?] - [main] - Logback used _null_ as the configuration file_ I am using the below code to get the logback config logger.debug("Testing Debug logging");LoggerContext loggerContext = ((ch.qos.logback.classic.Logger)logger).getLoggerContext(); URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(loggerContext);System.out.println(mainURL);// or even logger.info("Logback used '{}' as the configuration file.", mainURL); Can someone let me know what is going wrong? How can I debug this issue?