Package org.snmp4j.log

Examples of org.snmp4j.log.LogAdapter


    if (LogFactory.getLogFactory() == null) {
      return;
    }
    Iterator loggers = LogFactory.getLogFactory().loggers();
    this.loggers = new HashMap();
    LogAdapter rootLogger = LogFactory.getLogFactory().getRootLogger();
    if (rootLogger != null) {
      snmp4jLogLoggerEntry.addRow(createLoggerRow(1, rootLogger,
                                                  getStorageType(rootLogger)));
    }
    while (loggers.hasNext()) {
      LogAdapter l = (LogAdapter) loggers.next();
      int i = 1;
      Integer index = (Integer) loggerNames2Index.get(l.getName());
      if (index == null) {
        i = nextLoggerIndex++;
        loggerNames2Index.put(l.getName(), new Integer(i));
      }
      else {
        i = index.intValue();
      }
      this.loggers.put(new Integer(i), l);
View Full Code Here


  public void rowStatusChanged(RowStatusEvent event) {
    if (event.getTable().equals(snmp4jLogLoggerEntry)) {
      if ((event.getNewStatus() == RowStatus.active) ||
          (event.getNewStatus() == RowStatus.createAndGo)) {
        Snmp4jLogLoggerRow r = (Snmp4jLogLoggerRow) event.getRow();
        LogAdapter logAdapter = r.getLogAdapter();
        if (logAdapter == null) {
          OctetString loggerName = new OctetString(r.getIndex().toByteArray());
          logAdapter = LogFactory.getLogger(loggerName.toString());
          r.setLogAdapter(logAdapter);
        }
        logAdapter.setLogLevel(
            new LogLevel(r.getSnmp4jLogLoggerLevel().getValue()));
      }
    }
  }
View Full Code Here

          }
          break;
        }
        case MOTableRowEvent.ADD: {
          Snmp4jLogLoggerRow r = (Snmp4jLogLoggerRow) event.getRow();
          LogAdapter logAdapter = r.getLogAdapter();
          if (logAdapter == null) {
            OctetString loggerName = new OctetString(r.getIndex().toByteArray());
            logAdapter = LogFactory.getLogger(loggerName.toString());
            r.setLogAdapter(logAdapter);
          }
          int level = r.getSnmp4jLogLoggerLevel().getValue();
          if (level != LogLevel.LEVEL_NONE) {
            logAdapter.setLogLevel(new LogLevel(level));
          }
          break;
        }
      }
    }
View Full Code Here

    public void commit(SubRequest request) {
     //--AgentGen BEGIN=snmp4jLogRootLevel::commit
     Variable vb = request.getVariableBinding().getVariable();
     int v = ((Integer32)vb).getValue();
     LogAdapter logAdapter = LogFactory.getLogFactory().getRootLogger();
     logAdapter.setLogLevel(new LogLevel(v));
     //--AgentGen END
      super.commit(request);
    }
View Full Code Here

    public void load(MOInput input) throws IOException {
      super.load(input);
      int v = ((Integer32)getValue()).getValue();
      if (LogFactory.getLogFactory() != null) {
        LogAdapter logAdapter = LogFactory.getLogFactory().getRootLogger();
        if (v != LogLevel.LEVEL_NONE) {
          logAdapter.setLogLevel(new LogLevel(v));
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.snmp4j.log.LogAdapter

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.