added getAPIResponseLogLevel as base method that can be overridden in subsclasses

This commit is contained in:
Tim Chamberlain
2024-02-07 09:18:57 -06:00
parent 8e8d3b5d2b
commit c0b5d11a09

View File

@ -96,6 +96,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.Level;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair; import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
@ -1081,7 +1082,7 @@ public class BaseAPIActionUtil
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// trim response body (just to keep logs smaller, or, in case someone consuming logs doesn't want such long lines) // // trim response body (just to keep logs smaller, or, in case someone consuming logs doesn't want such long lines) //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LOG.debug("Received successful response with code [" + qResponse.getStatusCode() + "] and content [" + StringUtils.safeTruncate(qResponse.getContent(), getMaxResponseMessageLengthForLog(), "...") + "]."); LOG.log(getAPIResponseLogLevel(), "Received successful response with code [" + qResponse.getStatusCode() + "] and content [" + StringUtils.safeTruncate(qResponse.getContent(), getMaxResponseMessageLengthForLog(), "...") + "].");
return (qResponse); return (qResponse);
} }
} }
@ -1507,4 +1508,14 @@ public class BaseAPIActionUtil
// nothing to do at this layer, meant to be overridden by subclasses // // nothing to do at this layer, meant to be overridden by subclasses //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
} }
/*******************************************************************************
**
*******************************************************************************/
protected Level getAPIResponseLogLevel() throws QException
{
return (Level.DEBUG);
}
} }