lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/logger/api/LogPersister.java
private synchronized static void captureToFile (final JSONObject jsonObject, Logger.LEVEL calledLevel) {
        boolean cap = getCaptureSync();
        boolean analyticsCap = getAnalyticsCaptureSync();

        if (context == null) {
            if (!context_null_msg_already_printed) {
                Log.w(LOG_TAG_NAME, CONTEXT_NULL_MSG);
                context_null_msg_already_printed = true;
            }
            return;
        }

        if (jsonObject.length() == 0) {
            return;
        }

        try {
            // Determine whether is needs to go to analytics or logger
            if (analyticsCap && calledLevel.equals(Logger.LEVEL.ANALYTICS)) {
                fileLoggerInstance.log(jsonObject, ANALYTICS_FILENAME);
            } else if (cap) {
                fileLoggerInstance.log(jsonObject, FILENAME);
            }
        } catch (Exception e) {
            Log.e(LOG_TAG_NAME, "An error occurred capturing data to file.", e);
        }
    }
private synchronized static void captureToFile (final JSONObject jsonObject, Logger.LEVEL calledLevel) {
        boolean cap = getCaptureSync();
        boolean analyticsCap = getAnalyticsCaptureSync();

        if (context == null) {
            if (!context_null_msg_already_printed) {
                Log.w(LOG_TAG_NAME, CONTEXT_NULL_MSG);
                context_null_msg_already_printed = true;
            }
            return;
        }

        if (jsonObject.length() == 0) {
            return;
        }

        try {
            // Determine whether is needs to go to analytics or logger
            if (analyticsCap && calledLevel.equals(Logger.LEVEL.ANALYTICS)) {
                fileLoggerInstance.log(jsonObject, ANALYTICS_FILENAME);
            } else if (cap) {
                fileLoggerInstance.log(jsonObject, FILENAME);
            }
        } catch (Exception e) {
            Log.e(LOG_TAG_NAME, "An error occurred capturing data to file.", e);
        }
    }
private synchronized static void captureToFile ( final JSONObject jsonObject , Logger . LEVEL calledLevel ) { boolean cap = getCaptureSync ( ) ; boolean analyticsCap = getAnalyticsCaptureSync ( ) ; if ( context == null ) { if ( ! context_null_msg_already_printed ) { Log . w ( LOG_TAG_NAME , CONTEXT_NULL_MSG ) ; context_null_msg_already_printed = true ; } return ; } if ( jsonObject . length ( ) == 0 ) { return ; } try { // Determine whether is needs to go to analytics or logger if ( analyticsCap && calledLevel . equals ( Logger . LEVEL . ANALYTICS ) ) { fileLoggerInstance . log ( jsonObject , ANALYTICS_FILENAME ) ; } else if ( cap ) { fileLoggerInstance . log ( jsonObject , FILENAME ) ; } } catch ( Exception e ) { Log . e ( LOG_TAG_NAME , "An error occurred capturing data to file." , e ) ; } }
We only persist (append) to the log file if the passed jsonObject parameter has data,
the Logger capture flag is set to true, and the log file size is less than
FILE_SIZE_LOG_THRESHOLD.

@param jsonObject the object to write into the log file.
We only persist ( append ) to the log file if the passed jsonObject parameter has data the Logger capture flag is set to true and the log file size is less than FILE_SIZE_LOG_THRESHOLD .