当前位置: 首页>>代码示例>>Java>>正文


Java Hierarchy类代码示例

本文整理汇总了Java中org.apache.log.Hierarchy的典型用法代码示例。如果您正苦于以下问题:Java Hierarchy类的具体用法?Java Hierarchy怎么用?Java Hierarchy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Hierarchy类属于org.apache.log包,在下文中一共展示了Hierarchy类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
    *  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 } );
   }
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:26,代码来源:AvalonLogSystem.java

示例2: setTarget

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Sets the default log target from the parameter. The existing target is
 * first closed if necessary.
 *
 * @param targetFile
 *            (Writer)
 */
private static synchronized void setTarget(Writer targetFile) {
    if (target == null) {
        target = getTarget(targetFile, getFormat());
        isTargetSystemOut = isWriterSystemOut;
    } else {
        if (!isTargetSystemOut && target instanceof WriterTarget) {
            ((WriterTarget) target).close();
        }
        target = getTarget(targetFile, getFormat());
        isTargetSystemOut = isWriterSystemOut;
    }
    Hierarchy.getDefaultHierarchy().setDefaultLogTarget(target);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:21,代码来源:LoggingManager.java

示例3: addLogTargetToRootLogger

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Add logTargets to root logger
 * FIXME What's the clean way to add a LogTarget afterwards ?
 * @param logTargets LogTarget array
 */
public static void addLogTargetToRootLogger(LogTarget[] logTargets) {
    LogTarget[] newLogTargets = new LogTarget[logTargets.length+1];
    System.arraycopy(logTargets, 0, newLogTargets, 1, logTargets.length);
    newLogTargets[0] = target;
    Hierarchy.getDefaultHierarchy().getRootLogger().setLogTargets(newLogTargets);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:LoggingManager.java

示例4: getLoggerForClass

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Get the Logger for a class - no argument needed because the calling class
 * name is derived automatically from the call stack.
 *
 * @return Logger
 */
public static Logger getLoggerForClass() {
    String className = new Exception().getStackTrace()[1].getClassName();
    return Hierarchy.getDefaultHierarchy().getLoggerFor(removePrefix(className));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:LoggingManager.java

示例5: getLoggerFor

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Get the Logger for a class.
 * 
 * @param category - the full name of the logger category
 *
 * @return Logger
 */
public static Logger getLoggerFor(String category) {
    return Hierarchy.getDefaultHierarchy().getLoggerFor(category);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:LoggingManager.java

示例6: getLoggerForShortName

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Get the Logger for a class.
 * 
 * @param category - the full name of the logger category, this will have the prefix removed.
 *
 * @return Logger
 */
public static Logger getLoggerForShortName(String category) {
    return Hierarchy.getDefaultHierarchy().getLoggerFor(removePrefix(category));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:LoggingManager.java

示例7: setPriority

import org.apache.log.Hierarchy; //导入依赖的package包/类
/**
 * Set the logging priority for a category.
 * 
 * @param priority - e.g. Priority.DEBUG
 * @param category - string containing the category
 */
public static void setPriority(Priority priority, String category) {
    Hierarchy.getDefaultHierarchy().getLoggerFor(category).setPriority(priority);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:LoggingManager.java


注:本文中的org.apache.log.Hierarchy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。