Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1621

no applicable action for [root], current ElementPath is [[configuration][root]]

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.2.11
    • logback-access
    • Windows 11:
      Java 8
      logback 1.2.11
      slf4j 1.7.36

    Description

      java code with logback.xml failed withFailed java code with logback.xml failed with
      22:01:51,235 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:22 - no applicable action for [root], current ElementPath  is [[configuration][root]]
      22:01:51,235 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@15:32 - no applicable action for [appender-ref], current ElementPath  is [[configuration][root][appender-ref]]

      If I move logback to classpath and java code run fine with

      final Logger logger = LoggerFactory.getLogger(LogbackExample.class);
      logger.info("Hello World");

      java code:-----
      final Logger logger = LoggerFactory.getLogger(LogbackExample.class);
       LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
       JoranConfigurator configurator = new JoranConfigurator();
       lc.reset(); 
      configurator.setContext(lc);
       configurator.doConfigure("lib/logback.xml"); 
      logger.info("Hello World");

      logback.xml:-----
      <configuration scan="true" scanPeriod="60 seconds" debug="true"><configuration scan="true" scanPeriod="60 seconds" debug="true">  
       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> 
      <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> 
      <pattern>%d

      {HH:mm:ss.SSS}

      [%thread] %-5level %logger

      {5}

      - %msg%n</pattern>
      </encoder> 
      </appender> 
      <root level="debug"> 
      <appender-ref ref="STDOUT" /> 
      </root>
      </configuration> 

      Attachments

        Activity

          People

            logback-dev Logback dev list
            i928 Chiiwen Liou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: