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

There is no conversion class registered for conversion word [d]

    XMLWordPrintable

Details

    Description

      Hello,

      I'm having problems with logback, i'm not sure if this is a bug, but certainly is very very weird behavior.

      I just follow a tutorial (logback.qos.ch/manual/configuration.html#joranDirectly) to load the configuration xml from another place, when it load the xml this print a lot of errors:

      _14:51:42,240 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
      14:51:42,240 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
      14:51:42,240 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at file:/Test/target/classes/logback.xml
      14:51:42,325 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
      14:51:42,329 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      14:51:42,337 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      14:51:42,358 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      14:51:42,414 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
      14:51:42,414 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
      14:51:42,414 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
      14:51:42,415 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@e74eb02 - Registering current configuration as safe fallback point
      14:51:42,429 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      14:51:42,429 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      14:51:42,429 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.access.PatternLayoutEncoder] for [encoder] property
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - There is no conversion class registered for conversion word [d]
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - [d] is not a valid conversion word
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - There is no conversion class registered for conversion word [thread]
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - [thread] is not a valid conversion word
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - There is no conversion class registered for conversion word [level]
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - [level] is not a valid conversion word
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - There is no conversion class registered for conversion word [logger]
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - [logger] is not a valid conversion word
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - There is no conversion class registered for conversion word [msg]
      14:51:42,443 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@6c9bc6a9 - [msg] is not a valid conversion word
      14:51:42,450 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@9:22 - no applicable action for [root], current ElementPath is [[configuration][root]]
      14:51:42,451 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@10:32 - no applicable action for [appender-ref], current ElementPath is [[configuration][root][appender-ref]]
      14:51:42,451 |-INFO in ch.qos.logback.access.joran.action.ConfigurationAction - End of configuration.
      14:51:42,451 |-INFO in ch.qos.logback.access.joran.JoranConfigurator@32a0a9ac - Registering current configuration as safe fallback point
      14:51:42,453 |-WARN in Logger[Main] - No appenders present in context [default] for logger [Main]._

      To make sure this is a bug and not a bad configuration, i have created a maven project with only one java file

      Bar.java
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      import ch.qos.logback.access.joran.JoranConfigurator;
      import ch.qos.logback.classic.LoggerContext;
      import ch.qos.logback.core.joran.spi.JoranException;
      
      public class Main {
      	static Logger logger = LoggerFactory.getLogger(Main.class);
      
      	public static void main(String[] args) {
      		LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
      
      		try {
      			JoranConfigurator configurator = new JoranConfigurator();
      			configurator.setContext(context);
      			context.reset();
      			configurator.doConfigure(args[0]);
      		} catch (JoranException je) {
      			// StatusPrinter will handle this
      		}
      
      		logger.error("ASDF");
      		logger.info("ASDF");
      		logger.debug("ASDF");
      		logger.warn("ASDF");
      		logger.trace("ASDF");
      	}
      }
      

      This is the logback.xml that i'm trying to load

      <configuration debug="true">
      	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      		<encoder>
      			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
      			</pattern>
      		</encoder>
      	</appender>
      
      	<root level="debug">
      		<appender-ref ref="STDOUT" />
      	</root>
      </configuration>
      

      and this is the pom.xml

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      	<modelVersion>4.0.0</modelVersion>
      	<groupId>Test</groupId>
      	<artifactId>Test</artifactId>
      	<version>0.0.1</version>
      	<name>Test</name>
      	<description>	</description>
      	<dependencies>
      		<dependency>
      			<groupId>junit</groupId>
      			<artifactId>junit</artifactId>
      			<version>3.8.1</version>
      		</dependency>
      		<dependency>
      			<groupId>ch.qos.logback</groupId>
      			<artifactId>logback-access</artifactId>
      			<version>1.1.3</version>
      		</dependency>
      		<dependency>
      			<groupId>ch.qos.logback</groupId>
      			<artifactId>logback-classic</artifactId>
      			<version>1.1.3</version>
      		</dependency>
      		<dependency>
      			<groupId>ch.qos.logback</groupId>
      			<artifactId>logback-examples</artifactId>
      			<version>1.1.3</version>
      		</dependency>
      		<dependency>
      			<groupId>org.slf4j</groupId>
      			<artifactId>slf4j-api</artifactId>
      			<version>1.7.12</version>
      		</dependency>
      		<dependency>
      			<groupId>ch.qos.logback</groupId>
      			<artifactId>logback-core</artifactId>
      			<version>1.1.3</version>
      		</dependency>
      	</dependencies>
      	<properties>
      		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      	</properties>
      </project>
      

      if I comment the lines where it loads the external logback.xml its works without problems loading the logback under /src/main/resource

      Attachments

        Activity

          People

            logback-dev Logback dev list
            bsoto benjamin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: