Examples of LogManager


Examples of java.util.logging.LogManager

        try {
            System.out.println("STARTUP: Trying to load logging configuration from file " + loggingConfigFile.toString());
            fileIn = new FileInputStream(loggingConfigFile);

            // loading the logger configuration from file
            final LogManager logManager = LogManager.getLogManager();
            logManager.readConfiguration(fileIn);

            // creating the logging directory
            String logPattern = logManager.getProperty("java.util.logging.FileHandler.pattern");
            int stripPos = logPattern.lastIndexOf(File.separatorChar);
            if (!new File(logPattern).isAbsolute()) logPattern = new File(dataPath, logPattern).getAbsolutePath();
            if (stripPos < 0) stripPos = logPattern.lastIndexOf(File.separatorChar);
            File log = new File(logPattern.substring(0, stripPos));
            if (!log.isAbsolute()) log = new File(dataPath, log.getPath());
View Full Code Here

Examples of java.util.logging.LogManager

   
    /**
     * Get any configuration properties set
     */
    private void configure() {
        final LogManager manager = LogManager.getLogManager();
        final String className = getClass().getName();
       
        final String level = manager.getProperty(className + ".level");
        setLevel((level == null) ? Level.INFO : Level.parse(level));
       
        final String filter = manager.getProperty(className + ".filter");
        setFilter(makeFilter(filter));
       
        final String formatter = manager.getProperty(className + ".formatter");
        setFormatter(makeFormatter(formatter));
       
        final String sizeString = manager.getProperty(className + ".size");
        this.size = parseSize(sizeString);
    }   
View Full Code Here

Examples of java.util.logging.LogManager

    public static boolean debug;
   
    public LogalizerHandler() {
        super();
       
        final LogManager manager = LogManager.getLogManager();
        final String className = getClass().getName();

        enabled = "true".equalsIgnoreCase(manager.getProperty(className + ".enabled"));
        debug = "true".equalsIgnoreCase(manager.getProperty(className + ".debug"));
    }
View Full Code Here

Examples of java.util.logging.LogManager

        }

        if (log4jLoggerClass == null) try {
            log4jGetLogger = null;
            log4jLogMethod = null;
            LogManager lm = LogManager.getLogManager();
            if (haveLoadedOurDefault || isDefaultJdkConfig()) {
                haveLoadedOurDefault = true;
                consoleHandler.setFormatter(
                        new BasicTextJdkLogFormatter(false));
                consoleHandler.setLevel(Level.INFO);
                lm.readConfiguration(
                        FrameworkLogger.class.getResourceAsStream(
                        "/org/hsqldb/resources/jdklogging-default.properties"));
                Logger cmdlineLogger = Logger.getLogger("org.hsqldb.cmdline");
                cmdlineLogger.addHandler(consoleHandler);
                cmdlineLogger.setUseParentHandlers(false);
            } else {
                // Do not intervene.  Use JDK logging exactly as configured by
                // user.
                lm.readConfiguration();
                // The only bad thing about doing this is that if the app has
                // programmatically changed the logging config after starting
                // the program but before using FrameworkLogger, we will
                // clobber those customizations.
            }
View Full Code Here

Examples of java.util.logging.LogManager

                "lib/logging.properties");
        if (!globalCfgFile.isFile()) {
            return false;
        }
        FileInputStream fis = null;
        LogManager lm = LogManager.getLogManager();
        try {
            fis = new FileInputStream(globalCfgFile);
            Properties defaultProps = new Properties();
            defaultProps.load(fis);
            Enumeration names = defaultProps.propertyNames();
            int i = 0;
            String name;
            String liveVal;
            while (names.hasMoreElements()) {
                i++;
                name = (String) names.nextElement();
                liveVal = lm.getProperty(name);
                if (liveVal == null) {
                    return false;
                }
                if (!lm.getProperty(name).equals(liveVal)) {
                    return false;
                }
            }
            return true;
        } catch (IOException ioe) {
View Full Code Here

Examples of java.util.logging.LogManager

  /**
   * Instantiates a new pattern formatter.
   */
  public PatternFormatter()
  {
    LogManager manager = LogManager.getLogManager();
    String cname = getClass().getName();

    timeFormat = manager.getProperty(cname + ".timeFormat");

    if (timeFormat == null)
    {
      timeFormat = "dd-MMM-yyy; HH:mm:ss";
    }
    setTimeFormat(timeFormat);

    logPattern = manager.getProperty(cname + ".logPattern");
    if (logPattern == null)
    {
      logPattern = "[{0} - {1}] {2}: {3} \n";
    }
    setLogPattern(logPattern);

    exceptionPattern = manager.getProperty(cname + ".exceptionPattern");
    if (exceptionPattern == null)
    {
      exceptionPattern = "[{0} - {1}] {2} {3} \nException in {4}: {6} \n{7} ";
    }
    setExceptionPattern(exceptionPattern);
View Full Code Here

Examples of java.util.logging.LogManager

            } catch (Throwable ex) {
                log.error(sm.getString("catalina.shutdownHookFail"), ex);
            } finally {
                // If JULI is used, shut JULI down *after* the server shuts down
                // so log messages aren't lost
                LogManager logManager = LogManager.getLogManager();
                if (logManager instanceof ClassLoaderLogManager) {
                    ((ClassLoaderLogManager) logManager).shutdown();
                }
            }

View Full Code Here

Examples of java.util.logging.LogManager

                Runtime.getRuntime().addShutdownHook(shutdownHook);
               
                // If JULI is being used, disable JULI's shutdown hook since
                // shutdown hooks run in parallel and log messages may be lost
                // if JULI's hook completes before the CatalinaShutdownHook()
                LogManager logManager = LogManager.getLogManager();
                if (logManager instanceof ClassLoaderLogManager) {
                    ((ClassLoaderLogManager) logManager).setUseShutdownHook(
                            false);
                }
            }
View Full Code Here

Examples of java.util.logging.LogManager

            if (useShutdownHook) {
                Runtime.getRuntime().removeShutdownHook(shutdownHook);

                // If JULI is being used, re-enable JULI's shutdown to ensure
                // log messages are not lost
                LogManager logManager = LogManager.getLogManager();
                if (logManager instanceof ClassLoaderLogManager) {
                    ((ClassLoaderLogManager) logManager).setUseShutdownHook(
                            true);
                }
            }
View Full Code Here

Examples of java.util.logging.LogManager

            Runtime.getRuntime().addShutdownHook(shutdownHook);

            // If JULI is being used, disable JULI's shutdown hook since
            // shutdown hooks run in parallel and log messages may be lost
            // if JULI's hook completes before the CatalinaShutdownHook()
            LogManager logManager = LogManager.getLogManager();
            if (logManager instanceof ClassLoaderLogManager) {
                ((ClassLoaderLogManager) logManager).setUseShutdownHook(
                        false);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.