|
soap tutorial | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectadriani.jws.template.util.ExternalLogger
public class ExternalLogger
The class managing the logging mechanism when using the Log4j library. Notice that in the Log4j paradigm
this class is not necessary, since any class should contain a class attribute like the following:
protected static Logger logger = Logger.getLogger(MyApp.class) ;
This project needs this class only to ensure compatibility with the logging system offered by the
SystemLogger
class, in this way it's possible to switch between the two logging system
simply changing the logger.type
property in the service configuration file.
SystemLogger
Field Summary | |
---|---|
protected java.lang.String |
datePattern
The rotation date pattern set for this logger. |
protected static java.lang.String |
leadingName
Beginning of each logging message printed on the STDOUT. |
protected java.lang.String |
loggerPath
The absolute log path retrieved from the configuration file. |
Constructor Summary | |
---|---|
ExternalLogger()
|
Method Summary | |
---|---|
boolean |
close()
NOT USED AT THE MOMENT (place holder). |
void |
createLogger(java.lang.String path,
java.util.logging.Level level,
boolean mode)
NOT USED AT THE MOMENT (place holder). |
java.lang.String |
getParentDir(java.lang.Object logger)
Return the parentDir path used as base directory to locate the log file. |
protected java.util.Properties |
getProperties(java.util.ResourceBundle resource)
Convert ResourceBundle into a Properties object. |
RotateThread |
getRotateThread()
Not used in current implementation, since roll over and rotation of the log file is performed automatically by the Log4j external module. |
java.lang.String |
getRotationTime(java.lang.Object logger)
Return the rotation time set for this logger, already formatted and ready to print. |
void |
init(java.lang.String path,
java.lang.String logLevel,
int rotate,
boolean mode)
This method forces the Logger to load configuration from the log4j.properties file. |
void |
rotate()
NOT USED AT THE MOMENT (place holder). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String loggerPath
protected java.lang.String datePattern
protected static java.lang.String leadingName
Constructor Detail |
---|
public ExternalLogger()
Method Detail |
---|
public void init(java.lang.String path, java.lang.String logLevel, int rotate, boolean mode)
log4j.properties
file.
init
in interface LoggerManager
path
- not used (required only to implement the LoggerManager
interface)logLevel
- not used (required only to implement the LoggerManager
interface)rotate
- not used (required only to implement the LoggerManager
interface)mode
- not used (required only to implement the LoggerManager
interface)public void createLogger(java.lang.String path, java.util.logging.Level level, boolean mode)
createLogger
in interface LoggerManager
path
- the path reference for the log filelevel
- the logging minimal level as a Logger.Level value (INFO, WARNING or SEVERE)mode
- if true
creates the standard log file, if false
creates the
benchmark analysis fileSystemLogger.getLogFile(String optionalPath, boolean mode)
public void rotate()
rotate
in interface LoggerManager
RotateThread
public boolean close()
close
in interface LoggerManager
public java.lang.String getParentDir(java.lang.Object logger)
parentDir
path used as base directory to locate the log file.root.getAllAppenders()
returns only the EXPLICIT appenders, and not the appenders
obtained from a parent logger. In this case we do not use the RootLogger, because we
assume the Log4j configuration file is something like:
log4j.additivity.template = false
log4j.additivity.template.db = false
log4j.additivity.template.service = false
log4j.logger.template = INFO, stdout, myfile
log4j.logger.template.db = INFO, stdout, myfile
log4j.logger.template.service = INFO, stdout, myfile
smartLogger.getAllAppenders()
.
getParentDir
in interface LoggerManager
logger
- a valid org.apache.log4j.Logger instance
public RotateThread getRotateThread()
getRotateThread
in interface LoggerManager
null
reference, since logger rotation is performed by Log4jpublic java.lang.String getRotationTime(java.lang.Object logger)
root.getAllAppenders()
returns only the EXPLICIT appenders, and not the appenders
obtained from a parent logger. In this case we do not use the RootLogger, because we
assume the Log4j configuration file is something like:
log4j.additivity.template = false
log4j.additivity.template.dba = false
log4j.additivity.template.logic = false
log4j.logger.template = INFO, stdout, myfile
log4j.logger.template.dba = INFO, stdout, myfile
log4j.logger.template.logic = INFO, stdout, myfile
smartLogger.getAllAppenders()
.
getRotationTime
in interface LoggerManager
logger
- a valid org.apache.log4j.Logger instance
protected java.util.Properties getProperties(java.util.ResourceBundle resource)
log4j.properties
file in the axis2\WEB-INF\classes
directory. This means that
all the Logger objects instantiated by the Axis2 classloader will use the configuration specified by
the log4j.properties
mentioned above. Hence, to avoid setting the logging configuration in
that file, we load our Log4j settings as a ResourceBundle
object and then we convert it
into a Properties
object.
resource
- the resource bundle to convert
|
Build 18/09/2012 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |