more changes to help reduce warnings that should probably be infos in loggly

This commit is contained in:
Tim Chamberlain
2023-05-23 10:11:54 -05:00
parent 7491e5f819
commit de74455de7
5 changed files with 35 additions and 6 deletions

View File

@ -505,8 +505,20 @@ public class BaseAPIActionUtil
int statusCode = response.getStatusCode();
String resultString = response.getContent();
String errorMessage = "HTTP " + request.getMethod() + " for table [" + table.getName() + "] failed with status " + statusCode + ": " + resultString;
LOG.error("HTTP " + request.getMethod() + " failed", logPair("table", table.getName()), logPair("statusCode", statusCode), logPair("responseContent", StringUtils.safeTruncate(resultString, 1024, "...")));
if("GET".equals(request.getMethod()))
{
////////////////////////////////////////////////////////////////////////////////////////
// bad gateways are not our fault and don't happen often, so just log an info on them //
////////////////////////////////////////////////////////////////////////////////////////
if(statusCode == HttpStatus.SC_BAD_GATEWAY)
{
LOG.info("HTTP " + request.getMethod() + " failed", logPair("table", table.getName()), logPair("statusCode", statusCode), logPair("responseContent", StringUtils.safeTruncate(resultString, 1024, "...")));
return;
}
}
LOG.warn("HTTP " + request.getMethod() + " failed", logPair("table", table.getName()), logPair("statusCode", statusCode), logPair("responseContent", StringUtils.safeTruncate(resultString, 1024, "...")));
if("GET".equals(request.getMethod()))
{
@ -516,7 +528,8 @@ public class BaseAPIActionUtil
}
}
throw (new QException(errorMessage));
String warningMessage = "HTTP " + request.getMethod() + " for table [" + table.getName() + "] failed with status " + statusCode + ": " + resultString;
throw (new QException(warningMessage));
}