|
Luky Library - 4.1.1 (20061117-1148) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectluky.util.Log
public class Log
The Log class has been created to facilitate in a standard interface to output
logging information to a device. The main advantage is that the program using
the logging class encapsulates no knownledge on the level to which logging is
required and to which output this logging should be directed.
Currently 6 levels of logging are defined:
setLogLeveL(<level>);
setModuleName(<moduleName>);
setOutput(Log.SCREEN, true);
print (<level>, "<text>");
setLogLeveL(<level>);
setModuleName(<moduleName>);
setFile("<file>", true);
setOutput(Log.FILE, true);
print (<level>, "<text>");
setModuleName(<moduleName>);
setDatabase("<url>","<driver>","<user>","<pass>");
setOutput(Log.FILE, true);
print (<level>, "<text>");
![]() |
![]() |
Field Summary | |
---|---|
static int |
CLEAN
constant representing CLEAN printing of the log |
static int |
DATABASE
constant representing DATABASE logging |
static int |
DEBUG
constant representing logging level 5 |
static int |
DETAIL
constant representing logging level 4 |
static int |
FATAL
constant representing logging level 1 |
static int |
FILE
constant representing FILE logging |
static int |
MAIL
constant representing MAIL logging |
static int |
MESSAGE
constant representing logging level 3 |
static int |
NONE
constant representing logging level 0 |
static int |
SCREEN
constant representing SCREEN logging |
static int |
STACK
constant representing logging level 6 |
static int |
TIMED
constant representing TIMED printing of the log |
static int |
WARNING
constant representing logging level 2 |
Constructor Summary | |
---|---|
Log()
default constructor |
Method Summary | |
---|---|
static int |
close()
close stops the logging, closes the logfiles if needed |
protected void |
finalize()
close stops the logging, closes the logfiles if needed |
static String |
getFile()
returns the file to which the logging is taking place |
static String |
getFormat()
returns the logging format |
static String |
getLogLevel()
returns the level of the logging |
static int |
getLogLevelValue()
returns the level of the logging |
static String |
getModuleName()
returns the name of module which is logging |
static boolean |
getOutput(int type)
returns the status of the output devices |
static int |
init()
Initializes the logging module, not required but handy. |
static int |
print(int printLevel,
String msg)
print, prints the message string to the installed output. |
static String |
removeQuotes(String msg)
takes a string and removes the quotes so "she said "hello"" becomes: "she said hello" |
static int |
setDatabase(String url,
String driver,
String user,
String password)
specifies the database parameters, it will try to connect to the database and fallback if needed. |
static int |
setFile(String file,
boolean append)
specifies the the logfile and if the tool should try to append to the file or reopen it. |
static int |
setFile(String file,
boolean append,
String backupFile,
long maxSize)
specifies the the logfile and if the tool should try to append to the file or reopen it and the backup file with roll over size |
static int |
setFormat(int type)
specifies the format used to log messages |
static void |
setLogFallBack(boolean enable)
specifies whether there is log fallback enabled (default off) |
static int |
setLogLevel(int newLevel)
specifies the log level (0..6) for the logging. |
static int |
setMail(String toAddress,
int newMailLevel)
specifies the the log level (0..6) for the mail logging, and the address to which the mail should be sent. |
static int |
setModuleName(String moduleName)
specifies the name used with each log print |
static int |
setOutput(int type,
boolean status)
sets the output on or of |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FILE
public static final int SCREEN
public static final int DATABASE
public static final int MAIL
public static final int NONE
public static final int FATAL
public static final int WARNING
public static final int MESSAGE
public static final int DETAIL
public static final int DEBUG
public static final int STACK
public static final int CLEAN
public static final int TIMED
Constructor Detail |
---|
public Log()
Method Detail |
---|
protected void finalize()
finalize
in class Object
public static int close()
public static int init()
public static void setLogFallBack(boolean enable)
enable
- true or falsepublic static int setLogLevel(int newLevel)
newLevel
- values are FATAL, WARNING, MESSAGE, DETAIL, DEBUG or STACK
public static int getLogLevelValue()
public static String getLogLevel()
public static int setOutput(int type, boolean status)
type
- constant specifying the LogType, values are FILE, SCREEN,
DATABASE or MAILstatus
- TRUE or FALSE
public static boolean getOutput(int type)
type
- constant specifying the LogType, values are FILE, SCREEN,
DATABASE or MAIL
public static int setFormat(int type)
type
- TIMED or CLEAN
public static String getFormat()
public static int setModuleName(String moduleName)
moduleName
- string specifying the name for the logging
public static int setDatabase(String url, String driver, String user, String password)
url
- the jdbc url that specifies the databasedriver
- the driver that is required. It must be on the classpath toouser
- the username for the databasepassword
- the password for the database user
public static int setMail(String toAddress, int newMailLevel)
toAddress
- the mail address to be usednewMailLevel
- values are FATAL, WARNING, MESSAGE, DETAIL, DEBUG or STACK
public static int setFile(String file, boolean append, String backupFile, long maxSize)
file
- the name used for the filebackupFile
- the name used for the backup filemaxSize
- the maximum size of the fileappend
- true or false
public static int setFile(String file, boolean append)
file
- the name used for the fileappend
- true or false
public static String getFile()
public static String getModuleName()
public static String removeQuotes(String msg)
msg
- the string that must be outputted
public static int print(int printLevel, String msg)
printLevel
- specifies the level for this print, legal values are
FATAL, WARNING, MESSAGE, DETAIL, DEBUG or STACKmsg
- the string that must be outputted
|
Luky Library - 4.1.1 (20061117-1148) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |