boolean open(String newFileName) {
            lastFileName = newFileName;
            logFile = new File(folderPath, newFileName);

            // Create log file if not exists.
            if (!logFile.exists()) {
                try {
                    File parent = logFile.getParentFile();
                    if (!parent.exists()) {
                        parent.mkdirs();
                    }
                    logFile.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                    lastFileName = null;
                    logFile = null;
                    return false;
                }
            }

            // Create buffered writer.
            try {
                bufferedWriter = new BufferedWriter(new FileWriter(logFile, true));
            } catch (Exception e) {
                e.printStackTrace();
                lastFileName = null;
                logFile = null;
                return false;
            }
            return true;
        }
Open the file of specific name to be written into.

@param newFileName the specific file name
@return true if opened successfully, false otherwise
android/android_framework/base/src/main/java/com/elvishew/xlog/printer/file/FilePrinter.java