Java Log Message logString(String logtext)

Here you can find the source of logString(String logtext)

Description

log String

License

Open Source License

Declaration

public static void logString(String logtext) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class Main {
    public static void logString(String logtext) {
        File file = new File("outputs/log/log.txt");
        BufferedWriter bw = null;
        try {/*ww w . ja  v  a2 s .  c om*/
            // append mode = true
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
            bw.write(logtext + "\n");
            bw.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                bw.close();
            } catch (Exception ex) {
            }
            ;
        }
    }
}

Related

  1. logMessage(String message)
  2. LogMsg(PrintStream logger, String msg)
  3. logMsg(String msg)
  4. LogMsg(String s)
  5. logRawToConsole(String msg)
  6. logThis(String id)