Java Log to File logError(String msg)

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

Description

log Error

License

Open Source License

Declaration

public synchronized static void logError(String msg) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public synchronized static void logError(String msg) {
        System.err.println(getDateTime("yyyy-MM-dd HH:mm:ss") + ": " + msg);
    }/*w w  w.  j ava2 s .c o  m*/

    /**
     * Formats and returns a string containing the current date & time
     * @return current data + time
     */
    public static String getDateTime(String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);

        Date date = new Date();

        return dateFormat.format(date);
    }
}

Related

  1. log(String msg)
  2. log(String name, String message)
  3. log(String tag, T msg)
  4. logError(ILog log, String message)
  5. logError(String message)
  6. logErrPrint(String s)
  7. logger(String s)
  8. loggerOld(String s)
  9. logInfo(ILog log, String message)