forked from I2P_Developers/i2p.i2p
* logs.jsp: Use wrapper method to find wrapper log if available
This commit is contained in:
@ -4,11 +4,14 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.i2p.util.FileUtil;
|
import net.i2p.util.FileUtil;
|
||||||
|
import net.i2p.util.VersionComparator;
|
||||||
|
|
||||||
import org.mortbay.http.Version;
|
import org.mortbay.http.Version;
|
||||||
|
import org.tanukisoftware.wrapper.WrapperManager;
|
||||||
|
|
||||||
public class LogsHelper extends HelperBase {
|
public class LogsHelper extends HelperBase {
|
||||||
public LogsHelper() {}
|
|
||||||
|
private static final String LOCATION_AVAILABLE = "3.3.7";
|
||||||
|
|
||||||
/** @since 0.8.12 */
|
/** @since 0.8.12 */
|
||||||
public String getJettyVersion() {
|
public String getJettyVersion() {
|
||||||
@ -37,9 +40,18 @@ public class LogsHelper extends HelperBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getServiceLogs() {
|
public String getServiceLogs() {
|
||||||
|
File f = null;
|
||||||
|
if (_context.hasWrapper()) {
|
||||||
|
String wv = System.getProperty("wrapper.version");
|
||||||
|
if (wv != null && (new VersionComparator()).compare(wv, LOCATION_AVAILABLE) >= 0) {
|
||||||
|
try {
|
||||||
|
f = WrapperManager.getWrapperLogFile();
|
||||||
|
} catch (Throwable t) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (f == null || !f.exists()) {
|
||||||
// RouterLaunch puts the location here if no wrapper
|
// RouterLaunch puts the location here if no wrapper
|
||||||
String path = System.getProperty("wrapper.logfile");
|
String path = System.getProperty("wrapper.logfile");
|
||||||
File f;
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
f = new File(path);
|
f = new File(path);
|
||||||
} else {
|
} else {
|
||||||
@ -48,6 +60,7 @@ public class LogsHelper extends HelperBase {
|
|||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
f = new File(_context.getBaseDir(), "wrapper.log");
|
f = new File(_context.getBaseDir(), "wrapper.log");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
String str = FileUtil.readTextFile(f.getAbsolutePath(), 250, false);
|
String str = FileUtil.readTextFile(f.getAbsolutePath(), 250, false);
|
||||||
if (str == null)
|
if (str == null)
|
||||||
return _("File not found") + ": <b><code>" + f.getAbsolutePath() + "</code></b>";
|
return _("File not found") + ": <b><code>" + f.getAbsolutePath() + "</code></b>";
|
||||||
|
Reference in New Issue
Block a user