java中getLevel()_Java Logger.getLevel方法代码示例

import org.apache.log4j.Logger; //导入方法依赖的package包/类

/**

* Constructor - when created try to find if a DB appender has been configured on the local system

*/

@SuppressWarnings( "unchecked")

public RemoteLoggingConfigurator( String atsAgent ) {

/*

* This code is run on:

* - Test Executor side prior to calling an agent for first time in this testcase

* - Agent side prior to calling another chained agent for first time in this testcase

*

* we use this code to remember the logging configuration which we will pass to some agent

*/

this.atsAgent = atsAgent;

// look for the DB appender

Category log = Logger.getLogger("com.axway.ats");

boolean dbAppenderIsProcessed = false;

while (log != null && !dbAppenderIsProcessed) {

Enumeration appenders = log.getAllAppenders();

while (appenders.hasMoreElements()) {

Appender appender = appenders.nextElement();

if (appender.getClass() == ActiveDbAppender.class // running on Test Executor side

|| appender.getClass() == PassiveDbAppender.class // running on Agent side

) {

//we found the appender, read all properties

appenderConfiguration = ((AbstractDbAppender) appender).getAppenderConfig();

appenderLogger = log.getName();

int atsDbLogLevel = DEFAULT_LOG_LEVEL;

if (atsDbLoggerLevelsFromTests.containsKey(this.atsAgent)) {

// user specified in the test the log level for this agent

atsDbLogLevel = atsDbLoggerLevelsFromTests.get(this.atsAgent).toInt();

} else if (log.getLevel() != null) {

// user specified the log level in log4j configuration file

atsDbLogLevel = log.getLevel().toInt();

}

//set the effective logging level for threshold if new one is set

if (appenderConfiguration.getLoggingThreshold() == null

|| appenderConfiguration.getLoggingThreshold().toInt() != atsDbLogLevel) {

/*

* Log4j is deprecating the Priority class used by setLoggingThreshold,

* but we cannot make an instance of this class as its constructor is not public.

*

* So here we first change the log level on the Test Executor,

* then get the Priority object, then restore back the value on the Test Executor

*/

final Level currentLevelBackup = log.getLevel();

log.setLevel(Level.toLevel(atsDbLogLevel));

appenderConfiguration.setLoggingThreshold(log.getEffectiveLevel());

log.setLevel(currentLevelBackup);

}

//exit the loop

dbAppenderIsProcessed = true;

break;

}

}

log = log.getParent();

}

// look for any user loggers

Enumeration allLoggers = Logger.getRootLogger().getLoggerRepository().getCurrentLoggers();

while (allLoggers.hasMoreElements()) {

Logger logger = allLoggers.nextElement();

Level level = logger.getLevel();

if (level != null) {

// user explicitly specified a level for this logger

otherLoggerLevels.put(logger.getName(), level.toInt());

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解释下Peoplesoft的这段代码 Component array of array of any &tmpArray; Local Record &rec1, &rec2; &rec1 = CreateRecord(Record.HIK_IPSANRS_TBL); &rec2 = CreateRecord(Record.HIK_IPSAN_TBL); Local Rowset &rsLvl1, &rsDtl; Local number &i, &j; Local Row &row; &rsLvl1 = GetLevel0()(1).GetRowset(Scroll.WPS_STR_INF_TBL); For &i = 1 To &rsLvl1.ActiveRowCount &rsDtl = &rsLvl1(&i).GetRowset(Scroll.WPS_STR_DTL_TBL); For &j = 1 To &rsDtl.ActiveRowCount &row = &rsDtl(&j); If Not &row.IsDeleted Then If All(&row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value) Then &rec1 = CreateRecord(Record.WPS_IPSANRS_TBL); &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; If &rec1.SelectByKey() Then &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = &rsLvl1(&i).WPS_STR_INF_TBL.STATUS.Value; &rec1.Update(); Else &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = "A"; &rec1.Insert(); End-If; &rec2 = CreateRecord(Record.WPS_IPSAN_TBL); &rec2.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec2.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec2.WPS_STORID.Value = &row.WPS_STR_DTL_TBL.WPS_STORID.Value; &rec2.WPS_GP_WAGECODE.Value = &row.WPS_STR_DTL_TBL.WPS_GP_WAGECODE.Value; If Not &rec2.Insert() Then &rec2.Update(); End-If; End-If; End-If; End-For; End-For;
最新发布
06-13

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值