'Spring Boot 1.5.8 not logging in JBoss EAP 7
I am trying to run a spring boot 1.5.8 application on JBoss EAP 7, but none of the application logs are appending to the console or log file.
I have disabled spring boots default logging by excluding the logging jars as follows:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- https://programmingthoughtworkbysrinivasan.blogspot.in/2017/04/spring-152-with-jpa-21-integration-with.html -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
When I start the server, I see the JBoss startup info, but I don't see any application logs, I just see this error:
11:26:58,032 ERROR [stderr] (ServerService Thread Pool -- 64) Handler java.util.logging.ConsoleHandler is not defined
11:27:03,622 ERROR [stderr] (ServerService Thread Pool -- 64) Handler java.util.logging.ConsoleHandler is not defined
Solution 1:[1]
I suggest you to re-enable your Spring Boot default logging.
After this, check if your server.log file, under JBOSS_HOME\standalone\log is now logging what you need. If not, try creating a log category in JBoss admin console under:
Configuration: Subsystems >> Subsystem: Logging >> Log categories >> Add
For "category" use your package path name.
Set your desired log level and finally set "Use parent handlers" to true.
Restart the server and check again your server.log. It should work now.
If you want the same log level to be output to your JBoss console, go back to JBoss admin console under:
Configuration: Subsystems >> Subsystem: Logging >> Log handlers >> Console
And edit the console log level to the same level you need.
Solution 2:[2]
You should keep your parent package and log level in JBOSS_HOME/standalone/configuration/standalone.xml as mentioned below
<logger category="com.iedr">
<level name="INFO"/>
</logger>
Here my parent package is com.iedr and log level i wanted is INFO. You should add this one to your logging subsystem, as mentioned below
<subsystem xmlns="urn:jboss:domain:logging:8.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="io.jaegertracing.Configuration">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="com.iedr">
<level name="INFO"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Simon |
| Solution 2 | Janakiram |
