[freenet-cvs] r15669 - in trunk/freenet/src/freenet: clients/http support/io
nextgens at freenetproject.org
nextgens at freenetproject.org
Sat Nov 3 12:39:47 UTC 2007
Author: nextgens
Date: 2007-11-03 12:39:46 +0000 (Sat, 03 Nov 2007)
New Revision: 15669
Modified:
trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
trunk/freenet/src/freenet/support/io/FileUtil.java
Log:
Display parts of the wrapper.log file on the startup page holder
Modified: trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StartupToadletServer.java 2007-11-03 12:24:45 UTC (rev 15668)
+++ trunk/freenet/src/freenet/clients/http/StartupToadletServer.java 2007-11-03 12:39:46 UTC (rev 15669)
@@ -22,6 +22,7 @@
import java.util.jar.JarFile;
import freenet.io.NetworkInterface;
import freenet.l10n.L10n;
+import freenet.support.io.FileUtil;
import freenet.support.Logger;
import freenet.support.OOMHandler;
import freenet.support.SimpleFieldSet;
@@ -95,6 +96,11 @@
HTMLNode infoboxContent = ctx.getPageMaker().getContentNode(infobox);
infoboxContent.addChild("#", "Your freenet node is starting up, please hold on.");
+ final File logs = new File("wrapper.log");
+ HTMLNode logInfobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-info", "Current status"));
+ HTMLNode logInfoboxContent = ctx.getPageMaker().getContentNode(logInfobox);
+ logInfoboxContent.addChild("%", FileUtil.readUTF(logs, logs.length()-2000).replace("\n", "<br>\n"));
+
//TODO: send a Retry-After header ?
writeHTMLReply(ctx, 503, desc, pageNode.generate());
}
Modified: trunk/freenet/src/freenet/support/io/FileUtil.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FileUtil.java 2007-11-03 12:24:45 UTC (rev 15668)
+++ trunk/freenet/src/freenet/support/io/FileUtil.java 2007-11-03 12:39:46 UTC (rev 15669)
@@ -81,7 +81,11 @@
return result;
}
- public static String readUTF(File file) throws FileNotFoundException, IOException {
+ public static String readUTF(File file) throws FileNotFoundException, IOException {
+ return readUTF(file, 0);
+ }
+
+ public static String readUTF(File file, long offset) throws FileNotFoundException, IOException {
StringBuffer result = new StringBuffer();
FileInputStream fis = null;
BufferedInputStream bis = null;
@@ -94,6 +98,7 @@
char[] buf = new char[4096];
int length = 0;
+ isr.skip(offset);
while((length = isr.read(buf)) > 0) {
result.append(buf, 0, length);
More information about the cvs
mailing list