/** * Discard all the lines for the specified log channel id AND all the children. * * @param parentLogChannelId * the parent log channel id to be removed along with all its children. */ public static void discardLines( String parentLogChannelId, boolean includeGeneralMessages ) { LoggingRegistry registry = LoggingRegistry.getInstance(); MetricsRegistry metricsRegistry = MetricsRegistry.getInstance(); List<String> ids = registry.getLogChannelChildren( parentLogChannelId ); // Remove all the rows for these ids // LoggingBuffer bufferAppender = getInstance().appender; // int beforeSize = bufferAppender.size(); for ( String id : ids ) { // Remove it from the central log buffer // bufferAppender.removeChannelFromBuffer( id ); // Also remove the item from the registry. // registry.getMap().remove( id ); metricsRegistry.getSnapshotLists().remove( id ); metricsRegistry.getSnapshotMaps().remove( id ); } // Now discard the general lines if this is required // if ( includeGeneralMessages ) { bufferAppender.removeGeneralMessages(); } }
for ( String logChannelId : logChannelIds ) { Queue<MetricsSnapshotInterface> snapshotList = MetricsRegistry.getInstance().getSnapshotLists().get( logChannelId ); if ( snapshotList != null ) { Iterator<MetricsSnapshotInterface> iterator = snapshotList.iterator();