Package org.springframework.amqp.rabbit.log4j.service

Examples of org.springframework.amqp.rabbit.log4j.service.AbstractService


  @ResponseBody
  public String randomLog(@RequestParam(value = "count", defaultValue = "10") int count) {
    if (count <= 0) {
      count = 10;
    }
    AbstractService service;

    int countServiceA = 0;
    int countServiceB = 0;
    int countInfo = 0;
    int countDebug = 0;
    int countWarn = 0;
    int countError = 0;

    int serviceNo;
    int operationNo;
    String randomMessage;
    for (int i = 0; i < count; i++) {
      serviceNo = random.nextInt(2);
      operationNo = random.nextInt(4);
      if (serviceNo == 0) {
        service = serviceA;
        countServiceA++;
      } else {
        service = serviceB;
        countServiceB++;
      }

      randomMessage = "Random log - " + System.currentTimeMillis();
      switch (operationNo) {
      case 0:
        // INFO
        service.logInfo(randomMessage);
        countInfo++;
        break;
      case 1:
        // DEBUG
        service.logDebug(randomMessage);
        countDebug++;
        break;
      case 2:
        // WARN
        service.logWarn(randomMessage);
        countWarn++;
        break;
      case 3:
        // ERROR
        service.logError(randomMessage);
        countError++;
        break;
      }
    }
    return String.format("%d random logs [%d for %s, %d for %s]: INFO - %d, DEBUG - %d, WARN - %d, ERROR - %d", count,
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.log4j.service.AbstractService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.