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

x33g5p2x  于2022-01-23 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(139)

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

Logger.setPriority介绍

[英]Set the priority for this logger.
[中]设置此记录器的优先级。

代码示例

代码示例来源:origin: com.googlecode.fighting-layout-bugs/fighting-layout-bugs

_runAfterAnalysis.add(new Runnable() { @Override public void run() {
    logger.setPriority(originalLevel);
  }});
} else if (log instanceof SimpleLog) {

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

/**
 * Set the default priority for hierarchy.
 * This is the priority inherited by loggers if no other priority is specified.
 *
 * @param priority the default priority
 */
public void setDefaultPriority( final Priority priority )
{
  if( null == priority )
  {
    final String message = "Can not set default Hierarchy Priority to null";
    throw new IllegalArgumentException( message );
  }
  getRootLogger().setPriority( priority );
}

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

logKitLogger.setPriority( Priority.DEBUG );
logKitLogger.setPriority( Priority.INFO );
logKitLogger.setPriority( Priority.WARN );
logKitLogger.setPriority( Priority.ERROR );
logKitLogger.setPriority( Priority.FATAL_ERROR );

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

logkitLogger.setPriority( Priority.DEBUG );
logkitLogger.setPriority( Priority.INFO );
logkitLogger.setPriority( Priority.WARN );
logkitLogger.setPriority( Priority.ERROR );
logkitLogger.setPriority( Priority.FATAL_ERROR );

代码示例来源:origin: com.googlecode.fighting-layout-bugs/fighting-layout-bugs

final org.apache.log.Logger logger = LogKit.getLoggerFor(name);
final Priority originalLevel = logger.getPriority();
logger.setPriority(Priority.DEBUG);
_runAfterAnalysis.add(new Runnable() { @Override public void run() {
  logger.setPriority(originalLevel);

代码示例来源: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 } );
}

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

private void initTarget(final String file, final RuntimeServices rsvc) throws Exception
{
  try
  {
    String format = null;
    Priority level = null;
    if (rsvc != null)
    {
      format = rsvc.getString(AVALON_LOGGER_FORMAT, "%{time} %{message}\\n%{throwable}");
      level = (Priority) logLevels.get(rsvc.getString(AVALON_LOGGER_LEVEL, "warn"));
    }
    VelocityFormatter vf = new VelocityFormatter(format);
    // make the target and keep the default behavior of not appending
    FileTarget target = new FileTarget(new File(file), false, vf);
    logger.setPriority(level);
    logger.setLogTargets(new LogTarget[] { target });
    log(DEBUG_ID, "AvalonLogChute initialized using file '"+file+'\'');
  }
  catch (IOException ioe)
  {
    rsvc.getLog().error("Unable to create log file for AvalonLogChute", ioe);
    throw new Exception("Error configuring AvalonLogChute : " + ioe);
  }
}

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

private void initTarget(final String file, final RuntimeServices rsvc) throws Exception
{
  try
  {
    String format = null;
    Priority level = null;
    if (rsvc != null)
    {
      format = rsvc.getString(AVALON_LOGGER_FORMAT, "%{time} %{message}\\n%{throwable}");
      level = (Priority) logLevels.get(rsvc.getString(AVALON_LOGGER_LEVEL, "warn"));
    }
    VelocityFormatter vf = new VelocityFormatter(format);
    // make the target and keep the default behavior of not appending
    FileTarget target = new FileTarget(new File(file), false, vf);
    logger.setPriority(level);
    logger.setLogTargets(new LogTarget[] { target });
    log(DEBUG_ID, "AvalonLogChute initialized using file '"+file+'\'');
  }
  catch (IOException ioe)
  {
    rsvc.getLog().error("Unable to create log file for AvalonLogChute", ioe);
    throw new Exception("Error configuring AvalonLogChute : " + ioe);
  }
}

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

m_logkitLogger.setPriority( priority );
m_logkitLogger.setLogTargets( new LogTarget[] {logTarget} );
logger.setPriority( priority );
logger.setLogTargets( new LogTarget[]{logTarget} );

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

logger.setPriority( Priority.INFO );

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

logger.setPriority( Priority.getPriorityForName( loglevel ) );
logger.setLogTargets( logTargets );

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

logger.setPriority( Priority.getPriorityForName( loglevel ) );
logger.setLogTargets( logTargets );
logger.setAdditivity( additive );

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

lmDefaultLogger.setPriority( Priority.DEBUG );
lmLogger.setPriority( Priority.getPriorityForName(
  loggerManagerConfig.getAttribute( "log-level", "DEBUG" ) ) );

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

logger.setPriority( Priority.getPriorityForName( loglevel ) );
logger.setLogTargets( logTargets );
logger.setAdditivity( additive );

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

DefaultLogKitManager logKitManager = new DefaultLogKitManager();
Logger lmLogger = Hierarchy.getDefaultHierarchy().getLoggerFor( lmLoggerName );
lmLogger.setPriority( lmPriority );
logKitManager.enableLogging( new LogKitLogger( lmLogger ) );
logKitManager.contextualize( context );

相关文章