Logs in WSO2 EI 6.6.0
Logging is one of the most important aspects of a production-grade server. A properly configured logging system is vital for identifying errors, security threats, and usage patterns. Separate log files are created in the /repository/logs
directory (of the ESB profile, Message Broker profile, and the ESB profile of WSO2 EI) for each of the log types.
Carbon logs
The Carbon log file (wso2carbon.log
) covers all the management features of a product. Carbon logs are configured in the log4j2.properties
file (stored in the /conf
directory). The Carbon log file is enabled in the product by default as shown below. You can configure the details that are captured in this log file by configuring log4j2 properties.
# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout. appender.CARBON_LOGFILE.type = RollingFile appender.CARBON_LOGFILE.name = CARBON_LOGFILE appender.CARBON_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/wso2carbon.log appender.CARBON_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/wso2carbon-%d{MM-dd-yyyy}.log appender.CARBON_LOGFILE.layout.type = PatternLayout appender.CARBON_LOGFILE.layout.pattern = [%d] %5p {%c} - %m%ex%n appender.CARBON_LOGFILE.policies.type = Policies appender.CARBON_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy appender.CARBON_LOGFILE.policies.time.interval = 1 appender.CARBON_LOGFILE.policies.time.modulate = true appender.CARBON_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy appender.CARBON_LOGFILE.policies.size.size=10MB appender.CARBON_LOGFILE.strategy.type = DefaultRolloverStrategy appender.CARBON_LOGFILE.strategy.max = 20 appender.CARBON_LOGFILE.filter.threshold.type = ThresholdFilter appender.CARBON_LOGFILE.filter.threshold.level = DEBUG
Audit logs
Audit logs are used for tracking the sequence of actions that affect a particular task carried out on the server. These are also configured in the log4j2.properties
file (stored in the /conf
directory).
Audit logs are enabled in the product by default as shown below. You can configure the details that are captured in this log file by configuring log4j2 properties.
# Appender config to AUDIT_LOGFILE appender.AUDIT_LOGFILE.type = RollingFile appender.AUDIT_LOGFILE.name = AUDIT_LOGFILE appender.AUDIT_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/audit.log appender.AUDIT_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/audit-%d{MM-dd-yyyy}.log appender.AUDIT_LOGFILE.layout.type = PatternLayout appender.AUDIT_LOGFILE.layout.pattern = TID: [%d] %5p {%c} - %m%ex%n appender.AUDIT_LOGFILE.policies.type = Policies appender.AUDIT_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy appender.AUDIT_LOGFILE.policies.time.interval = 1 appender.AUDIT_LOGFILE.policies.time.modulate = true appender.AUDIT_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy appender.AUDIT_LOGFILE.policies.size.size=10MB appender.AUDIT_LOGFILE.strategy.type = DefaultRolloverStrategy appender.AUDIT_LOGFILE.strategy.max = 20 appender.AUDIT_LOGFILE.filter.threshold.type = ThresholdFilter appender.AUDIT_LOGFILE.filter.threshold.level = INFO
Patch logs
These logs contain details related to patches applied to the product. Patch logs cannot be customized.
Service/Event Tracing logs
These are logs that are enabled in WSO2 Enterprise Integrator for tracing services and events using a separate log file (wso2carbon-trace-messages.log
). If server/event tracing logs are used in your product, you can configure them in the log4j2.properties
file (stored in the /conf
directory).
A separate log file for tracing services/events are enabled for certain WSO2 products in the log4j2.properties
file using a specific appender. These logs are published to a file named wso2carbon-trace-messages.log
.
# Appender config to CARBON_TRACE_LOGFILE appender.CARBON_TRACE_LOGFILE.type = RollingFile appender.CARBON_TRACE_LOGFILE.name = CARBON_TRACE_LOGFILE appender.CARBON_TRACE_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/wso2carbon-trace-messages.log appender.CARBON_TRACE_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/wso2carbon-trace-messages-%d{MM-dd-yyyy}.log appender.CARBON_TRACE_LOGFILE.layout.type = PatternLayout appender.CARBON_TRACE_LOGFILE.layout.pattern = [%d] %5p {%c} - %m%ex%n appender.CARBON_TRACE_LOGFILE.policies.type = Policies appender.CARBON_TRACE_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy appender.CARBON_TRACE_LOGFILE.policies.time.interval = 1 appender.CARBON_TRACE_LOGFILE.policies.time.modulate = true appender.CARBON_TRACE_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy appender.CARBON_TRACE_LOGFILE.policies.size.size=10MB appender.CARBON_TRACE_LOGFILE.strategy.type = DefaultRolloverStrategy appender.CARBON_TRACE_LOGFILE.strategy.max = 20
See instructions on configuring log4j2 properties.
HTTP Access logs
HTTP requests/responses are logged to monitor the activities related to an application's usage. HTTP access logs help you monitor information such as the persons who access the product, how many hits are received, what the errors are, etc. This information is useful for troubleshooting errors.
In the ESB profile of WSO2 EI, access logs can be generated for the PassThrough transport. The PassThrough transport works on 8290/8253 ports and is used for API/Service invocations. By default, the access logs from the PassThrough transport are written to a common access log file located in the EI_HOME/repository/logs/
directory.
See instructions on monitoring access logs for the ESB profile.
Wire logs (for the ESB profile)
You can enable wire logs in the ESB profile to monitor HTTP messages that flow through the ESB. Please note that wire logs should be enabled for troubleshooting purposes only. It is not recommended to run production systems with wire logs enabled. Please see Enabling wire logs in the Debugging Mediation documentation.
Please note that wire logs should be enabled for troubleshooting purposes only. It is not recommended to run production systems with wire logs enabled.
Uncomment the following log appender in the <EI_HOME>/conf/log4j2.properties
file to enable wire logs for the passthrough HTTP transport:
logger.synapse-transport-http-wire.name=org.apache.synapse.transport.http.wire logger.synapse-transport-http-wire.level=DEBUG logger.synapse-transport-http-wire.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE
Add your logger name into the section called “loggers” (synapse-transport-http-wire)
loggers = synapse-transport-http-wire, AUDIT_LOG, SERVICE_LOGGER, trace-messages,
Restart the server
Callout mediator (or call mediator with blocking="true") uses the Axis2 CommonsHTTPSender
to invoke services. It does not leverage the non-blocking NHTTP/passthrough transports. Therefore, you need to add the following entries to the log appender above to enable wire logs for the callout mediator.
logger.httpclient-wire-header.name=httpclient.wire.header logger.httpclient-wire-header.level=DEBUG logger.httpclient-wire-header.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE # logger.httpclient-wire-content.name=httpclient.wire.content logger.httpclient-wire-content.level=DEBUG logger.httpclient-wire-content.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE
Add your logger name into the section called “loggers” (httpclient-wire-header, httpclient-wire-content)
In order to read the wire logs, you must first identify message direction.
DEBUG - wire >> | Represents the message coming into the Integrator from the wire |
---|---|
DEBUG - wire << | Represents the message that goes to the wire from the Integrator. |
With the introduction of log4j2, Log view and change log level features in the management console were removed in EI 6.6.0. Only the log view feature is released back as a product update on the 09/04/2020. You can get the latest updates using WSO2 Update Manager