Logging
This section describes how to record content to logs in a business program.
1. Log levels and logging contents
| Log level | Logging contents | Development | Test | Operation |
|---|---|---|---|---|
TRACE |
Indicates more detailed information than the DEBUG trace level. |
O |
X |
X |
DEBUG |
Outputs logs for debugging purposes in the development environment. |
O |
X |
X |
INFO |
Outputs only messages for test and verification purposes. |
O |
O |
X |
WARN |
Outputs contents that need to be checked by an operator in the operation environment. |
O |
O |
O |
ERROR |
Outputs contents when an error (failure, abnormality) occurs. |
O |
O |
O |
-
As the log level decreases in the order TRACE > DEBUG > INFO > WARN > ERROR, the amount of output decreases.
-
Logs recorded at a lower level are also output at higher levels. (When the server setting is DEBUG, logs coded with INFO are also output.)
2. Logging method
Use org.slf4j.Logger, and declare the logger object as a member variable as shown below.
private final Logger logger = LoggerFactory.getLogger(this.getClass());
trace, debug, info, warn, error methods
// Fixed string logging
logger.debug("Logging content");
// IO object logging
logger.debug("Logging content : {}", input);
// Logging N items
logger.debug("Content1 : {}, Content2 : {}, Content3 : {}", input.getEmpNo(), input.getEmpNm(), input.getHireDt());
Logging an Exception object
logger.error("Error during acceptance processing", e);
3. Changing the log level
Log levels can be changed by accessing BXM Web Admin and using the [Online Management - Transaction Parameter Management] menu.
System log level: The currently configured system log level, which defines the level of logs output in the system (framework) area. DEFAULT means that it follows the system default settings.
Job log level: The currently configured job log level, which defines the level of logs output in the business area. DEFAULT means that it follows the system default settings.
DB log level: The currently configured DB log level, which defines the level of logs output by DBIO. DEFAULT means that it follows the system default settings.