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


Java Level类代码示例

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


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

示例1: putApplicationProgress

import org.apache.log4j.Level; //导入依赖的package包/类
@PUT
@Path(WebStructure.APPLICATION_PROGRESS_PATH)
@Consumes({MediaType.APPLICATION_JSON})
public Response putApplicationProgress(
    @Context HttpServletRequest hsr,
    @PathParam(WebStructure.FRAMEWORK_NAME_PATH_PARAM) String frameworkName,
    OverrideApplicationProgressRequest overrideApplicationProgressRequest) throws Exception {
  LOGGER.logSplittedLines(Level.INFO,
      "[%s]: putApplicationProgress: \n%s",
      frameworkName, WebCommon.toJson(overrideApplicationProgressRequest));

  ModelValidation.validate(frameworkName);
  ModelValidation.validate(overrideApplicationProgressRequest);

  requestManager.updateApplicationProgress(frameworkName, overrideApplicationProgressRequest);
  return Response
      .status(HttpStatus.SC_ACCEPTED)
      .header("Location", hsr.getRequestURL())
      .build();
}
 
开发者ID:Microsoft,项目名称:pai,代码行数:21,代码来源:LauncherModule.java

示例2: getLevel

import org.apache.log4j.Level; //导入依赖的package包/类
public Level getLevel(int traceLevel) {
     if ( traceLevel == TRACE_INFO ) {
        return Level.INFO;
    } else if ( traceLevel == TRACE_ERROR ) {
        return Level.ERROR;
    } else if ( traceLevel == TRACE_DEBUG) {
        return Level.DEBUG;
    } else if (traceLevel == TRACE_TRACE) {
        return Level.ALL;
    } else {
        return Level.OFF;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:14,代码来源:LogWriter.java

示例3: testReconnectWaringLog

import org.apache.log4j.Level; //导入依赖的package包/类
/**
 * 重连日志的校验
 */
@Test
public void testReconnectWaringLog() throws RemotingException, InterruptedException{
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.4:"+port + "/client.reconnect.test?check=false&"
    +Constants.RECONNECT_KEY+"="+1 //1ms reconnect,保证有足够频率的重连
    +"&"+Constants.SHUTDOWN_TIMEOUT_KEY+ "=1"//shutdown时间足够短,确保error日志输出
    +"&reconnect.waring.period=100";//每隔多少warning记录一次
    try{
        Exchangers.connect(url);
    }catch (Exception e) {
        //do nothing
    }
    int count =  0;
    for (int i=0;i<100;i++){
        count =  LogUtil.findMessage(Level.WARN, "client reconnect to ") ; 
        if (count >=1){
            break;
        }
        Thread.sleep(50);//重连线程的运行
    }
    Assert.assertTrue("warning message count must >= 1, real :"+count, count>= 1);
    DubboAppender.doStop();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:28,代码来源:ClientReconnectTest.java

示例4: onDialogRequest

import org.apache.log4j.Level; //导入依赖的package包/类
@Override
public void onDialogRequest(CAPDialog capDialog, CAPGprsReferenceNumber referenceNumber) {
    synchronized (this) {
        if (capDialog instanceof CAPDialogCircuitSwitchedCall) {
            CAPDialogCircuitSwitchedCall dlg = (CAPDialogCircuitSwitchedCall) capDialog;

            CAPDialogCircuitSwitchedCall curDialog = this.currentDialog;
            currentRequestDef = "";
            if (curDialog == null) {
                this.currentDialog = dlg;
                this.testerHost
                        .sendNotif(SOURCE_NAME, "DlgAccepted:", "TrId=" + capDialog.getRemoteDialogId(), Level.DEBUG);
            } else {
                try {
                    capDialog.abort(CAPUserAbortReason.congestion);
                } catch (CAPException e) {
                    this.testerHost.sendNotif(SOURCE_NAME, "Exception when rejecting Dialog", e.toString(), Level.DEBUG);
                }
                this.testerHost.sendNotif(SOURCE_NAME, "Rejected incoming Dialog:",
                        "TrId=" + capDialog.getRemoteDialogId(), Level.DEBUG);
            }
        }
    }
}
 
开发者ID:RestComm,项目名称:phone-simulator,代码行数:25,代码来源:TestCapScfMan.java

示例5: testReconnectErrorLog

import org.apache.log4j.Level; //导入依赖的package包/类
/**
 * 重连日志的校验,不能一直抛出error日志.
 */
@Test
public void testReconnectErrorLog() throws RemotingException, InterruptedException{
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.3:"+port + "/client.reconnect.test?check=false&"
    +Constants.RECONNECT_KEY+"="+1 + //1ms reconnect,保证有足够频率的重连
    "&"+Constants.SHUTDOWN_TIMEOUT_KEY+ "=1";//shutdown时间足够短,确保error日志输出
    try{
        Exchangers.connect(url);
    }catch (Exception e) {
        //do nothing
    }
    Thread.sleep(1500);//重连线程的运行
    Assert.assertEquals("only one error message ", 1 , LogUtil.findMessage(Level.ERROR, "client reconnect to "));
    DubboAppender.doStop();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:20,代码来源:ClientReconnectTest.java

示例6: sendNotif

import org.apache.log4j.Level; //导入依赖的package包/类
public void sendNotif(String source, String msg, Throwable e, Level logLevel) {
    StringBuilder sb = new StringBuilder();
    for (StackTraceElement st : e.getStackTrace()) {
        if (sb.length() > 0)
            sb.append("\n");
        sb.append(st.toString());
    }
    this.doSendNotif(source, msg + " - " + e.toString(), sb.toString());

    logger.log(logLevel, msg, e);
    // if (showInConsole) {
    // logger.error(msg, e);
    // } else {
    // logger.debug(msg, e);
    // }
}
 
开发者ID:RestComm,项目名称:phone-simulator,代码行数:17,代码来源:TesterHost.java

示例7: logStackTrace

import org.apache.log4j.Level; //导入依赖的package包/类
public void logStackTrace(int traceLevel) {
    if (needsLogging) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        StackTraceElement[] ste = new Exception().getStackTrace();
        // Skip the log writer frame and log all the other stack frames.
        for (int i = 1; i < ste.length; i++) {
            String callFrame = "[" + ste[i].getFileName() + ":"
                    + ste[i].getLineNumber() + "]";
            pw.print(callFrame);
        }
        pw.close();
        String stackTrace = sw.getBuffer().toString();
        Level level = this.getLevel(traceLevel);
        Priority priority = this.getLogPriority();
        if ( level.isGreaterOrEqual(priority)) {
            logger.log(level,stackTrace);
        }

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:LogWriter.java

示例8: configureLogging

import org.apache.log4j.Level; //导入依赖的package包/类
public static boolean configureLogging() {
	if (!_RootDAO.isConfigured()) return false;
	
    org.hibernate.Session hibSession = ApplicationConfigDAO.getInstance().createNewSession();
    try {
    	for (ApplicationConfig config: (List<ApplicationConfig>)hibSession.createQuery("from ApplicationConfig where key like 'log4j.logger.%'").list()) {
    		Level level = Level.toLevel(config.getValue());
    		boolean root = "log4j.logger.root".equals(config.getKey());
    		Logger logger = (root ? Logger.getRootLogger() : Logger.getLogger(config.getKey().substring("log4j.logger.".length())));
    		logger.setLevel(level);
    		Debug.info("Logging level for " + logger.getName() + " set to " + level);
    	}
    } finally {
    	hibSession.close();
    }
    
    return true;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:ApplicationConfig.java

示例9: append

import org.apache.log4j.Level; //导入依赖的package包/类
@Override
public void append(LoggingEvent event) {
  Level level = event.getLevel();
  // depends on the api, == might not work
  // see HADOOP-7055 for details
  if (level.equals(Level.INFO)) {
    counts.incr(INFO);
  }
  else if (level.equals(Level.WARN)) {
    counts.incr(WARN);
  }
  else if (level.equals(Level.ERROR)) {
    counts.incr(ERROR);
  }
  else if (level.equals(Level.FATAL)) {
    counts.incr(FATAL);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:EventCounter.java

示例10: setup

import org.apache.log4j.Level; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  conf = new HdfsConfiguration();
  fsHelper = new FileSystemTestHelper();
  // Set up java key store
  String testRoot = fsHelper.getTestRootDir();
  File testRootDir = new File(testRoot).getAbsoluteFile();
  final Path jksPath = new Path(testRootDir.toString(), "test.jks");
  conf.set(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI,
      JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri()
  );
  cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  Logger.getLogger(EncryptionZoneManager.class).setLevel(Level.TRACE);
  fs = cluster.getFileSystem();
  fsWrapper = new FileSystemTestWrapper(cluster.getFileSystem());
  fcWrapper = new FileContextTestWrapper(
      FileContext.getFileContext(cluster.getURI(), conf));
  dfsAdmin = new HdfsAdmin(cluster.getURI(), conf);
  // Need to set the client's KeyProvider to the NN's for JKS,
  // else the updates do not get flushed properly
  fs.getClient().setKeyProvider(cluster.getNameNode().getNamesystem()
      .getProvider());
  DFSTestUtil.createKey(TEST_KEY, cluster, conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestReservedRawPaths.java

示例11: main

import org.apache.log4j.Level; //导入依赖的package包/类
/**
   * Main entry point for the echo server application. 
   * @param args contains the port number at args[0].
   */
  public static void main(String[] args) {
  	try {
	new LogSetup("logs/client.log", Level.OFF);
	app_KVClient app = new app_KVClient();
	app.run();
} catch (IOException e) {
	System.out.println("Error! Unable to initialize logger!");
	e.printStackTrace();
	System.exit(1);
}
  }
 
开发者ID:yanghanxy,项目名称:CloudDB,代码行数:16,代码来源:app_KVClient.java

示例12: isValidLevel

import org.apache.log4j.Level; //导入依赖的package包/类
public static boolean isValidLevel(String levelString) {
	boolean valid = false;
	
	if(levelString.equals(Level.ALL.toString())) {
		valid = true;
	} else if(levelString.equals(Level.DEBUG.toString())) {
		valid = true;
	} else if(levelString.equals(Level.INFO.toString())) {
		valid = true;
	} else if(levelString.equals(Level.WARN.toString())) {
		valid = true;
	} else if(levelString.equals(Level.ERROR.toString())) {
		valid = true;
	} else if(levelString.equals(Level.FATAL.toString())) {
		valid = true;
	} else if(levelString.equals(Level.OFF.toString())) {
		valid = true;
	}
	
	return valid;
}
 
开发者ID:yanghanxy,项目名称:CloudDB,代码行数:22,代码来源:LogSetup.java

示例13: start

import org.apache.log4j.Level; //导入依赖的package包/类
public boolean start() {
    this.countSriReq = 0;
    this.countSriResp = 0;
    this.countMtFsmReq = 0;
    this.countMtFsmReqNot = 0;
    this.countMtFsmResp = 0;
    this.countMoFsmReq = 0;
    this.countMoFsmResp = 0;
    this.countIscReq = 0;
    this.countRsmdsReq = 0;
    this.countRsmdsResp = 0;
    this.countAscReq = 0;
    this.countAscResp = 0;
    this.countErrRcvd = 0;
    this.countErrSent = 0;

    MAPProvider mapProvider = this.mapMan.getMAPStack().getMAPProvider();
    mapProvider.getMAPServiceSms().acivate();
    mapProvider.getMAPServiceSms().addMAPServiceListener(this);
    mapProvider.addMAPDialogListener(this);
    this.testerHost.sendNotif(SOURCE_NAME, "SMS Client has been started", "", Level.INFO);
    isStarted = true;

    return true;
}
 
开发者ID:RestComm,项目名称:phone-simulator,代码行数:26,代码来源:TestSmsClientMan.java

示例14: getTagsForProperty

import org.apache.log4j.Level; //导入依赖的package包/类
public String[] getTagsForProperty(String propertyName) {
	if (propertyName.equals("level")) {
		return new String[]{
				Level.ERROR.toString(),
				Level.WARN.toString(),
				Level.INFO.toString(),
				Level.DEBUG.toString(),
				Level.TRACE.toString(),
		};
	}
	if (propertyName.equals("logger")) {
		return new String[]{
				Engine.logEngine.getName(),
				Engine.logContext.getName(),
				Engine.logUser.getName(),
				Engine.logAudit.getName(),
		};
	}
	return new String[0];
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:21,代码来源:LogStep.java

示例15: tesApplyUserLoggerLevels

import org.apache.log4j.Level; //导入依赖的package包/类
@Test
public void tesApplyUserLoggerLevels() {

    // set the level
    Logger.getLogger( "fake.logger" ).setLevel( Level.INFO );

    // read the configuration and remember the level
    RemoteLoggingConfigurator remoteLoggingConfig = new RemoteLoggingConfigurator( "127.0.0.1" );

    // change the level in log4j
    Logger.getLogger( "fake.logger" ).setLevel( Level.DEBUG );
    assertTrue( Logger.getLogger( "fake.logger" ).getLevel().equals( Level.DEBUG ) );
    assertTrue( remoteLoggingConfig.needsApplying() );

    // apply the remembered level
    remoteLoggingConfig.apply();
    assertTrue( Logger.getLogger( "fake.logger" ).getLevel().equals( Level.INFO ) );
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:19,代码来源:Test_RemoteLoggingConfigurator.java


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