netudima commented on code in PR #4067:
URL: https://github.com/apache/cassandra/pull/4067#discussion_r2052280575
##########
src/java/org/apache/cassandra/db/monitoring/MonitoringTask.java:
##########
@@ -171,12 +194,27 @@ boolean logSlowOperations(long approxCurrentTimeNanos)
long approxElapsedNanos = approxCurrentTimeNanos -
approxLastLogTimeNanos;
noSpamLogger.info("Some operations were slow, details available at
debug level (debug.log)");
- if (logger.isDebugEnabled())
- logger.debug("{} operations were slow in the last {}
msecs:{}{}",
- slowOperations.num(),
- NANOSECONDS.toMillis(approxElapsedNanos),
- LINE_SEPARATOR,
- slowOperations.getLogMessage());
+ if (slowOperationsLogger.isDebugEnabled())
+ {
+ if (slowOperationsLoggedToVirtualTable)
+ {
+ // This is the crux of the patch for appending to vtable.
+ // Because we can send only String's to debug method (or
objects, on which toString()
+ // would be eventually called), we need to log a string in
such a way that we can
+ // get Operation object(s) back "on the other side" when
dealing with vtables and custom appenders
+ // as appenders work with LoggingEvent where message is
just a string.
+ // It would be very hard / tricky / error-prone to parse
customly crafted log message
+ // which appears in logs when no vtable appender is used.
+
slowOperationsLogger.debug(Operation.serialize(slowOperations.getOperations()));
+ }
+ else
+ slowOperationsLogger.debug("{} operations were slow in the
last {} msecs:{}{}",
Review Comment:
do we want to stop usual logging to a file log if a virtual table is
enabled? The usual log is still can be useful for offline analysis..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]