List of utility methods to do Log to File
void | logError(ILog log, String message) Log the specified error. logError(log, null, message); |
void | logError(String message) log Error getErrStream().println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); getErrStream().println(formatMessage(message)); getErrStream().println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
void | logError(String msg) log Error System.err.println(getDateTime("yyyy-MM-dd HH:mm:ss") + ": " + msg); |
void | logErrPrint(String s) logPrintErr() prints the String s to System.err with a timestamp indicating the hour and minute it was printed. cal.setTimeInMillis(System.currentTimeMillis()); System.err .println(nf(cal.get(Calendar.HOUR_OF_DAY), 2) + ":" + nf(cal.get(Calendar.MINUTE), 2) + "| " + s); if (logger != null) logger.warning(s); |
void | logger(String s) logger System.out.println(formatter.format(new Date()) + " *** " + s); |
void | loggerOld(String s) logger Old try { BufferedWriter out = new BufferedWriter(new FileWriter("snagr.log", true)); Date d = new Date(); String dt = formatter.format(d); String outTxt = dt + " *** " + s + "\n"; System.out.print(outTxt); out.write(outTxt); out.close(); ... |
void | logInfo(ILog log, String message) Log the specified information. logInfo(log, message, new Object[0]);
|
String | logRecordToString(LogRecord record) log Record To String return new SimpleDateFormat("HH:mm:ss").format(record.getMillis()) + " [" + record.getLevel() + "] " + (record.getLoggerName() == null ? "" : "[" + record.getLoggerName() + "] ") + record.getMessage(); |
void | logToFile(String filePath, String message) If filepath is absolute, we append in that file If it is relative, we append in tmpDir+file.separator+filePath String logsAbsoluteFilePath; File testF = new File(filePath); if (testF.isAbsolute()) logsAbsoluteFilePath = filePath; else { String tmpDirPath = System.getProperty("java.io.tmpdir"); if (!tmpDirPath.endsWith(File.separator)) tmpDirPath += File.separator; ... |
void | logToFile(String string, String logFile) log To File logToFile(string, logFile, true, true); |