mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Making log warn/error messages not have unique values, but instead to use logPairs (for easier grouping in loggly)
This commit is contained in:
@ -38,6 +38,7 @@ import com.kingsrook.qqq.backend.core.state.InMemoryStateProvider;
|
|||||||
import com.kingsrook.qqq.backend.core.state.StateProviderInterface;
|
import com.kingsrook.qqq.backend.core.state.StateProviderInterface;
|
||||||
import com.kingsrook.qqq.backend.core.state.StateType;
|
import com.kingsrook.qqq.backend.core.state.StateType;
|
||||||
import com.kingsrook.qqq.backend.core.state.UUIDAndTypeStateKey;
|
import com.kingsrook.qqq.backend.core.state.UUIDAndTypeStateKey;
|
||||||
|
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -150,7 +151,7 @@ public class AsyncJobManager
|
|||||||
asyncJobStatus.setState(AsyncJobState.ERROR);
|
asyncJobStatus.setState(AsyncJobState.ERROR);
|
||||||
asyncJobStatus.setCaughtException(e);
|
asyncJobStatus.setCaughtException(e);
|
||||||
getStateProvider().put(uuidAndTypeStateKey, asyncJobStatus);
|
getStateProvider().put(uuidAndTypeStateKey, asyncJobStatus);
|
||||||
LOG.warn("Job " + uuidAndTypeStateKey.getUuid() + " ended with an exception: ", e);
|
LOG.warn("Job ended with an exception", e, logPair("jobId", uuidAndTypeStateKey.getUuid()));
|
||||||
throw (new CompletionException(e));
|
throw (new CompletionException(e));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -34,6 +34,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource;
|
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.automation.TableAutomationAction;
|
import com.kingsrook.qqq.backend.core.model.metadata.tables.automation.TableAutomationAction;
|
||||||
|
import static com.kingsrook.qqq.backend.core.logging.LogUtils.logPair;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -101,7 +102,7 @@ public class QCodeLoader
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
LOG.error("Error initializing customizer: " + codeReference);
|
LOG.error("Error initializing customizer", logPair("codeReference", codeReference), e);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
||||||
@ -140,7 +141,7 @@ public class QCodeLoader
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
LOG.error("Error initializing customizer: " + codeReference);
|
LOG.error("Error initializing customizer", logPair("codeReference", codeReference), e);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
||||||
@ -179,7 +180,7 @@ public class QCodeLoader
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
LOG.error("Error initializing customizer: " + codeReference);
|
LOG.error("Error initializing customizer", logPair("codeReference", codeReference), e);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
// return null here - under the assumption that during normal run-time operations, we'll never hit here //
|
||||||
|
@ -79,6 +79,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -497,7 +498,7 @@ public class BaseAPIActionUtil
|
|||||||
int statusCode = response.getStatusCode();
|
int statusCode = response.getStatusCode();
|
||||||
String resultString = response.getContent();
|
String resultString = response.getContent();
|
||||||
String errorMessage = "HTTP " + request.getMethod() + " for table [" + table.getName() + "] failed with status " + statusCode + ": " + resultString;
|
String errorMessage = "HTTP " + request.getMethod() + " for table [" + table.getName() + "] failed with status " + statusCode + ": " + resultString;
|
||||||
LOG.error(errorMessage);
|
LOG.error("HTTP " + request.getMethod() + " failed", logPair("table", table.getName()), logPair("statusCode", statusCode), logPair("responseContent", StringUtils.safeTruncate(resultString, 1024, "...")));
|
||||||
|
|
||||||
if("GET".equals(request.getMethod()))
|
if("GET".equals(request.getMethod()))
|
||||||
{
|
{
|
||||||
@ -919,7 +920,7 @@ public class BaseAPIActionUtil
|
|||||||
throw (new QException(rle));
|
throw (new QException(rle));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.warn("Caught RateLimitException [#" + rateLimitsCaught + "] during HTTP request to [" + request.getURI() + "] on table [" + table.getName() + "] - sleeping [" + sleepMillis + "]...");
|
LOG.info("Caught RateLimitException", logPair("rateLimitsCaught", rateLimitsCaught), logPair("uri", request.getURI()), logPair("table", table.getName()), logPair("sleeping", sleepMillis));
|
||||||
SleepUtils.sleep(sleepMillis, TimeUnit.MILLISECONDS);
|
SleepUtils.sleep(sleepMillis, TimeUnit.MILLISECONDS);
|
||||||
sleepMillis *= 2;
|
sleepMillis *= 2;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user