Enabling wire logs (Log4j2 properties) in WSO2 APIM 3.0.0

Nadee Poornima
2 min readDec 28, 2019
[1]. Image reference

You may know WSO2 APIM 3.0.0 is using Log4j2 instead of Log4j. The old APIM versions are using Log4j and enabling wire logs of old versions you can follow the steps here[2].

But to enable wire logs in the APIM 3.0.0, you need to follow the below steps.

The wire log uses to log all data transmitted to and from servers when executing HTTP requests.

Steps:

  1. Open the log4j2.properties file which resides in the <AM_HOME>/repository/conf directory
  2. Please find the below code lines in the log4j2.properties file.
logger.synapse-wire.name = org.apache.synapse.transport.http.wire
logger.synapse-wire.level = DEBUG

If they commented, please uncomment them(by default those codes are not commented).

3. As per the above code, logger name of wire is “synapse-wire”. Therefore please search whether this “synapse-wire” logger is available in the logger section. By default, the “synapse-wire” logger has not added in the logger section.

4. Then please add that logger to logger section as the first.

loggers = synapse-wire
logger section in log4j2.properties file

5. You do not need to restart the server to apply the changes, it will hot deploy and you could able to see the below logline in the wso2carbon.log file if it deployed successfully.

After this, you can try to invoke api and see the logs.

INFO — LoggingUpdaterServiceComponent Logging configuration applied successfully
Sample wire logs when invoking an API

I hope this will be a useful blog for you. Appreciate your claps and will meet with another blog soon :)

References

[1]. https://www.youtube.com/watch?v=SWHYrCXIL38

[2]. https://docs.wso2.com/display/AM210/Setting+Up+Logging

--

--