Java Log Exception LogException(Exception ex)

Here you can find the source of LogException(Exception ex)

Description

Log Exception

License

BSD License

Declaration

public static void LogException(Exception ex) 

Method Source Code

//package com.java2s;
// LICENSE:       This file is distributed under the BSD license.

import java.io.BufferedWriter;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class Main {
    public static void LogException(Exception ex) {
        PrintWriter out = null;/*from   www .j  a va  2 s .com*/
        try {
            out = new PrintWriter(new BufferedWriter(new FileWriter(
                    "log.txt", true)));
            ex.printStackTrace(out);
        } catch (IOException e) {
        } finally {
            if (out != null) {
                out.close();
            }
        }
    }
}

Related

  1. logError(Exception e)
  2. logError(String s, Throwable e)
  3. logException(Exception e, Logger logger)
  4. logException(final Throwable exception)
  5. logException(int type, String RID, String subRID, String propIndication, String error)
  6. logException(Logger logger, Level logLevel, Exception e)
  7. logException(Logger logger, String message, Throwable t)