Java Log Message log(int physicalId, String message)

Here you can find the source of log(int physicalId, String message)

Description

log

License

Open Source License

Declaration

public static void log(int physicalId, String message) 

Method Source Code


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

import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

public class Main {
    private static volatile boolean enabled = false;

    public static void log(int physicalId, String message) {
        if (enabled)
            log("[" + physicalId + "] " + message);
    }/*  w  ww .  ja  v  a2  s  .c  om*/

    public static synchronized void log(String message) {
        //        System.out.println("should log " + message);
        if (enabled) {
            try {
                FileWriter fileWriter = new FileWriter("/tmp/pcj-ft-log", true);
                fileWriter.append(new Date().toString()).append("  ").append(message).append("\n");
                fileWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Related

  1. log(boolean console, boolean file)
  2. log(final PrintStream logger, final Object message)
  3. log(final PrintStream logger, final String message)
  4. log(final String file, final String msg)
  5. log(final String message, final String file)
  6. log(Object o, String msg)
  7. LOG(Object... msgs)
  8. log(PrintWriter logger, String text)
  9. Log(String filename, String message)