Startup: Add property to disable output redirect (ticket #2037)

This commit is contained in:
zzz
2017-09-02 12:12:08 +00:00
parent f611f4c965
commit 8fd354eea6
2 changed files with 9 additions and 3 deletions

View File

@ -153,6 +153,8 @@ public class Router implements RouterClock.ClockShiftListener {
// just in case, lets make it explicit... // just in case, lets make it explicit...
TimeZone.setDefault(TimeZone.getTimeZone("GMT")); TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
} }
// Note: I2P_DISABLE_OUTPUT_OVERRIDE implemented in startup/WorkingDir.java
// https://www.kb.cert.org/vuls/id/402580 // https://www.kb.cert.org/vuls/id/402580
// http://docs.codehaus.org/display/JETTY/SystemProperties // http://docs.codehaus.org/display/JETTY/SystemProperties
// Fixed in Jetty 5.1.15 but we are running 5.1.12 // Fixed in Jetty 5.1.15 but we are running 5.1.12

View File

@ -60,7 +60,8 @@ public class WorkingDir {
* Only call this once on router invocation. * Only call this once on router invocation.
* Caller should store the return value for future reference. * Caller should store the return value for future reference.
* *
* This also redirects stdout and stderr to a wrapper.log file if there is no wrapper present. * This also redirects stdout and stderr to a wrapper.log file if there is no wrapper present,
* unless system property I2P_DISABLE_OUTPUT_OVERRIDE is set.
* *
* @param migrateOldConfig whether to copy all data over from an existing install * @param migrateOldConfig whether to copy all data over from an existing install
*/ */
@ -262,7 +263,8 @@ public class WorkingDir {
} }
/** /**
* Redirect stdout and stderr to a wrapper.log file if there is no wrapper. * Redirect stdout and stderr to a wrapper.log file if there is no wrapper,
* unless system property I2P_DISABLE_OUTPUT_OVERRIDE is set.
* *
* If there is no -Dwrapper.log=/path/to/wrapper.log on the java command line * If there is no -Dwrapper.log=/path/to/wrapper.log on the java command line
* to specify a log file, check for existence of wrapper.log in CWD, * to specify a log file, check for existence of wrapper.log in CWD,
@ -275,7 +277,9 @@ public class WorkingDir {
* @since 0.8.13 * @since 0.8.13
*/ */
private static void setupSystemOut(String dir) { private static void setupSystemOut(String dir) {
if (System.getProperty("wrapper.version") != null) if (SystemVersion.hasWrapper())
return;
if (System.getProperty("I2P_DISABLE_OUTPUT_OVERRIDE") != null)
return; return;
String path = System.getProperty(PROP_WRAPPER_LOG); String path = System.getProperty(PROP_WRAPPER_LOG);
File logfile; File logfile;