コード例 #1
0
  public Result index() {
    BreadcrumbList bc = new BreadcrumbList();
    bc.addCrumb("System", routes.SystemController.index(0));
    bc.addCrumb("Logging", routes.LoggingController.index());

    Map<Node, List<InternalLogger>> loggers = Maps.newHashMap();
    Map<Node, Map<String, InternalLoggerSubsystem>> subsystems = Maps.newHashMap();
    for (Node node : serverNodes.all()) {
      loggers.put(node, node.allLoggers());
      subsystems.put(node, node.allLoggerSubsystems());
    }

    return ok(views.html.system.logging.index.render(currentUser(), bc, loggers, subsystems));
  }
コード例 #2
0
  public Result setSubsystemLevel(String nodeId, String subsystem, String level) {
    try {
      Node node = nodeService.loadNode(nodeId);
      node.setSubsystemLoggerLevel(subsystem, level);

      return redirect(routes.LoggingController.index());
    } catch (IOException e) {
      return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
    } catch (APIException e) {
      String message =
          "Could not set log level. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
      return status(500, views.html.errors.error.render(message, e, request()));
    } catch (NodeService.NodeNotFoundException e) {
      return status(
          404, views.html.errors.error.render(ApiClient.ERROR_MSG_NODE_NOT_FOUND, e, request()));
    }
  }