I created an appender in my Log4J.xml config file following this manual :
<Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="%green{%d} %style{%t}{BG_Green,white} %yellow{[%-5p]} %m%n"/>
</Console>
My broken console output :
[32m2022-02-07 23:58:46,394[m [33m[INFO ][m HHH000412: Hibernate ORM core version 5.6.5.Final
[32m2022-02-07 23:58:46,659[m [33m[INFO ][m HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
[32m2022-02-07 23:58:46,751[m [33m[WARN ][m HHH10001002: Using Hibernate built-in connection pool (not for production use!)
[32m2022-02-07 23:58:46,755[m [33m[INFO ][m HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost/hibernate_demo]
[32m2022-02-07 23:58:46,755[m [33m[INFO ][m HHH10001001: Connection properties: {password=****, user=root}
[32m2022-02-07 23:58:46,755[m [33m[INFO ][m HHH10001003: Autocommit mode: false
[32m2022-02-07 23:58:46,756[m [33m[INFO ][m HHH000115: Hibernate connection pool size: 20 (min=1)
[32m2022-02-07 23:58:47,001[m [33m[INFO ][m HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
- I tried to add this
disableAnsi="true"
to my<PatternLayout />
, didnt work. - I tired adding this eclipse plugin, didnt work.
Eclipse version: 2021-06 (4.20.0)
Log4J dependency :
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
EDIT 1 :
it's working partially
I needed to check a checkbox in Window => Prefrences => Run/debug => Console => "Interpret ASCII Control Characters".
Must have this Eclipse Plugin installed .
Using %style{pattern}{myStyles}
is displaying colors in the console correctly , but %highligh
is not, no idea where to go from here.
( see console coloring )