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

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

log tweaks

parent eadf472d
No related branches found
No related tags found
No related merge requests found
...@@ -61,8 +61,8 @@ public class I2PThread extends Thread { ...@@ -61,8 +61,8 @@ public class I2PThread extends Thread {
_createdBy = new Exception("Created by"); _createdBy = new Exception("Created by");
} }
private void log(int level, String msg) { log(level, msg, null); } private static void log(int level, String msg) { log(level, msg, null); }
private void log(int level, String msg, Throwable t) { private static void log(int level, String msg, Throwable t) {
// we cant assume log is created // we cant assume log is created
if (_log == null) _log = new Log(I2PThread.class); if (_log == null) _log = new Log(I2PThread.class);
if (_log.shouldLog(level)) if (_log.shouldLog(level))
...@@ -72,12 +72,12 @@ public class I2PThread extends Thread { ...@@ -72,12 +72,12 @@ public class I2PThread extends Thread {
@Override @Override
public void run() { public void run() {
_name = Thread.currentThread().getName(); _name = Thread.currentThread().getName();
log(Log.DEBUG, "New thread started: " + _name, _createdBy); log(Log.INFO, "New thread started" + (isDaemon() ? " (daemon): " : ": ") + _name, _createdBy);
try { try {
super.run(); super.run();
} catch (Throwable t) { } catch (Throwable t) {
try { try {
log(Log.CRIT, "Killing thread " + getName(), t); log(Log.CRIT, "Thread terminated unexpectedly: " + getName(), t);
} catch (Throwable woof) { } catch (Throwable woof) {
System.err.println("Died within the OOM itself"); System.err.println("Died within the OOM itself");
t.printStackTrace(); t.printStackTrace();
...@@ -85,12 +85,12 @@ public class I2PThread extends Thread { ...@@ -85,12 +85,12 @@ public class I2PThread extends Thread {
if (t instanceof OutOfMemoryError) if (t instanceof OutOfMemoryError)
fireOOM((OutOfMemoryError)t); fireOOM((OutOfMemoryError)t);
} }
log(Log.DEBUG, "Thread finished gracefully: " + _name); log(Log.INFO, "Thread finished normally: " + _name);
} }
@Override @Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
log(Log.DEBUG, "Thread finalized: " + _name); //log(Log.DEBUG, "Thread finalized: " + _name);
super.finalize(); super.finalize();
} }
......
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