I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c4f9485e authored by zzz's avatar zzz
Browse files

* Console: Add full file path to thread dump message

parent 9cff4d5a
No related branches found
No related tags found
No related merge requests found
package net.i2p.router.web; package net.i2p.router.web;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -208,7 +209,8 @@ public class ConfigServiceHandler extends FormHandler { ...@@ -208,7 +209,8 @@ public class ConfigServiceHandler extends FormHandler {
} catch (Throwable t) { } catch (Throwable t) {
addFormError("Warning: unable to contact the service manager - " + t.getMessage()); addFormError("Warning: unable to contact the service manager - " + t.getMessage());
} }
addFormNotice("Threads dumped to wrapper.log"); File wlog = LogsHelper.wrapperLogFile(_context);
addFormNotice(_("Threads dumped to {0}", wlog.getAbsolutePath()));
} else if (_("View console on startup").equals(_action)) { } else if (_("View console on startup").equals(_action)) {
browseOnStartup(true); browseOnStartup(true);
addFormNotice(_("Console is to be shown on startup")); addFormNotice(_("Console is to be shown on startup"));
......
...@@ -3,6 +3,7 @@ package net.i2p.router.web; ...@@ -3,6 +3,7 @@ package net.i2p.router.web;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import net.i2p.I2PAppContext;
import net.i2p.util.FileUtil; import net.i2p.util.FileUtil;
import net.i2p.util.VersionComparator; import net.i2p.util.VersionComparator;
...@@ -32,9 +33,13 @@ public class LogsHelper extends HelperBase { ...@@ -32,9 +33,13 @@ public class LogsHelper extends HelperBase {
return formatMessages(_context.logManager().getBuffer().getMostRecentCriticalMessages()); return formatMessages(_context.logManager().getBuffer().getMostRecentCriticalMessages());
} }
public String getServiceLogs() { /**
* Does not necessarily exist.
* @since 0.9.1
*/
static File wrapperLogFile(I2PAppContext ctx) {
File f = null; File f = null;
if (_context.hasWrapper()) { if (ctx.hasWrapper()) {
String wv = System.getProperty("wrapper.version"); String wv = System.getProperty("wrapper.version");
if (wv != null && (new VersionComparator()).compare(wv, LOCATION_AVAILABLE) >= 0) { if (wv != null && (new VersionComparator()).compare(wv, LOCATION_AVAILABLE) >= 0) {
try { try {
...@@ -51,9 +56,14 @@ public class LogsHelper extends HelperBase { ...@@ -51,9 +56,14 @@ public class LogsHelper extends HelperBase {
// look in new and old places // look in new and old places
f = new File(System.getProperty("java.io.tmpdir"), "wrapper.log"); f = new File(System.getProperty("java.io.tmpdir"), "wrapper.log");
if (!f.exists()) if (!f.exists())
f = new File(_context.getBaseDir(), "wrapper.log"); f = new File(ctx.getBaseDir(), "wrapper.log");
} }
} }
return f;
}
public String getServiceLogs() {
File f = wrapperLogFile(_context);
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>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment