org.mortbay.util.Log.instance().add(new LogSink() { public String getOptions() { return null; }  public void log(String formattedLog) { }  public void log(String tag, Object msg, Frame frame, long time) { }  public void setOptions(String options) { }  public boolean isStarted() { return true; }  public void start() { }  public void stop() { } });
org.mortbay.util.Log.instance().add(new HelmaLogSink());
    public void run() {        try {            if ((websrvPort != null) || (ajp13Port != null)) {                http = new HttpServer();                // disable Jetty logging  FIXME: seems to be a jetty bug; as soon                // as the logging is disabled, the more is logged                org.mortbay.util.Log.instance().disableLog();                org.mortbay.util.Log.instance().add(new LogSink() {                        public String getOptions() {                            return null;                        }                        public void log(String formattedLog) {                        }                        public void log(String tag, Object msg, Frame frame, long time) {                        }                        public void setOptions(String options) {                        }                        public boolean isStarted() {                            return true;                        }                        public void start() {                        }                        public void stop() {                        }                    });            }            // start embedded web server if port is specified            if (websrvPort != null) {                http.addListener(websrvPort);            }            // activate the ajp13-listener            if (ajp13Port != null) {                // create AJP13Listener                ajp13 = new AJP13Listener(ajp13Port);                ajp13.setHttpServer(http);                String jkallow = sysProps.getProperty("allowAJP13");                // by default the AJP13-connection just accepts requests from 127.0.0.1                if (jkallow == null) {                    jkallow = "127.0.0.1";                }                StringTokenizer st = new StringTokenizer(jkallow, " ,;");                String[] jkallowarr = new String[st.countTokens()];                int cnt = 0;                while (st.hasMoreTokens()) {                    jkallowarr[cnt] = st.nextToken();                    cnt++;                }                ajp13.setRemoteServers(jkallowarr);                logger.info("Starting AJP13-Listener on port " + (ajp13Port));            }            if (xmlrpcPort != null) {                String xmlparser = sysProps.getProperty("xmlparser");                if (xmlparser != null) {                    XmlRpc.setDriver(xmlparser);                }                if (xmlrpcPort.getInetAddress() != null) {                    xmlrpc = new WebServer(xmlrpcPort.getPort(), xmlrpcPort.getInetAddress());                } else {                    xmlrpc = new WebServer(xmlrpcPort.getPort());                }                if (paranoid) {                    xmlrpc.setParanoid(true);                    String xallow = sysProps.getProperty("allowXmlRpc");                    if (xallow != null) {                        StringTokenizer st = new StringTokenizer(xallow, " ,;");                        while (st.hasMoreTokens())                            xmlrpc.acceptClient(st.nextToken());                    }                }                logger.info("Starting XML-RPC server on port " + (xmlrpcPort));            }            if (rmiPort != null) {                if (paranoid) {                    HelmaSocketFactory factory = new HelmaSocketFactory();                    String rallow = sysProps.getProperty("allowWeb");                    if (rallow == null) {                        rallow = sysProps.getProperty("allowRMI");                    }                    if (rallow != null) {                        StringTokenizer st = new StringTokenizer(rallow, " ,;");                        while (st.hasMoreTokens())                            factory.addAddress(st.nextToken());                    }                    RMISocketFactory.setSocketFactory(factory);                }                logger.info("Starting RMI server on port " + rmiPort);                LocateRegistry.createRegistry(rmiPort.getPort());                // create application manager which binds to the given RMI port                appManager = new ApplicationManager(appsProps, this, rmiPort.getPort());            } else {                // create application manager with RMI port 0                appManager = new ApplicationManager(appsProps, this, 0);            }            if (xmlrpc != null) {                xmlrpc.addHandler("$default", appManager);            }            // add shutdown hook to close running apps and servers on exit            shutdownhook = new HelmaShutdownHook();            Runtime.getRuntime().addShutdownHook(shutdownhook);        } catch (Exception gx) {            logger.error("Error initializing embedded database: " + gx);            gx.printStackTrace();            return;        }        // set the security manager.         // the default implementation is helma.main.HelmaSecurityManager.        try {            String secManClass = sysProps.getProperty("securityManager");            if (secManClass != null) {                SecurityManager secMan = (SecurityManager) Class.forName(secManClass)                                                                .newInstance();                System.setSecurityManager(secMan);                logger.info("Setting security manager to " + secManClass);            }        } catch (Exception x) {            logger.error("Error setting security manager: " + x);        }        // start applications        appManager.startAll();        // start embedded web server        if (http != null) {            try {                http.start();            } catch (MultiException m) {                logger.error("Error starting embedded web server: " + m);            }        }        if (ajp13 != null) {            try {                ajp13.start();            } catch (Exception m) {                logger.error("Error starting AJP13 listener: " + m);            }        }        while (Thread.currentThread() == mainThread) {            try {                Thread.sleep(3000L);            } catch (InterruptedException ie) {            }            try {                appManager.checkForChanges();            } catch (Exception x) {                logger.warn("Caught in app manager loop: " + x);            }        }    }