- private static void configureRoot() throws Exception {
- ROOT = System.getProperty("jinetd.root", null);
- if (ROOT == null) {
- ROOT = autoDetectRoot();
- System.setProperty("jinetd.root", ROOT);
+ static {
+ try {
+ System.err.println("jinetd starting...");
+ ROOT = System.getProperty("jinetd.root", null);
+ if (ROOT == null) System.setProperty("jinetd.root", ROOT = autoDetectRoot());
+ System.err.println(" jinetd.root = " + ROOT);
+ defaultDomain = System.getProperty("jinetd.hostname", null);
+ if (defaultDomain==null) try {
+ java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
+ defaultDomain = localMachine.getHostName();
+ } catch(java.net.UnknownHostException uhe) { defaultDomain = "localhost"; }
+ System.err.println(" jinetd.hostname = " + defaultDomain);
+ LOGFILE = System.getProperty("jinetd.logfile", ROOT + File.separatorChar+"log.txt");
+ System.err.println(" jinetd.logfile = " + LOGFILE);
+ System.err.println(" redirecting stdout/stderr to logfile." + LOGFILE);
+ LOGSTREAM = new PrintStream(new FileOutputStream(LOGFILE, true));
+ System.setErr(LOGSTREAM);
+ System.setOut(LOGSTREAM);
+ } catch (Throwable e) {
+ throw new Error(e);