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

Color support and Eclipse console

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.0.6
    • logback-core
    • Windows 7

    Description

      This cause be an issue more directed to Jansi than Logback, but anyway: when trying to use a ConsoleAppender without color support in Eclipse console, the configuration fails with this kind of trace:

      15:03:05,316 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      15:03:05,319 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
      15:03:05,355 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      15:03:05,471 |-INFO in ch.qos.logback.core.ConsoleAppender[CONSOLE] - Enabling JANSI WindowsAnsiOutputStream for the console.
      15:03:14,639 |-WARN in ch.qos.logback.core.ConsoleAppender[CONSOLE] - Failed to create WindowsAnsiOutputStream. Falling back on the default stream. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream
      	at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream
      	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:72)
      	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:40)
      	at 	at ch.qos.logback.core.ConsoleAppender.getTargetStreamForWindows(ConsoleAppender.java:94)
      	at 	at ch.qos.logback.core.ConsoleAppender.start(ConsoleAppender.java:85)
      	at 	at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
      	at 	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:318)
      	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:197)
      	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:183)
      	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
      	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147)
      	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133)
      	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96)
      	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55)
      	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
      	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
      	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
      	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54)
      	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
      	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
      	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
      	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
      	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
      	at 	at tools.logging.InscaleLogger.getLogger(InscaleLogger.java:34)
      	at 	at modules.grid.executor.CallingThreadExecutor.<clinit>(CallingThreadExecutor.java:33)
      	at 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      ...
      	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:67)
      	at 	... 50 common frames omitted
      Caused by: java.io.IOException: Could not get the screen info: L  o p é r a t i o n  a  r é u s s i.
      

      (The root cause message means "operation succeeded " in french).

      The log are then displayed with raw ANSI escape codes.

      I think the check here is not sufficient, it should check we are in real Windows terminal...

      Attachments

        Activity

          People

            logback-dev Logback dev list
            nicoulaj Julien Nicoulaud
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: