Complete guide to disabling DEBUG log output in JBoss/Log4j2 environment

This article details how to disable the DEBUG level log output of Log4j2 in the JBoss application server through the CLI, management console or directly modifying the `standalone.xml` configuration file. For the scenario where JBoss integrates Log4j2, the tutorial provides a variety of configuration methods, and specifically points out the difference between Hibernate's `show_sql` configuration and log level control. It aims to help developers effectively manage and control the application's log information and avoid excessive redundant content output by the console.
When developing and deploying JBoss-based applications, a large amount of DEBUG level log output may appear in the console or log file, such as 00:00:39.293 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider. Although these logs are useful when debugging, they often cause interference and reduce log readability in daily development or production environments. This article will dive into how to properly configure log levels in a JBoss environment to disable unnecessary DEBUG output.
Understand the log management mechanism of JBoss
When you run an application in a JBoss application server, JBoss typically takes over its internal components as well as the log management of the deployed application. Even though your application may be configured with Spring Boot or Logback/Log4j2, JBoss may use its built-in logging subsystem to handle log output. In this case, setting logging.level.root=info directly in application.properties or via the JVM parameter -Dlogging.level.org.springframework=INFO may not fully control the logging output of JBoss itself, especially JBoss core components or its integrated Log4j2 provider.
JBoss application servers (such as WildFly or JBoss EAP) usually manage logs through their logging subsystem (based on Log4j2, Logback or JUL, etc.). Therefore, to modify the log level of JBoss, you need to operate through the management interface or configuration file provided by JBoss.
How to configure JBoss log level
There are several ways to modify the JBoss application server's log level, including the command line interface (CLI), the management console, and directly modifying the configuration file.
1. Using JBoss CLI (Command Line Interface)
JBoss CLI provides a powerful and flexible way to manage servers. To modify the log level, follow these steps:
-
Connect to the CLI: Open a terminal or command prompt, navigate to the bin subdirectory of the JBoss installation directory, and run the CLI script:
./jboss-cli.sh --connect # Or on Windows: # jboss-cli.bat --connect
If JBoss is running on a non-default port or requires authentication, you may need to provide more parameters.
-
View current log configuration (optional): You can view the current root logger configuration:
/subsystem=logging/root-logger=ROOT:read-resource
-
Modify the root logger level: To set the root logger level to INFO, execute the following command:
/subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO)
This will set the default level to INFO for all loggers not explicitly configured.
-
Add or modify specific logger levels (if needed): If you need to set a different log level for a specific package or class, such as org.springframework, you can do this:
/subsystem=logging/logger=org.springframework:add(level=INFO) # If it already exists, you can use write-attribute to modify it: # /subsystem=logging/logger=org.springframework:write-attribute(name=level,value=INFO)
This will ensure that the log output level under the org.springframework package is INFO.
-
Reload configuration: Some changes may require reloading the log configuration to take effect:
/host=master/server=server-one:reload # Or restart the server directly
2. Using the JBoss Management Console
JBoss/WildFly usually provides a web-based management console that allows you to configure the server through a graphical interface.
Access the management console: Access the JBoss management console in a browser (usually http://localhost:9990/console).
Navigate to logging configuration: Once logged in, navigate to "Configuration" -> "Subsystems" -> "Logging".
-
Modify log level: In the log configuration page, you can find the "Root Logger" or "Loggers" list.
- Find "Root Logger" and edit its level to "INFO".
- If you need to configure the level for a specific package (such as org.springframework), you can add or modify the corresponding logger in the "Loggers" section and set its level to "INFO".
Save and activate changes: Save your changes. Normally, JBoss will automatically apply these changes without requiring a restart.
3. Modify the standalone.xml or domain.xml file
For standalone mode, JBoss configuration is mainly stored in the standalone/configuration/standalone.xml file. For domain mode, it is in domain/configuration/domain.xml.
Locate the configuration file: Find the standalone/configuration/standalone.xml file in the JBoss installation directory.
Edit the logging subsystem configuration: Open the standalone.xml file and look for the
section (where XY is the version number of the logging subsystem, such as 5.0 or 8.0). -
Modify the root logger level: In the subsystem configuration, find the
element and modify its level attribute to INFO: <subsystem xmlns="urn:jboss:domain:logging:8.0"> <!-- ...Other log configurations... --> <root-logger> <level name="INFO"></level> <!-- Change DEBUG to INFO --> <handlers> <handler name="CONSOLE"></handler> <handler name="FILE"></handler> </handlers> </root-logger> <!-- ...Other logger configurations... --> </subsystem> -
Add or modify a specific logger level: If you need to set the log level for a specific package (such as org.springframework), you can add or modify the corresponding logger within the
tag after : <subsystem xmlns="urn:jboss:domain:logging:8.0"> <!-- ... --> <loggers> <logger category="org.springframework"> <level name="INFO"></level> </logger> <!-- ...other loggers... --> </loggers> <!-- ... --> </subsystem> Restart JBoss: After directly modifying the standalone.xml file, you need to restart the JBoss server for the changes to take effect.
Special notes: Hibernate's show_sql
In the hibernate.cfg.xml configuration you provided, there are the following two lines:
<property name="show_sql">true</property> <property name="format_sql">true</property>
show_sql=true is a configuration item of Hibernate, which will directly output the executed SQL statement to the standard output (or be bound to the INFO level of the logging framework). This configuration is relatively independent of JBoss's log level control. Even if you set JBoss's root log level to INFO, Hibernate will still output SQL statements if show_sql is still true.
If you don't want to see these SQL outputs, you should set show_sql to false:
<property name="show_sql">false</property>
Alternatively, if you wish to control the output of SQL through the logging framework, you can set it to false and then control the level of SQL logging by configuring Hibernate's loggers (such as org.hibernate.SQL and org.hibernate.type).
Summarize
In a JBoss application server environment, controlling the log output level needs to be configured through JBoss's own logging subsystem, rather than just relying on the application's application.properties or JVM parameters. Via the JBoss CLI, the management console or directly editing the standalone.xml file are the primary ways to achieve this goal. At the same time, please be sure to pay attention to Hibernate's show_sql configuration, which directly controls the output of SQL statements and is two different control points from the level setting of the log framework. Understanding these mechanisms will help you manage and debug the log output of your JBoss applications more effectively.
The above is the detailed content of Complete guide to disabling DEBUG log output in JBoss/Log4j2 environment. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undress AI Tool
Undress images for free
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undresser.AI Undress
AI-powered app for creating realistic nude photos
ArtGPT
AI image generator for creative art from text prompts.
Stock Market GPT
AI powered investment research for smarter decisions
Hot Article
Popular tool
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
20529
7
13639
4
What is the core role of the collection framework in Java_Analysis of the original intention of Java collection design
Mar 11, 2026 pm 09:01 PM
The core of the Java collection framework is to solve the three major shortcomings of fixed array length, type insecurity, and redundant operations; it abstracts data relationships through interfaces (Collection is a "bundle of things", Map is "mapping rules"), and generics ensure compilation-time type safety, but implementation class switching may cause implicit performance degradation.
How to deploy Java production environment on Windows Server_Security enhancement and service-oriented configuration
Mar 11, 2026 pm 07:18 PM
The boundary between Java version selection and JRE/JDK must be clearly defined in the production environment. Do not use JDK. JRE must be installed on Windows Server—unless you really need diagnostic tools such as jps and jstack to run in the service process. The java.exe and javaw.exe that come with the JDK have the same behavior, but the extra bin directory in the JDK will increase the attack surface. Especially when misconfigured PATH causes the script to call javac.exe, it may be used to execute compiled malicious payloads. Download the build with jdk-xx.jre suffix from https://adoptium.net/ (such as temurin-17.0.2 8-jre), which is not the jdk package installation path.
JavaFX: Copy string contents to system clipboard
Mar 13, 2026 am 04:12 AM
This article details how to copy string contents to the system clipboard in a JavaFX application. By utilizing the javafx.scene.input.Clipboard and javafx.scene.input.ClipboardContent classes, developers can easily implement clipboard operations on text data. The article provides clear sample code and usage guidelines to ensure that readers can quickly master and apply this feature in their own projects to improve user experience.
Optimize the Controller layer: introduce DTO mapping and service calling abstraction layer
Apr 03, 2026 am 10:00 AM
This article discusses the introduction of an abstraction layer between the Controller and business services in order to solve the problems of overloaded responsibilities and code duplication in the Controller layer in Web application development. This layer is mainly responsible for the mapping of request DTOs and service input DTOs, service calls, and the mapping of service output DTOs and response DTOs. It achieves generalization through generic and functional programming, thereby improving the cleanliness, maintainability and testability of the code.
How to use Jayway JSONPath to extract parent node fields that meet child node conditions
Apr 04, 2026 am 09:45 AM
This article introduces how to accurately extract the parent node fields (such as empDetails.name) that "at least one child element meets the condition" in Jayway JSONPath, focusing on solving the practical problem of filtering parent objects based on Boolean child attributes in nested arrays.
Guide to checking the correlation between Gherkin steps and Java implementation in Cucumber
Apr 04, 2026 am 08:57 AM
This article aims to explore how to effectively check whether each step in the Gherkin function file has a corresponding Java code implementation in the Cucumber automated testing framework. We will introduce the real-time feedback mechanism provided by the IDE, the runtime detection capability of the Cucumber framework itself, and provide best practices to help developers promptly discover and correct unimplemented step definitions before the test is run or at the beginning of the run, thereby improving the robustness of the test and development efficiency.
How to correctly implement the variable parameter version of the greatest common divisor (GCD) algorithm and avoid array out-of-bounds
Apr 05, 2026 am 08:29 AM
This article explains in detail the root cause of the ArrayIndexOutOfBoundsException error that is common when using variable parameters (int...) to calculate the greatest common divisor of multiple integers in Java. It focuses on analyzing loop boundary defects and provides a robust, efficient, and scalable GCD implementation solution.
JSON Schema Advanced Tutorial: Conditional Required Validation Based on Nested Properties
Apr 05, 2026 am 08:30 AM
This tutorial takes an in-depth look at strategies for implementing complex conditional required validation in JSON Schema, specifically how to dynamically make another top-level property required based on the value of a nested property. By analyzing the correct usage of the if, then, and allOf keywords, we will correct common configuration errors and show how to apply conditional logic at the root level to precisely control the data structure, ensuring the accuracy and flexibility of JSON data validation.





