I'm testing my ear application on the container and I need to see some debugging messages I spread on my application. I'm using slf4j-api
with log4j
as logging framework.
During my test phase (out of the container) all logging was working perfectly, so the configuration is fine. But now I've deployed the application with the same configuration but my messages are not showing. Here is my log4j's config:
#rootLogger config
log4j.rootLogger=INFO, console
#appender config
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console..threshold=DEBUG
log4j.appender.console.target=System.out
log4j.appender.console.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} [%t] %p %l - %m%n
# Log JDBC bind parameter runtime arguments
log4j.logger.org.hibernate.type=INFO
#application logger config
log4j.logger.ar.edu.unt.sigea=DEBUG, console
As I said, when I run my @Test
methods, all my logger.debug()
messages are shown correctly, but now that I'm running on the container with the same configuration, no debug message is shown.
I found this post and added the line log4j.appender.console..threshold=DEBUG
as suggested by the answer but didn't work.
I'm deploying on Wildfly-10.0.0.Final Application Server and I'm using this logging dependencies:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
What am I missing? Where should I look for? Thanks in advance for your answers
Remote debugging WildFly with Eclipse To enable debugging in your Eclipse IDE, it is generally sufficient to select from the Menu: Run | Debug As | Remote Java application.
Where CA Identity Manager has been deployed with Jboss\ Wildfly, the application logs (server. log) is stored in a path relative to the installation folder (%Jboss%\standalone\log).
You don't need to use the log4j binding unless you want to use your own log4j configuration. From the configuration file it looks like you're just using console appender which is already provided by the WildFly logging subsystem.
All you need to do to see debug messages with your current configuration is to remove the log4j.properties
from your deployment and remove the org.slf4j:slf4j-log4j12
dependency from your pom. Then you can use the logging subsystem to configure logging and turn on/off debug logging. If you use CLI or the web console you can change logging levels without restarting the server.
To add a debug level and change the default console-handler
level to DEBUG
. The following two CLI commands are all you need to configure debug logging.
/subsystem=logging/logger=ar.edu.unt.sigea:add(level=DEBUG)
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=DEBUG)
looking at this Wildfly Documentation I realized that my log4j.properties
file was located in a wrong place: it was in a submodule of my project and must be in the META-INF
folder of the EAR module.
By default, Wildfly takes the deployment's logging configuration, so no extra configuration is needed in standalone.xml
(or standalone-full.xml
depending on what profile are you using, which is my case).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With