Java Utililty Methods Log Exception

List of utility methods to do Log Exception

Description

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

Method

voidlogError(Exception e)
log Error
logError(e, "");
StringlogError(String s, Throwable e)
log Error
String msg = s + (e == null ? "" : ": " + e.toString());
echoln(msg);
if (e != null) {
    if (verbose)
        e.printStackTrace(System.out);
    if (logOut != null) {
        e.printStackTrace(logOut);
        logOut.flush();
...
voidlogException(Exception e, Logger logger)
log Exception
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
logger.error(sw.toString());
voidLogException(Exception ex)
Log Exception
PrintWriter out = null;
try {
    out = new PrintWriter(new BufferedWriter(new FileWriter("log.txt", true)));
    ex.printStackTrace(out);
} catch (IOException e) {
} finally {
    if (out != null) {
        out.close();
...
voidlogException(final Throwable exception)
log Exception
exception.printStackTrace(writer);
voidlogException(int type, String RID, String subRID, String propIndication, String error)
log Exception
FileWriter f = getFileWriter(type);
try {
    f.write("- [ ] [" + subRID + "](" + getUri(type, RID, subRID) + ") ");
    f.write("on property `" + propIndication + "`: " + error + "\n");
} catch (IOException e) {
    e.printStackTrace();
voidlogException(Logger logger, Level logLevel, Exception e)
Logs an exception with the given logger and the given level.
if (logger.isLoggable(logLevel))
    logger.log(logLevel, writeException(e));
voidlogException(Logger logger, String message, Throwable t)
log Exception
logger.warning(message);
logger.warning(excpToString(t));
voidlogException(Logger logger, Throwable t)
log Exception
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
logger.info(sw.toString());
voidLogException(String description, Throwable e)
Log Exception
File file = new File(getLogPath());
FileWriter writer = null;
BufferedWriter bufferedWriter = null;
try {
    writer = new FileWriter(file);
    bufferedWriter = new BufferedWriter(writer);
    bufferedWriter.flush();
    bufferedWriter.newLine();
...