Java Log Message log(String fmt, Object... args)

Here you can find the source of log(String fmt, Object... args)

Description

log

License

Open Source License

Declaration

public static void log(String fmt, Object... args) 

Method Source Code

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

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    private static FileWriter fw;

    public static void log(String fmt, Object... args) {
        try {/*w  w w . j  a  v  a 2s .com*/
            if (fw == null) {
                fw = new FileWriter("client.log.txt");
            }
            fw.append(String.format("%-4d %s\n",
                    System.currentTimeMillis() % 10000,
                    String.format(fmt, args)));
            fw.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. log(int physicalId, String message)
  2. log(Object o, String msg)
  3. LOG(Object... msgs)
  4. log(PrintWriter logger, String text)
  5. Log(String filename, String message)
  6. log(String line)
  7. log(String message)
  8. log(String message)
  9. log(String message, PrintStream out)