I throw an exception when I print a string on the console using logback and jansi. The operating system is window10.
maven dependency
<dependencies>
<!-- -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>utf8</encoding>
</configuration>
</plugin>
</plugins>
</build>
xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName></contextName>
<!-- -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%highlight(%cn) %red(%d{hh:MM:ss}) %green([%20logger{0}]) - %cyan(%message%n)</pattern>
</encoder>
<withJansi>true</withJansi>
</appender>
<logger name="com.cck.MyLogback">
<appender-ref ref="STDOUT" />
</logger>
<root level="debug"></root>
</configuration>
Code
package com.cck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyLogback {
private final static Logger logger
= LoggerFactory.getLogger("com.cck.MyLogback");
public static void main(String[] args) {
logger.info("hello world");
}
}
console exception information
according to the documentation on the official website, the problem cannot be solved after installing the ANSI in Eclipse Console plug-in for Eclipse.