vanetsim
Class ErrorLog

java.lang.Object
  extended by vanetsim.ErrorLog

public final class ErrorLog
extends java.lang.Object

Helper Class for error logging.


Constructor Summary
ErrorLog()
           
 
Method Summary
static void deleteOld(long loggerTrashtime, java.lang.String loggerDir)
          Deletes old logfiles (uses file modification time to determine which files are old)
static void log(java.lang.String message, int severity, java.lang.String errClass, java.lang.String errMethod, java.lang.Exception e)
          Logs an error.
static void setParameters(int level, java.lang.String dir, java.lang.String format)
          Sets the parameters for the static class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorLog

public ErrorLog()
Method Detail

setParameters

public static void setParameters(int level,
                                 java.lang.String dir,
                                 java.lang.String format)
Sets the parameters for the static class.

Parameters:
level - the minimum level for error messages. If the severity of an error is lower than this value, nothing is logged.
dir - the directory where the error log files are located
format - the format of the log files (txt or xml)

log

public static void log(java.lang.String message,
                       int severity,
                       java.lang.String errClass,
                       java.lang.String errMethod,
                       java.lang.Exception e)
Logs an error.

Parameters:
message - error message
severity - error severity in scale of 1-7. A higher value stands for a more severe error (Finest, Finer, Fine, Config, Info, Warning, Severe)
errClass - class where the error occured
errMethod - method in which the error occured
e - the exception (use null if you don't have one)

deleteOld

public static void deleteOld(long loggerTrashtime,
                             java.lang.String loggerDir)
Deletes old logfiles (uses file modification time to determine which files are old)

Parameters:
loggerTrashtime - maximum age (in days) for a log file. Older files are deleted.
loggerDir - directory where to delete files