Ejemplo n.º 1
0
  // initialize Log4J logging
  static {
    try {
      Class.forName("org.apache.log4j.Logger");
      LogFactory.setLogFactory(new Log4jLogFactory());
    } catch (Exception e) {
      LogFactory.setLogFactory(new ConsoleLogFactory());
    }

    // Check to see if the pseudorandom byte generator device exists
    if (new File("/dev/urandom").exists()) {

      // If so, use it as the Java entropy gathering device so that we never
      // block on entropy gathering. Don't use the exact string "file:/dev/urandom"
      // because this is treated as a special value inside the JVM. Insert the
      // "." into the path to force it to use the real /dev/urandom device.
      //
      // @see https://bugs.openjdk.java.net/browse/JDK-6202721
      //
      System.setProperty("java.security.egd", "file:/dev/./urandom");
    }

    // Allow us to override default security protocols
    // SNMP4JSettings.setExtensibilityEnabled(true);
    // Override the default security protocols
    // System.setProperty(SecurityProtocols.SECURITY_PROTOCOLS_PROPERTIES,
    // "/org/opennms/mock/snmp/SecurityProtocols.properties");
  }
Ejemplo n.º 2
0
  public static void main(String[] args) throws UnknownHostException, MalformedURLException {
    LogFactory.setLogFactory(new ConsoleLogFactory());
    AgentConfigData agentConfig = parseCli(args);
    if (agentConfig == null) {
      System.err.println("Could not parse configuration.");
      System.exit(1);
    }
    String listenSpec =
        agentConfig.getListenAddr().getHostAddress() + "/" + agentConfig.getListenPort();

    try {
      MockSnmpAgent.createAgentAndRun(agentConfig.getMoFile(), listenSpec);
    } catch (InterruptedException e) {
      System.exit(0);
    }
  }
Ejemplo n.º 3
0
 static {
   LogFactory.setLogFactory(new JavaLogFactory());
 }
Ejemplo n.º 4
0
 private static void setupLogging() {
   if (LogFactory.getLogFactory() == null) {
     LogFactory.setLogFactory(new ConsoleLogFactory());
   }
 }