org.eclipse.jetty.util.log.JavaUtilLog Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
//
// ========================================================================
// Copyright (c) 1995-2018 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.util.log;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import org.eclipse.jetty.util.Loader;
/**
*
* Implementation of Jetty {@link Logger} based on {@link java.util.logging.Logger}.
*
*
*
* You can also set the logger level using
* standard java.util.logging configuration.
*
*
* Configuration Properties:
*
* - ${name|hierarchy}.LEVEL=(ALL|DEBUG|INFO|WARN|OFF)
* -
* Sets the level that the Logger should log at.
* Names can be a package name, or a fully qualified class name.
* Default: The default from the java.util.logging mechanism/configuration
*
* - org.eclipse.jetty.util.log.javautil.PROPERTIES=<property-resource-name>
* - If set, it is used as a classpath resource name to find a java.util.logging
* property file.
*
* Default: null
*
* - org.eclipse.jetty.util.log.javautil.SOURCE=(true|false)
* - Set the LogRecord source class and method for JavaUtilLog.
* Default: true
*
* - org.eclipse.jetty.util.log.SOURCE=(true|false)
* - Set the LogRecord source class and method for all Loggers.
* Default: depends on Logger class
*
*
*/
public class JavaUtilLog extends AbstractLogger
{
private final static String THIS_CLASS= JavaUtilLog.class.getName();
private final static boolean __source =
Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.SOURCE",
Log.__props.getProperty("org.eclipse.jetty.util.log.javautil.SOURCE","true")));
private static boolean _initialized=false;
private Level configuredLevel;
private java.util.logging.Logger _logger;
public JavaUtilLog()
{
this("org.eclipse.jetty.util.log.javautil");
}
public JavaUtilLog(String name)
{
synchronized (JavaUtilLog.class)
{
if (!_initialized)
{
_initialized=true;
final String properties=Log.__props.getProperty("org.eclipse.jetty.util.log.javautil.PROPERTIES",null);
if (properties!=null)
{
AccessController.doPrivileged(new PrivilegedAction