On Monday 19 November 2007 13:10, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2007-11-19 13:10:47 +0000 (Mon, 19 Nov 2007)
> New Revision: 15819
> 
> Modified:
>    trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
> Log:
> StartupToadlet:
>       * Attempt to show wrapper.log only if it has reasonnable chances to 
> succeed
>       * Strip everything before the first '\n' so that we don't start 
> displaying 
from the middle of a line
> 
> Modified: trunk/freenet/src/freenet/clients/http/StartupToadletServer.java
> ===================================================================
> --- trunk/freenet/src/freenet/clients/http/StartupToadletServer.java  
2007-11-19 10:24:46 UTC (rev 15818)
> +++ trunk/freenet/src/freenet/clients/http/StartupToadletServer.java  
2007-11-19 13:10:47 UTC (rev 15819)
> @@ -101,10 +101,13 @@
>               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).replaceAll("\n", "<br>\n"));
> -                
> +                if(logs.exists() && logs.isFile() && logs.canRead() && 
logs.length() > 2000) {

Why not display shorter logs? If it's less than 2000 chars we don't need to 
chop off the first \n.

> +                    HTMLNode logInfobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-info", "Current 
status"));
> +                    HTMLNode logInfoboxContent = 
ctx.getPageMaker().getContentNode(logInfobox);
> +                    String content = FileUtil.readUTF(logs, 
logs.length()-2000);
> +                    int eol = content.indexOf('\n');
> +                    logInfoboxContent.addChild("%", content.substring((eol 
< 0 ? 0 : eol)).replaceAll("\n", "<br>\n"));
> +                }
>                  //TODO: send a Retry-After header ?
>                  writeHTMLReply(ctx, 503, desc, pageNode.generate());
>              }
> 
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20071119/6880d442/attachment.pgp>

Reply via email to