Java Log to File log(String msg)

Here you can find the source of log(String msg)

Description

log

License

Apache License

Declaration

public static void log(String msg) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    public static void log(String msg) {
        Date date = new Date();
        System.err.println("[" + DATE_FORMAT.format(date) + "] " + msg);
    }/*from ww w .  j a v a2  s .  c o m*/

    public static void log(String fmt, Object obj) {
        Date date = new Date();
        System.err.format("[" + DATE_FORMAT.format(date) + "] " + fmt + "\n", obj);
    }
}

Related

  1. log(String message)
  2. log(String message)
  3. log(String message, Exception e)
  4. log(String method, String message)
  5. log(String msg)
  6. log(String name, String message)
  7. log(String tag, T msg)
  8. logError(ILog log, String message)
  9. logError(String message)