org.apache.log.Hierarchy.getLoggerFor()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.apache.log.Hierarchy.getLoggerFor()方法的一些代码示例,展示了Hierarchy.getLoggerFor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hierarchy.getLoggerFor()方法的具体详情如下:
包路径:org.apache.log.Hierarchy
类名称:Hierarchy
方法名:getLoggerFor

Hierarchy.getLoggerFor介绍

[英]Retrieve a logger for named category.
[中]检索命名类别的记录器。

代码示例

代码示例来源:origin: commons-logging/commons-logging

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: org.freemarker/freemarker

public Logger getLogger(String category) {
  return new AvalonLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(category));
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * <p>Return the underlying Logger we are using.</p>
 */
public Logger getLogger() {
  if (logger == null) {
    logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
  }
  return (logger);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.logging

/**
 * <p>Return the underlying Logger we are using.</p>
 */
public Logger getLogger() {
  if (logger == null) {
    logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
  }
  return (logger);
}

代码示例来源:origin: org.apache.excalibur.containerkit/excalibur-logger

/**
 * Actually create a logger for the given category.
 * The result will be cached by
 * <code>AbstractLoggerManager.getLoggerForCategory()</code>.
 */
protected Logger doGetLoggerForCategory( final String fullCategoryName )
{
  return new LogKitLogger( m_hierarchy.getLoggerFor( fullCategoryName ) );
}

代码示例来源:origin: apache/activemq-artemis

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: org.apache.tomcat.extras/tomcat-extras-juli-adapters

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: apache/activemq-artemis

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Return the underlying Logger we are using.
 */
public Logger getLogger() {
  Logger result = logger;
  if (result == null) {
    synchronized(this) {
      result = logger;
      if (result == null) {
        logger = result = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
      }
    }
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

public Logger getLogger(String category) {
  return new AvalonLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(category));
}

代码示例来源:origin: org.freemarker/com.springsource.freemarker

public Logger getLogger(String category)
{
  return new AvalonLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(category));
}

代码示例来源:origin: org.freemarker/freemarker-gae

public Logger getLogger(String category) {
  return new AvalonLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(category));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity

/**
 * @param file
 * @throws Exception
 * @deprecated This method should not be used. It is here only to provide
 *             backwards compatibility for the deprecated AvalonLogSystem
 *             class, in case anyone used it and this method directly.
 */
public void init(String file) throws Exception
{
  logger = Hierarchy.getDefaultHierarchy().getLoggerFor(rsvc.toString());
  initTarget(file, null);
  // nag the theoretical user
  log(DEBUG_ID, "You shouldn't be using the init(String file) method!");
}

代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity

/**
 * @param file
 * @throws Exception
 * @deprecated This method should not be used. It is here only to provide
 *             backwards compatibility for the deprecated AvalonLogSystem
 *             class, in case anyone used it and this method directly.
 */
public void init(String file) throws Exception
{
  logger = Hierarchy.getDefaultHierarchy().getLoggerFor(rsvc.toString());
  initTarget(file, null);
  // nag the theoretical user
  log(DEBUG_ID, "You shouldn't be using the init(String file) method!");
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity

/**
 * @see org.apache.velocity.runtime.log.LogChute#init(org.apache.velocity.runtime.RuntimeServices)
 */
public void init(RuntimeServices rs) throws Exception
{
  this.rsvc = rs;
  // if a logger is specified, we will use this instead of the default
  String name = (String)rsvc.getProperty(AVALON_LOGGER);
  if (name != null)
  {
    this.logger = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
  }
  else
  {
    // use the toString() of RuntimeServices to make a unique logger
    logger = Hierarchy.getDefaultHierarchy().getLoggerFor(rsvc.toString());
    // if we have a file property, use it to create a FileTarget
    String file = (String)rsvc.getProperty(RuntimeConstants.RUNTIME_LOG);
    if (StringUtils.isNotEmpty(file))
    {
      initTarget(file, rsvc);
    }
  }
}

代码示例来源:origin: velocity/velocity-dep

/**
 *  initializes the log system using the logfile argument
 *
 *  @param logFile   file for log messages
 */
public void init(String logFile)
  throws Exception
{
/*
 *  make our FileTarget.  Note we are going to keep the 
 *  default behavior of not appending...
 */
  FileTarget target = new FileTarget( new File( logFile), 
          false, 
          new VelocityFormatter("%{time} %{message}\\n%{throwable}" ) );
    /*
   *  use the toString() of RuntimeServices to make a unique logger
   */
  logger = Hierarchy.getDefaultHierarchy().getLoggerFor( rsvc.toString() );
  logger.setPriority( Priority.DEBUG );
  logger.setLogTargets( new LogTarget[] { target } );
}

相关文章