Search code examples
loggingwildflyslf4j

Wildfly Preview 25.0.1.Final cannot set right logging encoding


I am trying to configure logging for a REST service that runs on Wildfly. I have this simple logging message for a GET petition in a resource:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-----
log.info("Inicia petición GET para la fecha {}", fecha_str);

But in the Wildfly console I get:

10:24:33,826 INFO  [es.bocm.numbot.rest.numbot.NumbotResource] (default task-1) Inicia petici?n GET para la fecha 1923-05-10

I get the correct encoding when running the unit tests locally, so I do not think there is a problem with my project settings. These are the relevant parts in my pom.xml:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
----------
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.32</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.32</version>
        <scope>provided</scope>
    </dependency>

and this is what I added to the standalone.xml:

<logger category="es.bocm.numbot">
    <level name="DEBUG"/>
</logger>

I tried adding:

<encoding value="UTF-8"/>

to the console-handler defined by default under:

<subsystem xmlns="urn:jboss:domain:logging:8.0">

but it looks like that make things even worse:

10:32:04,488 INFO  [es.bocm.numbot.rest.numbot.NumbotResource] (default task-1) Inicia petición GET para la fecha 1923-05-10

The only weird thing I notice in Wildfly's output during starting is:

Handler java.util.logging.ConsoleHandler is not defined

it does not even have the timestamp and the rest of the data, it is just this message.


Solution

  • It is an issue of IntelliJ https://youtrack.jetbrains.com/issue/IDEA-142625 both console and file logs display correctly when using other tools like Docker Desktop.