aeron-client/src/main/java/io/aeron/CommonContext.java
public int saveErrorLog(final PrintStream out, final ByteBuffer cncByteBuffer)
    {
        if (null == cncByteBuffer)
        {
            return 0;
        }

        final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor.createMetaDataBuffer(cncByteBuffer);
        final int cncVersion = cncMetaDataBuffer.getInt(CncFileDescriptor.cncVersionOffset(0));

        if (CNC_VERSION != cncVersion)
        {
            throw new AeronException(
                "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion);
        }

        int distinctErrorCount = 0;
        final AtomicBuffer buffer = CncFileDescriptor.createErrorLogBuffer(cncByteBuffer, cncMetaDataBuffer);
        if (ErrorLogReader.hasErrors(buffer))
        {
            final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
            final ErrorConsumer errorConsumer = (count, firstTimestamp, lastTimestamp, ex) ->
                formatError(out, dateFormat, count, firstTimestamp, lastTimestamp, ex);

            distinctErrorCount = ErrorLogReader.read(buffer, errorConsumer);
        }

        out.println();
        out.println(distinctErrorCount + " distinct errors observed.");

        return distinctErrorCount;
    }
public int saveErrorLog(final PrintStream out, final ByteBuffer cncByteBuffer)
    {
        if (null == cncByteBuffer)
        {
            return 0;
        }

        final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor.createMetaDataBuffer(cncByteBuffer);
        final int cncVersion = cncMetaDataBuffer.getInt(CncFileDescriptor.cncVersionOffset(0));

        if (CNC_VERSION != cncVersion)
        {
            throw new AeronException(
                "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion);
        }

        int distinctErrorCount = 0;
        final AtomicBuffer buffer = CncFileDescriptor.createErrorLogBuffer(cncByteBuffer, cncMetaDataBuffer);
        if (ErrorLogReader.hasErrors(buffer))
        {
            final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
            final ErrorConsumer errorConsumer = (count, firstTimestamp, lastTimestamp, ex) ->
                formatError(out, dateFormat, count, firstTimestamp, lastTimestamp, ex);

            distinctErrorCount = ErrorLogReader.read(buffer, errorConsumer);
        }

        out.println();
        out.println(distinctErrorCount + " distinct errors observed.");

        return distinctErrorCount;
    }
public int saveErrorLog ( final PrintStream out , final ByteBuffer cncByteBuffer ) { if ( null == cncByteBuffer ) { return 0 ; } final UnsafeBuffer cncMetaDataBuffer = CncFileDescriptor . createMetaDataBuffer ( cncByteBuffer ) ; final int cncVersion = cncMetaDataBuffer . getInt ( CncFileDescriptor . cncVersionOffset ( 0 ) ) ; if ( CNC_VERSION != cncVersion ) { throw new AeronException ( "Aeron CnC version does not match: required=" + CNC_VERSION + " version=" + cncVersion ) ; } int distinctErrorCount = 0 ; final AtomicBuffer buffer = CncFileDescriptor . createErrorLogBuffer ( cncByteBuffer , cncMetaDataBuffer ) ; if ( ErrorLogReader . hasErrors ( buffer ) ) { final SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.SSSZ" ) ; final ErrorConsumer errorConsumer = ( count , firstTimestamp , lastTimestamp , ex ) -> formatError ( out , dateFormat , count , firstTimestamp , lastTimestamp , ex ) ; distinctErrorCount = ErrorLogReader . read ( buffer , errorConsumer ) ; } out . println ( ) ; out . println ( distinctErrorCount + " distinct errors observed." ) ; return distinctErrorCount ; }
Read the error log to a given {@link PrintStream}

@param out           to write the error log contents to.
@param cncByteBuffer containing the error log.
@return the number of observations from the error log.
Read the error log to a given { @link PrintStream }