315748 made --daemon log non appendable

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1930 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-06-07 00:21:42 +00:00
parent cf039140fb
commit fe6a6e86ed
2 changed files with 6 additions and 3 deletions

View File

@ -177,7 +177,10 @@ public class Main
// Special internal indicator that jetty was started by the jetty.sh Daemon
if ("--daemon".equals(arg))
{
File startLog = new File(System.getProperty("jetty.logs","."),"start.log");
File startDir = new File(System.getProperty("jetty.logs","logs"));
if (!startDir.exists() || !startDir.canWrite() )
startDir = new File(".");
File startLog = new File(startDir,"start.log");
if (!startLog.exists() && !startLog.createNewFile())
{
// Output about error is lost in majority of cases.
@ -193,7 +196,7 @@ public class Main
// Toss a unique exit code indicating this failure.
System.exit(ERR_LOGGING);
}
PrintStream logger = new PrintStream(new FileOutputStream(startLog,true));
PrintStream logger = new PrintStream(new FileOutputStream(startLog,false));
System.setOut(logger);
System.setErr(logger);
System.out.println("Establishing start.log on " + new Date());

View File

@ -22,7 +22,7 @@
</Arg>
</New>
<Call class="org.eclipse.jetty.util.log.Log" name="debug"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="org.eclipse.jetty.util.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call>
<Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call>