FileDocCategorySizeDatePackage
LogWrap.javaAPI DocGlassfish v2 API4620Fri May 04 22:31:20 BST 2007com.sun.enterprise.corba.ee.internal.util

LogWrap

public class LogWrap extends Object

Fields Summary
public static final Logger
logger
private static final String
LOGDOMAINS_CLASS_NAME
private static final String
GET_LOGGER_METHOD_NAME
private static final String
ORB_LOGGER_FIELD_NAME
private static final String
ORB_LOGGER_NAME
private static final String
ORB_LOGGER_RESOURCE_BUNDLE
Constructors Summary
Methods Summary
private static java.util.logging.LoggergetLoggerUsingJavaLoggingAPI()

        Logger lgr = Logger.getLogger(ORB_LOGGER_NAME, ORB_LOGGER_RESOURCE_BUNDLE);
        
        return lgr;
    
private static java.util.logging.LoggergetLoggerUsingLogDomainsAPI()

    
     
        // use a temp variable so that 'logger' may be 'final'
        Logger tempLogger=null;
        
        try {
            tempLogger = getLoggerUsingLogDomainsAPI();
            if (tempLogger == null) {
                System.out.println("Could not initialize LogDomains logger");
            }
        } catch (Exception ex) {
            System.out.println("Could not initialize LogDomains logger");
        }                

        if (tempLogger == null) {
            try {
                tempLogger = getLoggerUsingJavaLoggingAPI();
                if (tempLogger == null) {
                    System.out.println("Could not initialize JDK logger");
                }
            } catch (Exception ex) {
                System.out.println("Could not initialize JDK logger");
                ex.printStackTrace();
            }
        }
        logger = tempLogger;
    
        Class logDomainsClass = Class.forName(LOGDOMAINS_CLASS_NAME);

        Class [] parameterClasses = new Class[1];
        parameterClasses[0] = String.class;
        Method getLoggerMethod = logDomainsClass.getDeclaredMethod(
                GET_LOGGER_METHOD_NAME, parameterClasses);

        Field orbLoggerNameField = logDomainsClass.getDeclaredField(
                ORB_LOGGER_FIELD_NAME);
        String orbLoggerName = (String)orbLoggerNameField.get(null);

        Object [] parameters = new Object[1];
        parameters[0] = orbLoggerName;
        Logger lgr = (Logger)getLoggerMethod.invoke(null, parameters);

        return lgr;