public synchronized int logUpload(String userKey, String testId, String logName, String buff, String dataType) {

        if (userKey == null || userKey.trim().isEmpty()) {
            BmLog.debug("Log cannot be uploaded, userKey is empty");
            return -1;
        }

        if (testId == null || testId.trim().isEmpty()) {
            BmLog.debug("Log cannot be uploaded, testId is empty");
            return -1;
        }

        Integer fileSize = -1;
        logName = logName.trim().isEmpty() ? "log" : logName;

        String url = this.urlManager.logUpload(Constants.APP_KEY, userKey, testId, logName, dataType);

        JSONObject obj = new JSONObject();
        try {
            obj.put(Constants.DATA, buff);
            JSONObject jo = getJson(Methods.POST, url, obj);
            if (jo.has("file_size"))
                fileSize = (Integer) jo.get("file_size");
            else
                BmLog.error("Failed to upload " + logName);
        } catch (JSONException e) {
            BmLog.error(e);
        }
        return fileSize;
    }