|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.jot.logger.JOTLogger
public class JOTLogger
Thi is a simple implementation of a logging system.
It is thread safe, and logs all to a single file (rotated at each restart)
Here are the existing levels:
TRACE_LEVEL=0
DEBUG_LEVEL=1
INFO_LEVEL=2
WARNING_LEVEL=3
ERROR_LEVEL=4
CRITICAL_LEVEL=5
| Field Summary | |
|---|---|
static java.lang.String |
CAT_DB
|
static java.lang.String |
CAT_FLOW
|
static java.lang.String |
CAT_MAIN
|
static int |
CRITICAL_LEVEL
|
static int |
DEBUG_LEVEL
|
static int |
ERROR_LEVEL
|
static int |
INFO_LEVEL
|
static int |
TRACE_LEVEL
|
static int |
WARNING_LEVEL
|
| Constructor Summary | |
|---|---|
JOTLogger()
|
|
| Method Summary | |
|---|---|
static void |
destroy()
Cleanup resources on exit. |
static java.util.Vector |
getLastLogEntries(java.util.Vector levels,
int max)
|
static void |
init(JOTPreferenceInterface prefs,
java.lang.String logFile)
|
static void |
init(JOTPreferenceInterface prefs,
java.lang.String folder,
java.lang.String logFile)
This is used to set the log file path and other options. |
static void |
init(java.lang.String fileName,
java.lang.String[] levels,
java.lang.String categories)
Manually init the logger |
static void |
log(int level,
java.lang.Object o,
java.lang.String message)
Log a message |
static void |
log(int level,
java.lang.Object o,
java.lang.String user,
java.lang.String message)
Log a message |
static void |
log(int level,
java.lang.String location,
java.lang.String message)
Log a message |
static void |
log(int level,
java.lang.String location,
java.lang.String user,
java.lang.String message)
Log a message |
static void |
log(java.lang.String cat,
int level,
java.lang.Object o,
java.lang.String message)
Log a message |
static void |
log(java.lang.String cat,
int level,
java.lang.Object o,
java.lang.String user,
java.lang.String message)
Log a message |
static void |
log(java.lang.String cat,
int level,
java.lang.String location,
java.lang.String message)
Log a message |
static void |
log(java.lang.String cat,
int level,
java.lang.String servletName,
java.lang.String user,
java.lang.String message)
Log a message |
static void |
logException(int level,
java.lang.Object o,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
logException(int level,
java.lang.String location,
java.lang.String user,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
logException(int level,
java.lang.String location,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
logException(java.lang.String category,
int level,
java.lang.Object o,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
logException(java.lang.String category,
int level,
java.lang.String servletName,
java.lang.String user,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
logException(java.lang.String category,
int level,
java.lang.String location,
java.lang.String message,
java.lang.Throwable e)
Log an exception |
static void |
setCategories(java.lang.String cat)
Set the categories to enable(null means all). |
static void |
setDefaultCategory(java.lang.String cat)
Sets the default logging category (ie: "Myapp") |
static void |
setLevels(java.lang.String[] levelString)
Sets the log level to be enabled (other levels won't be logged) levels can be like this: [0,1,2] 0, 1 and 2 |
static void |
setPrintStackTrace(boolean printStackTrace)
Wether to dump the exception stacktrace when logException is used |
static void |
setPrintToConcole(boolean printToConcole)
Wether to dump all errors to the console as well as the log file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int TRACE_LEVEL
public static final int DEBUG_LEVEL
public static final int INFO_LEVEL
public static final int WARNING_LEVEL
public static final int ERROR_LEVEL
public static final int CRITICAL_LEVEL
public static final java.lang.String CAT_MAIN
public static final java.lang.String CAT_DB
public static final java.lang.String CAT_FLOW
| Constructor Detail |
|---|
public JOTLogger()
| Method Detail |
|---|
public static void setDefaultCategory(java.lang.String cat)
cat - public static void setLevels(java.lang.String[] levelString)
levelString - The new level value
public static java.util.Vector getLastLogEntries(java.util.Vector levels,
int max)
throws java.lang.Throwable
java.lang.Throwable
public static void log(int level,
java.lang.Object o,
java.lang.String message)
level - mesaage level, ie: 0 for debugo - Object, the object name (ie: Myclass) will be logged as the "location"message -
public static void log(java.lang.String cat,
int level,
java.lang.Object o,
java.lang.String message)
cat - log category (ie: Myapp")level - log levelo - Object, the object name (ie: Myclass) will be logged as the "location"message -
public static void log(int level,
java.lang.Object o,
java.lang.String user,
java.lang.String message)
level - log levelo - Object, the object name (ie: Myclass) will be logged as the "location"user - If you want to track which user/ip the request came from pass it here.message -
public static void log(java.lang.String cat,
int level,
java.lang.Object o,
java.lang.String user,
java.lang.String message)
cat - log category (ie: Myapp")level - log levelo - Object, the object name (ie: Myclass) will be logged as the "location"user - If you want to track which user/ip the request came from pass it here.message -
public static void log(int level,
java.lang.String location,
java.lang.String message)
level - log levellocation - Where we logged that from (ie: class/servlet name)message -
public static void log(java.lang.String cat,
int level,
java.lang.String location,
java.lang.String message)
cat - log category (ie: Myapp")level - log levellocation - Where we logged that from (ie: class/servlet name)message -
public static void log(int level,
java.lang.String location,
java.lang.String user,
java.lang.String message)
level - log levellocation - Where we logged that from (ie: class/servlet name)user - If you want to track which user/ip the request came from pass it here.message -
public static void log(java.lang.String cat,
int level,
java.lang.String servletName,
java.lang.String user,
java.lang.String message)
cat - log category (ie: Myapp")level - log levellocation - Where we logged that from (ie: class/servlet name)user - If you want to track which user/ip the request came from pass it here.message -
public static void init(JOTPreferenceInterface prefs,
java.lang.String logFile)
public static void init(JOTPreferenceInterface prefs,
java.lang.String folder,
java.lang.String logFile)
prefs - Description of Parameter
public static void logException(int level,
java.lang.Object o,
java.lang.String message,
java.lang.Throwable e)
level - log levelo - Object, the object name (ie: Myclass) will be logged as the "location"message - e - Throwable/Exception that occured
public static void logException(java.lang.String category,
int level,
java.lang.Object o,
java.lang.String message,
java.lang.Throwable e)
cat - log category (ie: Myapp")level - log levelo - Object, the object name (ie: Myclass) will be logged as the "location"message - e - Throwable/Exception that occured
public static void logException(int level,
java.lang.String location,
java.lang.String message,
java.lang.Throwable e)
level - log levellocation - Where we logged that from (ie: class/servlet name)message - e - Throwable/Exception that occured
public static void logException(java.lang.String category,
int level,
java.lang.String location,
java.lang.String message,
java.lang.Throwable e)
cat - log category (ie: Myapp")level - log levellocation - Where we logged that from (ie: class/servlet name)message - e - Throwable/Exception that occured
public static void logException(int level,
java.lang.String location,
java.lang.String user,
java.lang.String message,
java.lang.Throwable e)
level - log levellocation - Where we logged that from (ie: class/servlet name)user - If you want to track which user/ip the request came from pass it here.message - e - Throwable/Exception that occured
public static void logException(java.lang.String category,
int level,
java.lang.String servletName,
java.lang.String user,
java.lang.String message,
java.lang.Throwable e)
cat - log category (ie: Myapp")level - log levellocation - Where we logged that from (ie: class/servlet name)user - If you want to track which user/ip the request came from pass it here.message - e - Throwable/Exception that occured
public static void init(java.lang.String fileName,
java.lang.String[] levels,
java.lang.String categories)
fileName - path to the log filelogLevel - log levels to enablecategories - categories to enable (null means all). ie: "JOT,MYAPP"public static void setCategories(java.lang.String cat)
cat - public static void setPrintToConcole(boolean printToConcole)
printToConcole - default falsepublic static void setPrintStackTrace(boolean printStackTrace)
printStackTrace - default truepublic static void destroy()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||