org.apache.log.Hierarchy类的使用及代码示例

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

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

Hierarchy介绍

[英]This class encapsulates a basic independent log hierarchy. The hierarchy is essentially a safe wrapper around root logger.
[中]此类封装了基本的独立日志层次结构。层次结构本质上是根记录器的安全包装器。

代码示例

代码示例来源: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.apache.excalibur.testcase/excalibur-testcase

Priority lmPriority = Priority.getPriorityForName( lmLogLevel );
DefaultLogKitManager logKitManager = new DefaultLogKitManager();
Logger lmLogger = Hierarchy.getDefaultHierarchy().getLoggerFor( lmLoggerName );
lmLogger.setPriority( lmPriority );
logKitManager.enableLogging( new LogKitLogger( lmLogger ) );
logKitManager.configure( confLM );
Hierarchy h = logKitManager.getHierarchy();
h.setDefaultPriority( lmPriority );
m_logKitManager = logKitManager;

代码示例来源: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: org.apache.excalibur.containerkit/excalibur-logger

m_hierarchy.setDefaultPriority( Priority.getPriorityForName( loglevel ) );
  m_hierarchy.setDefaultLogTargets( logTargets );
  m_hierarchy.getLoggerFor( fullCategory );
m_loggers.put( fullCategory, logger );
if( getLogger().isDebugEnabled() )

代码示例来源:origin: org.apache.avalon.framework/avalon-framework-impl

final Hierarchy hierarchy = new Hierarchy();
final org.apache.log.Logger logKitLogger = hierarchy.getLoggerFor( "" );
final LogKit2AvalonLoggerAdapter target =
  new LogKit2AvalonLoggerAdapter( logger );

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

logger = m_hierarchy.getRootLogger();
rootLoggerConfigured = true;
logger = m_hierarchy.getLoggerFor( fullCategory );

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

m_hierarchy = new Hierarchy();
m_hierarchy.getRootLogger().unsetLogTargets( true );
final ErrorHandler errorHandler = new OurErrorHandler( getLogger() );
m_hierarchy.setErrorHandler( errorHandler );

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

/**
 * Creates a new <code>DefaultLogKitManager</code>. It will use a new <code>Hierarchy</code>.
 */
public DefaultLogKitManager()
{
  this( new Hierarchy() );
}

代码示例来源:origin: org.apache.avalon.logkit/avalon-logkit

/**
 * Retrieve a logger for named category.
 *
 * @param category the context
 * @return the Logger
 */
public Logger getLoggerFor( final String category )
{
  return getRootLogger().getChildLogger( category );
}

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

/**
 * Return the Logger for the specified category.
 * <p>
 *
 * In LogKit getRootLogger() and getLoggerFor("")
 * unless the logger for category "" has been explicitly
 * configured return identically configured but different
 * loggers.
 *
 * <p>
 * Our LogKitConfHelper configures getRootLogger(), not getLoggerFor("").
 * We think this is a reasonable behavior and expect that LogKit
 * Hierarchies configured by other means then LogKitConfHelper are
 * configured in the same way.
 * 
 * <p>
 * This justifies our decision to return getRootLogger() when given
 * "" category name.
 */
public Logger getLoggerForCategory( final String categoryName )
{
  if ( categoryName == null || categoryName.length() == 0 )
  {
    return getDefaultLogger();
  }
  else
  {
    return new LogKitLogger( m_hierarchy.getLoggerFor( categoryName ) );
  }
}

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

m_hierarchy.setDefaultPriority( Priority.getPriorityForName( loglevel ) );
  m_hierarchy.setDefaultLogTargets( logTargets );
  rootLoggerAlive = true;
final org.apache.log.Logger logger = m_hierarchy.getLoggerFor( fullCategory );
m_loggers.put( fullCategory, new LogKitLogger( logger ) );
if( getLogger().isDebugEnabled() )

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

/**
 * Creates a new <code>DefaultLogKitManager</code> using
 * specified logger name as root logger.
 */
public DefaultLogKitManager( final String prefix )
{
  this( prefix, new Hierarchy() );
}

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

/**
   * Return the default Logger.  This is basically the same
   * as getting the Logger for the "" category.
   */
  public Logger getDefaultLogger()
  {
    return new LogKitLogger( m_hierarchy.getRootLogger() );
  }
}

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

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

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

/**
 * Retrieves a Logger from a category name. Usually
 * the category name refers to a configuration attribute name.  If
 * this LogKitManager does not have the match the default Logger will
 * be returned and a warning is issued.
 *
 * @param categoryName  The category name of a configured Logger.
 * @return the Logger.
 */
public final Logger getLogger( final String categoryName )
{
  final Logger logger = (Logger)m_loggers.get( categoryName );
  if( null != logger )
  {
    if( getLogger().isDebugEnabled() )
    {
      getLogger().debug( "Logger for category " + categoryName + " returned" );
    }
    return logger;
  }
  if( getLogger().isDebugEnabled() )
  {
    getLogger().debug( "Logger for category " + categoryName
              + " not defined in configuration. New Logger created and returned" );
  }
  return m_hierarchy.getLoggerFor( categoryName );
}

代码示例来源:origin: stackoverflow.com

Hierarchy hie = new Hierarchy(){}; // this is new implementation for Hierarchy

代码示例来源:origin: org.apache.avalon.logkit/avalon-logkit

/**
 * Set the default log target for hierarchy.
 * This is the target inherited by loggers if no other target is specified.
 *
 * @param target the default target
 */
public void setDefaultLogTarget( final LogTarget target )
{
  if( null == target )
  {
    throw new IllegalArgumentException( "Can not set DefaultLogTarget to null" );
  }
  final LogTarget[] targets = new LogTarget[]{target};
  getRootLogger().setLogTargets( targets );
}

代码示例来源: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: org.apache.excalibur.component/excalibur-component

m_loggerManager.getLoggerForCategory( categoryName );
final org.apache.log.Logger logkitLogger =
  getHierarchy().getLoggerFor( categoryName );
final LogKit2AvalonLoggerAdapter target =
  new LogKit2AvalonLoggerAdapter( logger );

代码示例来源:origin: stackoverflow.com

Hierarchy hie1 = new Hierarchy();// this will call the constructor of the class

相关文章