org.shlublu.javax.log
Class ApplicationLog

java.lang.Object
  |
  +--org.shlublu.javax.log.ApplicationLog

public class ApplicationLog
extends java.lang.Object

Creation : 20 oct 2001 Convenience class : helps to manage logs using org.apache.log4j
In case of logfile, this one is created using the ApplicationName (see below) and a timestamp to define its name. The logged events are horodated using the "%d{yy-MM-dd hh:mm:ss} [%-5p] (%t:%rms) %m%n" layout.

Since:
0.1

Field Summary
static int LOG_CONSOLE
          Log device : console
static int LOG_FILE
          Log device : file
static int LOG_NONE
          No device to log to
 
Method Summary
 org.apache.log4j.Category cat()
          Return the Category corresponding to construction given class class name (see ctors for details)
 void disable(int iFlagsToRemove)
          Log modification : disable some log devices
static ApplicationLog getInstance(java.lang.String strClassName, java.lang.String strAppName)
          ApplicationLog factory.
static ApplicationLog getInstance(java.lang.String strClassName, java.lang.String strAppName, int iFl)
          ApplicationLog factory.
static java.lang.String getTrace(java.lang.Throwable t)
          Print the given Throwable's stack trace in the returned String.
 void restore(int iFlagsToRemove)
          Log modification : restore some disabled log devices
 void start(Version version)
          Initialize the log and writes the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_NONE

public static int LOG_NONE
No device to log to

LOG_FILE

public static int LOG_FILE
Log device : file

LOG_CONSOLE

public static int LOG_CONSOLE
Log device : console
Method Detail

getInstance

public static ApplicationLog getInstance(java.lang.String strClassName,
                                         java.lang.String strAppName)
ApplicationLog factory. See class specs and CTors for details and params

getInstance

public static ApplicationLog getInstance(java.lang.String strClassName,
                                         java.lang.String strAppName,
                                         int iFl)
ApplicationLog factory. See class specs and CTors for details and params

cat

public org.apache.log4j.Category cat()
Return the Category corresponding to construction given class class name (see ctors for details)

disable

public void disable(int iFlagsToRemove)
Log modification : disable some log devices
Parameters:
int - iFlagsToRemove flag combination
See Also:
restore(int)

restore

public void restore(int iFlagsToRemove)
Log modification : restore some disabled log devices
Parameters:
int - iFlagsToRemove flag combination
See Also:
disable(int)

start

public void start(Version version)
           throws java.io.IOException
Initialize the log and writes the header.
The entries are logged following the pattern "%d{yy-MM-dd hh:mm:ss} [%-5p] (%t:%rms) %m%n".
Create the appenders corresponding to the asked LOG_xxx devices. In case of logfile, the name is created using the following SimpleDateFormat : "'" + strApp + "'yy-MM-dd_hh'h'mm'm'ss's.log'"
See Also:
org.apache.log4j.PatternLayout, Appender, SimpleDateFormat

getTrace

public static java.lang.String getTrace(java.lang.Throwable t)
Print the given Throwable's stack trace in the returned String.