use of org.apache.cassandra.utils.binlog.BinLog in project cassandra by apache.
the class FullQueryLogger method stop.
public synchronized void stop() {
try {
BinLog binLog = this.binLog;
if (binLog != null) {
logger.info("Stopping full query logging to {}", binLog.path);
binLog.stop();
} else {
logger.info("Full query log already stopped");
}
} catch (InterruptedException e) {
throw new UncheckedInterruptedException(e);
} finally {
QueryEvents.instance.unregisterListener(this);
this.binLog = null;
}
}
use of org.apache.cassandra.utils.binlog.BinLog in project cassandra by apache.
the class FullQueryLogger method querySuccess.
/**
* Log a single CQL query
* @param query CQL query text
* @param queryOptions Options associated with the query invocation
* @param queryState Timestamp state associated with the query invocation
* @param queryTimeMillis Approximate time in milliseconds since the epoch since the batch was invoked
* @param response the response from this query
*/
public void querySuccess(CQLStatement statement, String query, QueryOptions queryOptions, QueryState queryState, long queryTimeMillis, Message.Response response) {
Preconditions.checkNotNull(query, "query was null");
Preconditions.checkNotNull(queryOptions, "queryOptions was null");
Preconditions.checkNotNull(queryState, "queryState was null");
Preconditions.checkArgument(queryTimeMillis > 0, "queryTimeMillis must be > 0");
// Don't construct the wrapper if the log is disabled
BinLog binLog = this.binLog;
if (binLog == null)
return;
Query wrappedQuery = new Query(query, queryOptions, queryState, queryTimeMillis);
binLog.logRecord(wrappedQuery);
}
use of org.apache.cassandra.utils.binlog.BinLog in project cassandra by apache.
the class BinAuditLogger method log.
@Override
public void log(AuditLogEntry auditLogEntry) {
BinLog binLog = this.binLog;
if (binLog == null || auditLogEntry == null) {
return;
}
binLog.logRecord(new Message(auditLogEntry.getLogString()));
}
use of org.apache.cassandra.utils.binlog.BinLog in project cassandra by apache.
the class FullQueryLogger method batchSuccess.
/**
* Log an invocation of a batch of queries
* @param type The type of the batch
* @param statements the prepared cql statements (unused here)
* @param queries CQL text of the queries
* @param values Values to bind to as parameters for the queries
* @param queryOptions Options associated with the query invocation
* @param queryState Timestamp state associated with the query invocation
* @param batchTimeMillis Approximate time in milliseconds since the epoch since the batch was invoked
* @param response the response from the batch query
*/
public void batchSuccess(BatchStatement.Type type, List<? extends CQLStatement> statements, List<String> queries, List<List<ByteBuffer>> values, QueryOptions queryOptions, QueryState queryState, long batchTimeMillis, Message.Response response) {
Preconditions.checkNotNull(type, "type was null");
Preconditions.checkNotNull(queries, "queries was null");
Preconditions.checkNotNull(values, "value was null");
Preconditions.checkNotNull(queryOptions, "queryOptions was null");
Preconditions.checkNotNull(queryState, "queryState was null");
Preconditions.checkArgument(batchTimeMillis > 0, "batchTimeMillis must be > 0");
// Don't construct the wrapper if the log is disabled
BinLog binLog = this.binLog;
if (binLog == null) {
return;
}
Batch wrappedBatch = new Batch(type, queries, values, queryOptions, queryState, batchTimeMillis);
binLog.logRecord(wrappedBatch);
}
Aggregations