|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stratelia.silverpeas.silvertrace.SilverLog
public class SilverLog
SilverLog is the trace tool used in silverpeas to log the users' connexions. This is a 'fully' static class. All functions could be called directly and is thread-safe. The log function is : log.
Field Summary | |
---|---|
static int |
APPENDER_ALL
Used to remove all appenders attached to this module |
static int |
APPENDER_CONSOLE
Appender sending informations on console |
static int |
APPENDER_FILE
Appender sending informations on file |
static int |
APPENDER_MAIL
Appender sending informations mail |
static int |
APPENDER_ROLLING_FILE
Appender sending informations on rolling file |
protected static org.apache.log4j.Logger |
currentLogger
|
static String |
LAYOUT_DETAILED
Detailed layout : Display "Time / Priority / Calling Class and module / Message" |
static String |
LAYOUT_FULL_DEBUG
Fully detailed layout : Display "Tic count / Time / Priority / Thread / Calling Class and module / Message" |
static String |
LAYOUT_HTML
HTML layout : Display "Time / Thread / Priority / Category / Message" into a TABLE |
static String |
LAYOUT_SHORT
Short layout : Display "Time / Priority / Message" |
protected static String |
layoutDetailed
|
protected static String |
layoutFullDebug
|
protected static String |
layoutShort
|
protected static String |
logDir
|
protected static String |
logModule
|
static String |
ROLLING_MODE_DAILY
The trace file will be copied every day at midnight with the name : FileName.ext.year-mounth-day A new file named FileName.ext is the created and will contains the next day's traces Example : MyFile.txt.2001-07-23 |
static String |
ROLLING_MODE_HOUR
The trace file will be copied every hour with the name : FileName.ext.year-mounth-day-hour A new file named FileName.ext is the created and will contains the next hour's traces Example : MyFile.txt.2001-07-23-18 |
static String |
ROLLING_MODE_MOUNTH
The trace file will be copied every 1st day of a mounth with the name : FileName.ext.year-mounth A new file named FileName.ext is the created and will contains the next mounth's traces Example : MyFile.txt.2001-07 |
static String |
ROLLING_MODE_WEEK
The trace file will be copied every 1st day of a week with the name : FileName.ext.year-week A new file named FileName.ext is the created and will contains the next week's traces Example : MyFile.txt.2001-34 |
static int |
TRACE_LEVEL_DEBUG
Debug-level traces |
static int |
TRACE_LEVEL_ERROR
Error-level traces |
static int |
TRACE_LEVEL_FATAL
Fatal-level traces |
static int |
TRACE_LEVEL_INFO
Info-level traces |
static int |
TRACE_LEVEL_UNKNOWN
Used in setTraceLevel to reset a level trace |
static int |
TRACE_LEVEL_WARN
Warning-level traces |
Constructor Summary | |
---|---|
SilverLog()
|
Method Summary | |
---|---|
protected static void |
addAppenderConsole(String patternLayout,
String consoleName)
Add a new console appender. |
protected static void |
addAppenderFile(String patternLayout,
String fileName,
boolean appendOnFile)
Add a new file appender. |
protected static void |
addAppenderFromBundle(ResourceBundle resource,
int appenderNumber,
int appenderType)
Read appender information from a property file and attach it to it's module |
protected static void |
addAppenderMail(String patternLayout,
String mailHost,
String mailFrom,
String mailTo,
String mailSubject)
Add a new mail appender. |
protected static void |
addAppenderRollingFile(String patternLayout,
String fileName,
String rollingMode)
Add a new rolling file appender. |
protected static String |
formatTraceMessage(String message,
String adresseIP,
String userLogin)
Format the trace message to send to log4j |
protected static String |
getAppenderName(int typeOfAppender)
Return the name of the appender depending on it's attached module and type |
protected static org.apache.log4j.Layout |
getLayout(String patternLayout)
Return the layout object depending on it's name |
protected static void |
initAll()
Init all appenders |
static void |
initFromBundle(ResourceBundle resource)
Loads the configuration from the resource given in argument. |
static void |
logConnexion(String message,
String ipAddress,
String userLogin)
Log connexion informations. |
protected static void |
removeAppender(int typeOfAppender)
Remove appender(s). typeOfAppender could be one value or a mask of multiple appender types |
protected static String |
translateFileName(String fileName)
Translate the @ErrorDir@ into the real value |
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_UNKNOWN
public static final int TRACE_LEVEL_DEBUG
public static final int TRACE_LEVEL_INFO
public static final int TRACE_LEVEL_WARN
public static final int TRACE_LEVEL_ERROR
public static final int TRACE_LEVEL_FATAL
public static final int APPENDER_CONSOLE
addAppenderConsole(java.lang.String, java.lang.String)
,
removeAppender(int)
,
Constant Field Valuespublic static final int APPENDER_FILE
addAppenderFile(java.lang.String, java.lang.String, boolean)
,
removeAppender(int)
,
Constant Field Valuespublic static final int APPENDER_ROLLING_FILE
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
removeAppender(int)
,
ROLLING_MODE_MOUNTH
,
ROLLING_MODE_WEEK
,
ROLLING_MODE_DAILY
,
ROLLING_MODE_HOUR
,
Constant Field Valuespublic static final int APPENDER_MAIL
addAppenderMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
removeAppender(int)
,
Constant Field Valuespublic static final int APPENDER_ALL
removeAppender(int)
,
Constant Field Valuespublic static final String LAYOUT_HTML
addAppenderConsole(java.lang.String, java.lang.String)
,
addAppenderFile(java.lang.String, java.lang.String, boolean)
,
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
addAppenderMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String LAYOUT_SHORT
addAppenderConsole(java.lang.String, java.lang.String)
,
addAppenderFile(java.lang.String, java.lang.String, boolean)
,
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
addAppenderMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String LAYOUT_DETAILED
addAppenderConsole(java.lang.String, java.lang.String)
,
addAppenderFile(java.lang.String, java.lang.String, boolean)
,
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
addAppenderMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String LAYOUT_FULL_DEBUG
addAppenderConsole(java.lang.String, java.lang.String)
,
addAppenderFile(java.lang.String, java.lang.String, boolean)
,
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
addAppenderMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ROLLING_MODE_MOUNTH
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ROLLING_MODE_WEEK
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ROLLING_MODE_DAILY
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuespublic static final String ROLLING_MODE_HOUR
addAppenderRollingFile(java.lang.String, java.lang.String, java.lang.String)
,
Constant Field Valuesprotected static org.apache.log4j.Logger currentLogger
protected static String logDir
protected static String logModule
protected static final String layoutShort
protected static final String layoutDetailed
protected static final String layoutFullDebug
Constructor Detail |
---|
public SilverLog()
Method Detail |
---|
public static void logConnexion(String message, String ipAddress, String userLogin)
message
- login/logoutipAddress
- of the connected clientuserLogin
- of the connected clientprotected static void initAll()
public static void initFromBundle(ResourceBundle resource)
resource
- the properties to merge with the current configurationprotected static void addAppenderFromBundle(ResourceBundle resource, int appenderNumber, int appenderType)
resource
- appenderNumber
- appenderType
- protected static void addAppenderConsole(String patternLayout, String consoleName)
patternLayout
- the things displayed in this appender, could be one of the LAYOUT_...
constantsconsoleName
- Name of the console output. If null or "", "system.out" is usedprotected static void addAppenderFile(String patternLayout, String fileName, boolean appendOnFile)
patternLayout
- the things displayed in this appender, could be one of the LAYOUT_...
constantsfileName
- full-path name of the file where the trace are writtenappendOnFile
- true to append at the end of the existing file (if ther is one), false to
remove old file before writtingprotected static void addAppenderRollingFile(String patternLayout, String fileName, String rollingMode)
patternLayout
- the things displayed in this appender, could be one of the LAYOUT_...
constantsfileName
- full-path name of the file where the trace are writtenrollingMode
- frequency of the rolling file, could be one of the ROLLING_MODE_...
constantsprotected static void addAppenderMail(String patternLayout, String mailHost, String mailFrom, String mailTo, String mailSubject)
patternLayout
- the things displayed in this appender, could be one of the LAYOUT_...
constantsmailHost
- host namemailFrom
- email of the sendermailTo
- target email, could be multiple targets separeted with comasmailSubject
- subject of the mailprotected static void removeAppender(int typeOfAppender)
typeOfAppender
- could be a mask of APPENDER_... values or APPENDER_ALL to remove all
appenders attached to the moduleprotected static String formatTraceMessage(String message, String adresseIP, String userLogin)
protected static String translateFileName(String fileName)
fileName
- protected static org.apache.log4j.Layout getLayout(String patternLayout)
patternLayout
-
protected static String getAppenderName(int typeOfAppender)
typeOfAppender
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |