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.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static final SimpleDateFormat timestampFormat = new SimpleDateFormat(
            "yyyy-MM-dd HH.mm.ss.SSS");
    public static String osType = System.getProperty("os.name")
            .toUpperCase().startsWith("Z/OS") ? "z/OS" : System
            .getProperty("os.name").toUpperCase().startsWith("WIN") ? "WIN"
            : "OTHER";

    public static void log(String msg) {
        if (osType.equals("z/OS")) {
            System.out.println(timestampFormat.format(new Date()) + ":"
                    + msg);/* www . j  ava 2s  .c  o m*/
        } else
            System.out.println("[" + timestampFormat.format(new Date())
                    + "] " + msg);
    }
}

Related

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