0

I'm using WSO2 API Manager 2.1.0. Is it possible to maintain a separate log file for a specific API as required?

Thanks in advance.

2 Answers2

1

How about using the APILogMessageHandler? I don't know whether you can create a separate log file from it, but you can add api specific logs. You just need to add following handler to the synapse api file generated in <APIM_HOME>/repository/deployment/server/synapse-configs/default/api directory.

<handler class="org.wso2.carbon.apimgt.gateway.handlers.logging.APILogMessageHandler"/>

More information can be found in here. https://docs.wso2.com/display/AM210/Writing+Custom+Handlers

1

Other than creating a custom log handler. You can also consider creating a separate service logger for that API as mentioned here.

ycr
  • 12,828
  • 2
  • 25
  • 45
  • Thanks for the answer, Even though the logs were enabled using the handler, the log4j configurations mentioned in the doc for writing a separate log seems incompatible because wso2am-2.1.0 uses an old log4j file instead of a log4j2 file. – Lilan Mihiranga Jan 31 '23 at 06:38
  • @LilanMihiranga Sorry about that, I shared the wrong doc. Please refer this https://docs.wso2.com/display/EI650/Enabling+Logs+for+Services – ycr Feb 02 '23 at 01:03