Java Utililty Methods Log Message

List of utility methods to do Log Message

Description

The list of methods to do Log Message are organized into topic(s).

Method

voidlog(boolean console, boolean file)
Configures the system log.
String filename = "log%g.txt";
int limit = 10000000; 
int numLogFiles = 5;
if (file) {
    FileHandler handler = new FileHandler(filename, limit, numLogFiles, true);
    handler.setFormatter(new SimpleFormatter());
    handler.setLevel(Level.ALL);
    Logger.getLogger("").addHandler(handler);
...
voidlog(final PrintStream logger, final Object message)
Write a message to the given print stream.
if (logger != null) {
    logger.println(message);
voidlog(final PrintStream logger, final String message)
log
final StringBuffer buf = new StringBuffer();
buf.append("[MANTIS] ").append(message);
logger.println(buf.toString());
voidlog(final String file, final String msg)
log
FileOutputStream out = null;
try {
    out = new FileOutputStream(file, true);
    out.write(msg.getBytes());
    out.write("\n------------------------\n".getBytes());
} catch (IOException ess) {
} finally {
    try {
...
voidlog(final String message, final String file)
Write in file - append.
FileWriter out = null;
try {
    out = new FileWriter(file, true);
    out.write(message);
} catch (IOException e) {
    e.printStackTrace();
} finally {
    if (out != null) {
...
voidlog(int physicalId, String message)
log
if (enabled)
    log("[" + physicalId + "] " + message);
voidlog(Object o, String msg)
log
log(System.out, "missing: o.getClass().getName()", msg);
voidLOG(Object... msgs)
Low maintenance logger
System.out.println(format(msgs));
voidlog(PrintWriter logger, String text)
log
if (logger != null) {
    logger.println(text);
    logger.flush();
System.out.println(text);
voidLog(String filename, String message)
Log
QuickAppend(GetLog(filename), message + LF());