FileDocCategorySizeDatePackage
LogService.javaAPI DocGlassfish v2 API4660Fri May 04 22:35:08 BST 2007com.sun.enterprise.tools.upgrade.logging

LogService

public class LogService extends Object
author : Servesh Singh

Fields Summary
public static final String
UPGRADE_LOGGER
public static final String
UPGRADE_CLI_LOGGER
public static final String
UPGRADE_CERTCONVERSION_LOGGER
public static final String
UPGRADE_GUI_LOGGER
public static final String
UPGRADE_COMMON_LOGGER
public static final String
UPGRADE_MISCCONFIG_LOGGER
public static final String
UPGRADE_TRANSFORM_LOGGER
public static final String
UPGRADE_REALM_LOGGER
private static LogFormatter
formatter
private static FileHandler
loghandler
private static final Level
DEFAULT_LEVEL
private static Level
logLevel
Constructors Summary
Methods Summary
public static voidaddLogMessageListener(LogMessageListener listener)

        formatter.addLogMessageListener(listener);
    
private static java.util.logging.LevelgetLogLevel()
private helper method to decipher the log level from the system property. Defaults to the statically defined field DEFAULT_LEVEL

        String logLevel = System.getProperty("com.sun.aas.utool.LogLevel");
        if (logLevel != null )
        {
            try{
                return Level.parse(logLevel);
            }catch(IllegalArgumentException  e) {
                 return DEFAULT_LEVEL;
            }
        }
        return DEFAULT_LEVEL;
    
public static java.util.logging.LoggergetLogger(java.lang.String name)

	Logger logger = Logger.getLogger(name);

        logger.setLevel(logLevel);
	Handler[] h = logger.getHandlers();
	for (int i = 0; i < h.length; i++) {
	    logger.removeHandler(h[i]);
	}
	logger.addHandler(loghandler);
        loghandler.setLevel(logLevel);
	return logger;
    
public static voidinitialize(java.lang.String fileName)



          
	LogManager.getLogManager().reset();
	formatter = new LogFormatter();
    boolean append = true;
    int limit = 1000000;
    loghandler = new FileHandler(fileName,limit,1,append);
    logLevel =  getLogLevel();
    loghandler.setLevel(logLevel );
	loghandler.setFormatter(formatter);
    
public static voidremoveLogMessageListener(LogMessageListener listener)

	formatter.removeLogMessageListener(listener);