use of io.confluent.ksql.util.QueryGuid in project ksql by confluentinc.
the class QueryLoggerTest method shouldContainAQueryID.
@Test
public void shouldContainAQueryID() {
String message = "my message";
String query = "DESCRIBE cat EXTENDED;";
QueryLogger.info(message, query);
testAppender.getLog().forEach((e) -> {
final QueryLoggerMessage msg = (QueryLoggerMessage) e.getMessage();
final QueryGuid queryGuid = msg.getQueryIdentifier();
assertThat(queryGuid.getStructuralGuid(), not(isEmptyOrNullString()));
assertThat(queryGuid.getQueryGuid(), not(isEmptyOrNullString()));
});
}
use of io.confluent.ksql.util.QueryGuid in project ksql by confluentinc.
the class QueryLogger method log.
private static void log(final Level level, final Object message, final String query) {
try {
final String anonQuery = anonymizeQueries ? anonymizer.anonymize(query) : query;
final QueryGuid queryGuids = buildGuids(query, anonQuery);
logger.log(level, buildPayload(message, anonQuery, queryGuids));
} catch (ParsingException e) {
if (logger.isDebugEnabled()) {
Logger.getRootLogger().log(Level.DEBUG, String.format("Failed to parse a query in query logger, message: %s", message));
}
}
}
Aggregations