*) removing old logging configuration properties from yacy.init

*) serverLog.java logging functions now also accept exceptions als
   additional parameters.
   The Stacktrace of this ecceptions will then be appended to the 
   logging message and can e.g. be viewed on the gui logging page

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@265 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 9e4bcc828d
commit ee9e110366

@ -55,6 +55,7 @@ import java.io.File;
import java.util.Hashtable; import java.util.Hashtable;
import de.anomic.server.serverFileUtils; import de.anomic.server.serverFileUtils;
import de.anomic.server.logging.serverLog;
/** /**
* A template engine, which substitutes patterns in strings<br> * A template engine, which substitutes patterns in strings<br>
@ -356,8 +357,7 @@ public final class httpTemplate {
} }
}catch(IOException e){ }catch(IOException e){
//file not found? //file not found?
System.err.println("Include Error with file: "+filename); serverLog.logError("FILEHANDLER","Include Error with file: "+filename);
//e.printStackTrace();
} }
PushbackInputStream pis2 = new PushbackInputStream(new ByteArrayInputStream(include.getBytes())); PushbackInputStream pis2 = new PushbackInputStream(new ByteArrayInputStream(include.getBytes()));
writeTemplate(pis2, out, pattern, dflt, prefix); writeTemplate(pis2, out, pattern, dflt, prefix);

@ -245,7 +245,7 @@ public final class httpd implements serverHandler {
public String error(Throwable e) { // OBLIGATORIC FUNCTION public String error(Throwable e) { // OBLIGATORIC FUNCTION
// return string in case of any error that occurs during communication // return string in case of any error that occurs during communication
// is always (but not only) called if an IO-dependent exception occurrs. // is always (but not only) called if an IO-dependent exception occurrs.
e.printStackTrace(); this.log.logError("Unexpected Error. " + e.getClass().getName(),e);
return "501 Exception occurred: " + e.getMessage(); return "501 Exception occurred: " + e.getMessage();
} }
@ -508,8 +508,7 @@ public final class httpd implements serverHandler {
return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION; return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (Exception e) { } catch (Exception e) {
String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage(); String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage();
System.err.println("PROXY: " + errorMsg); this.log.logError(errorMsg,e);
this.log.logError(errorMsg);
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
} }
@ -561,8 +560,7 @@ public final class httpd implements serverHandler {
return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION; return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (Exception e) { } catch (Exception e) {
String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage(); String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage();
System.err.println("PROXY: " + errorMsg); this.log.logError(errorMsg,e);
this.log.logError(errorMsg);
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
} }
@ -632,8 +630,7 @@ public final class httpd implements serverHandler {
return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION; return this.prop.getProperty(CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
} catch (Exception e) { } catch (Exception e) {
String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage(); String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage();
System.err.println("PROXY: " + errorMsg); this.log.logError(errorMsg,e);
this.log.logError(errorMsg);
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
} }

@ -123,6 +123,8 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
private Properties connectionProperties = null; private Properties connectionProperties = null;
private MessageDigest md5Digest = null; private MessageDigest md5Digest = null;
private final serverLog theLogger = new serverLog("FILEHANDLER");
public httpdFileHandler(serverSwitch switchboard) { public httpdFileHandler(serverSwitch switchboard) {
this.switchboard = switchboard; this.switchboard = switchboard;
@ -416,12 +418,11 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
tp.put("uptime", ((System.currentTimeMillis() - Long.parseLong(switchboard.getConfig("startupTime","0"))) / 1000) / 60); // uptime in minutes tp.put("uptime", ((System.currentTimeMillis() - Long.parseLong(switchboard.getConfig("startupTime","0"))) / 1000) / 60); // uptime in minutes
//System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug //System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
System.out.println("INTERNAL ERROR: " + e.toString() + ":" + this.theLogger.logError("INTERNAL ERROR: " + e.toString() + ":" +
e.getMessage() + e.getMessage() +
" target exception at " + rc + ": " + " target exception at " + rc + ": " +
e.getTargetException().toString() + ":" + e.getTargetException().toString() + ":" +
e.getTargetException().getMessage()); e.getTargetException().getMessage(),e);
e.printStackTrace();
rc = null; rc = null;
} }
filedate = new Date(System.currentTimeMillis()); filedate = new Date(System.currentTimeMillis());
@ -483,7 +484,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
} catch (Exception e) { } catch (Exception e) {
//textMessage(out, 503, "Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'\r\n"); //textMessage(out, 503, "Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'\r\n");
//e.printStackTrace(); //e.printStackTrace();
System.out.println("ERROR: Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'\r\n"); this.theLogger.logError("ERROR: Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'",e);
} }
out.flush(); out.flush();
if (!(requestHeader.get(httpHeader.CONNECTION, "close").equals("keep-alive"))) { if (!(requestHeader.get(httpHeader.CONNECTION, "close").equals("keep-alive"))) {

@ -456,8 +456,7 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
} catch (Exception e) { } catch (Exception e) {
String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage(); String errorMsg = "Unexpected Error. " + e.getClass().getName() + ": " + e.getMessage();
System.err.println("PROXY: " + errorMsg); this.theLogger.logError(errorMsg,e);
this.theLogger.logError(errorMsg);
} finally { } finally {
respond.flush(); respond.flush();
if (respond instanceof httpdByteCountOutputStream) ((httpdByteCountOutputStream)respond).finish(); if (respond instanceof httpdByteCountOutputStream) ((httpdByteCountOutputStream)respond).finish();
@ -693,12 +692,12 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
if (cacheFile.exists()) cacheFile.delete(); if (cacheFile.exists()) cacheFile.delete();
if (e.getMessage().indexOf("Corrupt GZIP trailer") >= 0) { if (e.getMessage().indexOf("Corrupt GZIP trailer") >= 0) {
// just do nothing, we leave it this way // just do nothing, we leave it this way
this.theLogger.logDebug("ignoring bad gzip trail for URL " + url + " (" + e.getMessage() + ")"); this.theLogger.logDebug("ignoring bad gzip trail for URL " + url + " (" + e.getMessage() + ")",e);
conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close"); conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close");
} else { } else {
if (!conProp.containsKey(httpd.CONNECTION_PROP_PROXY_RESPOND_HEADER)) { if (!conProp.containsKey(httpd.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
httpd.sendRespondError(conProp,respond,4,404,null,"client unexpectedly closed connection",e); httpd.sendRespondError(conProp,respond,4,404,null,"client unexpectedly closed connection",e);
this.theLogger.logDebug("IOError for URL " + url + " (" + e.getMessage() + ") - responded 404"); this.theLogger.logDebug("IOError for URL " + url + " (" + e.getMessage() + ") - responded 404",e);
} else { } else {
conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close"); conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close");
} }

@ -425,8 +425,7 @@ public final class plasmaCrawlWorker extends Thread {
} catch (Exception e) { } catch (Exception e) {
// this may happen if the targeted host does not exist or anything with the // this may happen if the targeted host does not exist or anything with the
// remote server was wrong. // remote server was wrong.
log.logError("CRAWLER LOADER ERROR2 with url=" + url.toString() + ": " + e.toString()); log.logError("CRAWLER LOADER ERROR2 with url=" + url.toString() + ": " + e.toString(),e);
e.printStackTrace();
} finally { } finally {
if (remote != null) httpc.returnInstance(remote); if (remote != null) httpc.returnInstance(remote);
} }

@ -97,8 +97,7 @@ public final class plasmaHTCache {
public plasmaHTCache(plasmaSwitchboard switchboard, int bufferkb) { public plasmaHTCache(plasmaSwitchboard switchboard, int bufferkb) {
this.switchboard = switchboard; this.switchboard = switchboard;
int loglevel = Integer.parseInt(switchboard.getConfig("plasmaLoglevel", "2")); this.log = new serverLog("HTCACHE");
this.log = new serverLog("HTCACHE", loglevel);
// set cache path // set cache path
cachePath = new File(switchboard.getRootPath(),switchboard.getConfig("proxyCache","HTCACHE")); cachePath = new File(switchboard.getRootPath(),switchboard.getConfig("proxyCache","HTCACHE"));

@ -106,7 +106,6 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -117,7 +116,6 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.Vector; import java.util.Vector;
@ -125,24 +123,19 @@ import java.util.Vector;
import de.anomic.data.messageBoard; import de.anomic.data.messageBoard;
import de.anomic.data.wikiBoard; import de.anomic.data.wikiBoard;
import de.anomic.htmlFilter.htmlFilterContentScraper; import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.htmlFilter.htmlFilterOutputStream;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
import de.anomic.kelondro.kelondroException; import de.anomic.kelondro.kelondroException;
import de.anomic.kelondro.kelondroMSetTools; import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroTables; import de.anomic.kelondro.kelondroTables;
import de.anomic.server.serverAbstractSwitch; import de.anomic.server.serverAbstractSwitch;
import de.anomic.server.serverCodings; import de.anomic.server.serverCodings;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
import de.anomic.server.serverDate; import de.anomic.server.serverDate;
import de.anomic.server.serverFileUtils;
import de.anomic.server.serverThread;
import de.anomic.server.serverInstantThread; import de.anomic.server.serverInstantThread;
import de.anomic.server.logging.serverLog;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSemaphore; import de.anomic.server.serverSemaphore;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import de.anomic.server.logging.serverLog;
import de.anomic.tools.bitfield; import de.anomic.tools.bitfield;
import de.anomic.tools.crypt; import de.anomic.tools.crypt;
import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyClient;
@ -198,8 +191,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
super(rootPath, initPath, configPath); super(rootPath, initPath, configPath);
// set loglevel and log // set loglevel and log
int loglevel = Integer.parseInt(getConfig("plasmaLoglevel", "2")); setLog(new serverLog("PLASMA"));
setLog(new serverLog("PLASMA", loglevel));
// load values from configs // load values from configs
plasmaPath = new File(rootPath, getConfig("dbPath", "PLASMADB")); plasmaPath = new File(rootPath, getConfig("dbPath", "PLASMADB"));

@ -44,23 +44,18 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.io.PrintStream;
import java.util.GregorianCalendar; import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.TimeZone;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.StreamHandler;
public final class serverLog { public final class serverLog {
// // log-level categories // // log-level categories
public static final int LOGLEVEL_ZERO = Level.OFF.intValue(); // no output at all public static final int LOGLEVEL_ZERO = Level.OFF.intValue(); // no output at all
public static final int LOGLEVEL_FAILURE = Level.SEVERE.intValue(); // system-level error, internal cause, critical and not fixeable (i.e. inconsistency) public static final int LOGLEVEL_FAILURE = Level.SEVERE.intValue(); // system-level error, internal cause, critical and not fixeable (i.e. inconsistency)
public static final int LOGLEVEL_ERROR = Level.SEVERE.intValue(); // exceptional error, catcheable and non-critical (i.e. file error) public static final int LOGLEVEL_ERROR = 950; // exceptional error, catcheable and non-critical (i.e. file error)
public static final int LOGLEVEL_WARNING = Level.WARNING.intValue(); // uncritical service failure, may require user activity (i.e. input required, wrong authorization) public static final int LOGLEVEL_WARNING = Level.WARNING.intValue(); // uncritical service failure, may require user activity (i.e. input required, wrong authorization)
public static final int LOGLEVEL_SYSTEM = Level.CONFIG.intValue(); // regular system status information (i.e. start-up messages) public static final int LOGLEVEL_SYSTEM = Level.CONFIG.intValue(); // regular system status information (i.e. start-up messages)
public static final int LOGLEVEL_INFO = Level.INFO.intValue(); // regular action information (i.e. any httpd request URL) public static final int LOGLEVEL_INFO = Level.INFO.intValue(); // regular action information (i.e. any httpd request URL)
@ -78,32 +73,31 @@ public final class serverLog {
private final Logger theLogger; private final Logger theLogger;
public serverLog(String appName) { public serverLog(String appName) {
//this(appName, LOGLEVEL_DEBUG);
this.theLogger = Logger.getLogger(appName); this.theLogger = Logger.getLogger(appName);
} }
public serverLog(String appName, int logLevel) { public void setLevel(Level newLevel) {
this(appName); this.theLogger.setLevel(newLevel);
// this.logLevel = logLevel;
// this.appName = appName;
}
public serverLog(String appName, char logToken) {
this(appName);
// this(appName, t2l(logToken));
}
public void setLoglevel(int newLevel) {
// this.logLevel = newLevel;
} }
// class log messages // class log messages
public void logFailure(String message) {this.theLogger.severe(message);} public void logFailure(String message) {this.theLogger.severe(message);}
public void logFailure(String message, Throwable thrown) {this.theLogger.log(Level.SEVERE,message,thrown);}
public void logError(String message) {this.theLogger.severe(message);} public void logError(String message) {this.theLogger.severe(message);}
public void logError(String message, Throwable thrown) {this.theLogger.log(Level.SEVERE,message,thrown);}
public void logWarning(String message) {this.theLogger.warning(message);} public void logWarning(String message) {this.theLogger.warning(message);}
public void logWarning(String message, Throwable thrown) {this.theLogger.log(Level.WARNING,message,thrown);}
public void logSystem(String message) {this.theLogger.config(message);} public void logSystem(String message) {this.theLogger.config(message);}
public void logSystem(String message, Throwable thrown) {this.theLogger.log(Level.CONFIG,message,thrown);}
public void logInfo(String message) {this.theLogger.info(message);} public void logInfo(String message) {this.theLogger.info(message);}
public void logInfo(String message, Throwable thrown) {this.theLogger.log(Level.INFO,message,thrown);}
public void logDebug(String message) {this.theLogger.finest(message);} public void logDebug(String message) {this.theLogger.finest(message);}
public void logDebug(String message, Throwable thrown) {this.theLogger.log(Level.FINEST,message,thrown);}
// static log messages: log everything // static log messages: log everything
@ -111,12 +105,52 @@ public final class serverLog {
Logger.getLogger(appName).log(Level.parse(Integer.toString(messageLevel)),message); Logger.getLogger(appName).log(Level.parse(Integer.toString(messageLevel)),message);
} }
public static void logFailure(String appName, String message) {Logger.getLogger(appName).severe(message);} private void log(Level level, String msg, Throwable thrown) {
public static void logError(String appName, String message) {Logger.getLogger(appName).severe(message);} this.theLogger.log(level, msg, thrown);
public static void logWarning(String appName, String message) {Logger.getLogger(appName).warning(message);} }
public static void logSystem(String appName, String message) {Logger.getLogger(appName).config(message);}
public static void logInfo(String appName, String message) {Logger.getLogger(appName).info(message);} public static void logFailure(String appName, String message) {
public static void logDebug(String appName, String message) {Logger.getLogger(appName).finest(message);} Logger.getLogger(appName).severe(message);
}
public static void logFailure(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.SEVERE,message,thrown);
}
public static void logError(String appName, String message) {
Logger.getLogger(appName).severe(message);
}
public static void logError(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.SEVERE,message,thrown);
}
public static void logWarning(String appName, String message) {
Logger.getLogger(appName).warning(message);
}
public static void logWarning(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.WARNING,message,thrown);
}
public static void logSystem(String appName, String message) {
Logger.getLogger(appName).config(message);
}
public static void logSystem(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.CONFIG,message,thrown);
}
public static void logInfo(String appName, String message) {
Logger.getLogger(appName).info(message);
}
public static void logInfo(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.INFO,message,thrown);
}
public static void logDebug(String appName, String message) {
Logger.getLogger(appName).finest(message);
}
public static void logDebug(String appName, String message, Throwable thrown) {
Logger.getLogger(appName).log(Level.FINEST,message,thrown);
}
public static final void configureLogging(String homePath) throws SecurityException, FileNotFoundException, IOException { public static final void configureLogging(String homePath) throws SecurityException, FileNotFoundException, IOException {
@ -130,5 +164,8 @@ public final class serverLog {
// generating the root logger // generating the root logger
Logger logger = Logger.getLogger(""); Logger logger = Logger.getLogger("");
// System.setOut(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDOUT"),Level.FINEST)));
// System.setErr(new PrintStream(new LoggerOutputStream(Logger.getLogger("STDERR"),Level.SEVERE)));
} }
} }

@ -69,14 +69,16 @@ public class serverSimpleLogFormatter extends SimpleFormatter {
// adding the stack trace if available // adding the stack trace if available
buffer.append(System.getProperty("line.separator")); buffer.append(System.getProperty("line.separator"));
if (record.getThrown() != null) { if (record.getThrown() != null) {
StringWriter writer = null;
try { try {
StringWriter writer = new StringWriter(); writer = new StringWriter();
PrintWriter printer = new PrintWriter(writer); PrintWriter printer = new PrintWriter(writer);
record.getThrown().printStackTrace(printer); record.getThrown().printStackTrace(printer);
writer.close();
buffer.append(writer.toString()); buffer.append(writer.toString());
} catch (Exception e) { } catch (Exception e) {
buffer.append("Failed to get stack trace: " + e.getMessage()); buffer.append("Failed to get stack trace: " + e.getMessage());
} finally {
if (writer != null) try {writer.close();} catch (Exception ex) {}
} }
} }
return buffer.toString(); return buffer.toString();

@ -160,22 +160,28 @@ public abstract class serverAbstractThread extends Thread implements serverThrea
} }
private final void logError(String text) { private final void logError(String text) {
if (log == null) if (log == null) serverLog.logError("THREAD-CONTROL", text);
serverLog.logError("THREAD-CONTROL", text); else log.logError(text);
else }
log.logError(text);
private final void logError(String text,Throwable thrown) {
if (log == null) serverLog.logError("THREAD-CONTROL", text, thrown);
else log.logError(text,thrown);
} }
private void logSystem(String text) { private void logSystem(String text) {
if (log == null) if (log == null) serverLog.logSystem("THREAD-CONTROL", text);
serverLog.logSystem("THREAD-CONTROL", text); else log.logSystem(text);
else }
log.logSystem(text);
private void logSystem(String text, Throwable thrown) {
if (log == null) serverLog.logSystem("THREAD-CONTROL", text, thrown);
else log.logSystem(text,thrown);
} }
public void jobExceptionHandler(Exception e) { public void jobExceptionHandler(Exception e) {
// default handler for job exceptions. shall be overridden for own handler // default handler for job exceptions. shall be overridden for own handler
logError("thread '" + this.getName() + "': " + e.toString()); logError("thread '" + this.getName() + "': " + e.toString(),e);
e.printStackTrace();
} }
public void run() { public void run() {

@ -170,7 +170,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
public serverCore(int port, int maxSessions, int timeout, public serverCore(int port, int maxSessions, int timeout,
boolean termSleepingThreads, boolean blockAttack, boolean termSleepingThreads, boolean blockAttack,
serverHandler handlerPrototype, serverSwitch switchboard, serverHandler handlerPrototype, serverSwitch switchboard,
int commandMaxLength, int logl) throws IOException { int commandMaxLength) throws IOException {
this.port = port; this.port = port;
this.commandMaxLength = commandMaxLength; this.commandMaxLength = commandMaxLength;
this.denyHost = (blockAttack) ? new Hashtable() : null; this.denyHost = (blockAttack) ? new Hashtable() : null;
@ -207,7 +207,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.maxSessions = maxSessions; this.maxSessions = maxSessions;
this.timeout = timeout; this.timeout = timeout;
this.termSleepingThreads = termSleepingThreads; this.termSleepingThreads = termSleepingThreads;
this.log = new serverLog("SERVER", logl); this.log = new serverLog("SERVER");
} catch (java.lang.ClassNotFoundException e) { } catch (java.lang.ClassNotFoundException e) {
System.out.println("FATAL ERROR: " + e.getMessage() + " - Class Not Found"); System.exit(0); System.out.println("FATAL ERROR: " + e.getMessage() + " - Class Not Found"); System.exit(0);
} }

@ -133,7 +133,7 @@ public class yacyCore {
switchboard.setConfig("yacyStatus",""); switchboard.setConfig("yacyStatus","");
// set log level // set log level
log = new serverLog("YACY", Integer.parseInt(switchboard.getConfig("yacyLoglevel", "0"))); log = new serverLog("YACY");
// create a yacy db // create a yacy db
yacyDBPath = new File(sb.getRootPath(), sb.getConfig("yacyDB", "DATA/YACYDB")); yacyDBPath = new File(sb.getRootPath(), sb.getConfig("yacyDB", "DATA/YACYDB"));

@ -176,7 +176,6 @@ public final class yacy {
// read environment // read environment
//new //new
int port = Integer.parseInt(sb.getConfig("port", "8080")); int port = Integer.parseInt(sb.getConfig("port", "8080"));
int httpdLoglevel = Integer.parseInt(sb.getConfig("httpdLoglevel", "2"));
int timeout = Integer.parseInt(sb.getConfig("httpdTimeout", "60000")); int timeout = Integer.parseInt(sb.getConfig("httpdTimeout", "60000"));
if (timeout < 60000) timeout = 60000; if (timeout < 60000) timeout = 60000;
int maxSessions = Integer.parseInt(sb.getConfig("httpdMaxSessions", "100")); int maxSessions = Integer.parseInt(sb.getConfig("httpdMaxSessions", "100"));
@ -277,8 +276,7 @@ public final class yacy {
true /* block attacks (wrong protocol) */, true /* block attacks (wrong protocol) */,
protocolHandler /*command class*/, protocolHandler /*command class*/,
sb, sb,
30000 /*command max length incl. GET args*/, 30000 /*command max length incl. GET args*/);
httpdLoglevel /*loglevel*/);
server.setName("httpd:"+port); server.setName("httpd:"+port);
server.setPriority(Thread.MAX_PRIORITY); server.setPriority(Thread.MAX_PRIORITY);
if (server == null) { if (server == null) {
@ -321,8 +319,7 @@ public final class yacy {
try { try {
sb.waitForShutdown(); sb.waitForShutdown();
} catch (Exception e) { } catch (Exception e) {
serverLog.logError("MAIN CONTROL LOOP", "PANIK: " + e.getMessage()); serverLog.logError("MAIN CONTROL LOOP", "PANIK: " + e.getMessage(),e);
e.printStackTrace();
} }
// shut down // shut down
@ -344,13 +341,11 @@ public final class yacy {
sb.close(); sb.close();
} }
} catch (Exception e) { } catch (Exception e) {
serverLog.logError("STARTUP", "" + e); serverLog.logError("STARTUP", "Unexpected Error: " + e.getClass().getName(),e);
e.printStackTrace();
//System.exit(1); //System.exit(1);
} }
} catch (Exception ee) { } catch (Exception ee) {
serverLog.logFailure("STARTUP", "FATAL ERROR: " + ee.getMessage()); serverLog.logFailure("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee);
ee.printStackTrace();
} }
serverLog.logSystem("SHUTDOWN", "goodbye. (this is the last line)"); serverLog.logSystem("SHUTDOWN", "goodbye. (this is the last line)");
try { try {
@ -630,7 +625,7 @@ class shutdownHookThread extends Thread
this.mainThread.join(); this.mainThread.join();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); serverLog.logFailure("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);
} }
} }
} }

@ -107,20 +107,6 @@ mediaExt=ace,arj,asf,avi,bin,bz2,css,deb,doc,dmg,gif,gz,hqx,img,iso,jar,jpe,jpg,
# other peer users # other peer users
promoteSearchPageGreeting = promoteSearchPageGreeting =
# the log level, each for a specific software part
# loglevels are:
# NULL = 0: no output at all
# FAILURE = 1: system-level error, internal cause, critical and not fixeable (i.e. inconsistency)
# ERROR = 2: exceptional error, catcheable and non-critical (i.e. file error)
# WARNING = 3: uncritical service failure, may require user activity (i.e. input required, wrong authorization)
# SYSTEM = 4: regular system status information (i.e. start-up messages)
# INFO = 5: regular action information (i.e. any httpd request URL)
# DEBUG = 6: in-function status debug output
httpdLoglevel=4
proxyLoglevel=5
plasmaLoglevel=5
yacyLoglevel=5
# the path to the PLASMA database, especially the reverse word index # the path to the PLASMA database, especially the reverse word index
dbPath=DATA/PLASMADB dbPath=DATA/PLASMADB

Loading…
Cancel
Save