Moved debug log entries to Util.d()

This commit is contained in:
str4d
2014-01-16 17:40:14 +00:00
parent fbf353858e
commit 8457f279f2
10 changed files with 88 additions and 88 deletions

View File

@ -86,7 +86,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
@Override
public void onCreate(Bundle savedInstanceState)
{
Util.i(this + " onCreate called");
Util.d(this + " onCreate called");
super.onCreate(savedInstanceState);
_sharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
_myDir = getFilesDir().getAbsolutePath();
@ -205,14 +205,14 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
@Override
public void onRestart()
{
Util.i(this + " onRestart called");
Util.d(this + " onRestart called");
super.onRestart();
}
@Override
public void onStart()
{
Util.i(this + " onStart called");
Util.d(this + " onStart called");
super.onStart();
if (_sharedPrefs.getBoolean(PREF_AUTO_START, DEFAULT_AUTO_START))
startRouter();
@ -242,28 +242,28 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
@Override
public void onResume()
{
Util.i(this + " onResume called");
Util.d(this + " onResume called");
super.onResume();
}
@Override
public void onPause()
{
Util.i(this + " onPause called");
Util.d(this + " onPause called");
super.onPause();
}
@Override
public void onSaveInstanceState(Bundle outState)
{
Util.i(this + " onSaveInstanceState called");
Util.d(this + " onSaveInstanceState called");
super.onSaveInstanceState(outState);
}
@Override
public void onStop()
{
Util.i(this + " onStop called");
Util.d(this + " onStop called");
unbindRouter();
super.onStop();
}
@ -271,7 +271,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
@Override
public void onDestroy()
{
Util.i(this + " onDestroy called");
Util.d(this + " onDestroy called");
super.onDestroy();
}
@ -355,14 +355,14 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
protected boolean startRouter() {
Intent intent = new Intent();
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
Util.i(this + " calling startService");
Util.d(this + " calling startService");
ComponentName name = startService(intent);
if (name == null)
Util.i(this + " XXXXXXXXXXXXXXXXXXXX got from startService: " + name);
Util.i(this + " got from startService: " + name);
Util.d(this + " XXXXXXXXXXXXXXXXXXXX got from startService: " + name);
Util.d(this + " got from startService: " + name);
boolean success = bindRouter(true);
if (!success)
Util.i(this + " Bind router failed");
Util.d(this + " Bind router failed");
return success;
}
@ -372,15 +372,15 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
protected boolean bindRouter(boolean autoCreate) {
Intent intent = new Intent(RouterBinder.class.getName());
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
Util.i(this + " calling bindService");
Util.d(this + " calling bindService");
_connection = new RouterConnection();
_triedBind = bindService(intent, _connection, autoCreate ? BIND_AUTO_CREATE : 0);
Util.i(this + " bindService: auto create? " + autoCreate + " success? " + _triedBind);
Util.d(this + " bindService: auto create? " + autoCreate + " success? " + _triedBind);
return _triedBind;
}
protected void unbindRouter() {
Util.i(this + " unbindRouter called with _isBound:" + _isBound + " _connection:" + _connection + " _triedBind:" + _triedBind);
Util.d(this + " unbindRouter called with _isBound:" + _isBound + " _connection:" + _connection + " _triedBind:" + _triedBind);
if (_triedBind && _connection != null)
unbindService(_connection);
@ -396,7 +396,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
protected class RouterConnection implements ServiceConnection {
public void onServiceConnected(ComponentName name, IBinder service) {
Util.i(this + " connected to router service");
Util.d(this + " connected to router service");
RouterBinder binder = (RouterBinder) service;
RouterService svc = binder.getService();
_routerService = svc;
@ -405,7 +405,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements
}
public void onServiceDisconnected(ComponentName name) {
Util.i(this + " disconnected from router service!!!!!!!");
Util.d(this + " disconnected from router service!!!!!!!");
// save memory
_routerService = null;
_isBound = false;

View File

@ -39,23 +39,23 @@ class InitActivities {
}
void debugStuff() {
Util.i("java.io.tmpdir" + ": " + System.getProperty("java.io.tmpdir"));
Util.i("java.vendor" + ": " + System.getProperty("java.vendor"));
Util.i("java.version" + ": " + System.getProperty("java.version"));
Util.i("os.arch" + ": " + System.getProperty("os.arch"));
Util.i("os.name" + ": " + System.getProperty("os.name"));
Util.i("os.version" + ": " + System.getProperty("os.version"));
Util.i("user.dir" + ": " + System.getProperty("user.dir"));
Util.i("user.home" + ": " + System.getProperty("user.home"));
Util.i("user.name" + ": " + System.getProperty("user.name"));
Util.i("getFilesDir()" + ": " + myDir);
Util.i("max mem" + ": " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()));
Util.i("Package" + ": " + ctx.getPackageName());
Util.i("Version" + ": " + _ourVersion);
Util.i("MODEL" + ": " + Build.MODEL);
Util.i("DISPLAY" + ": " + Build.DISPLAY);
Util.i("VERSION" + ": " + Build.VERSION.RELEASE);
Util.i("SDK" + ": " + Build.VERSION.SDK);
Util.d("java.io.tmpdir" + ": " + System.getProperty("java.io.tmpdir"));
Util.d("java.vendor" + ": " + System.getProperty("java.vendor"));
Util.d("java.version" + ": " + System.getProperty("java.version"));
Util.d("os.arch" + ": " + System.getProperty("os.arch"));
Util.d("os.name" + ": " + System.getProperty("os.name"));
Util.d("os.version" + ": " + System.getProperty("os.version"));
Util.d("user.dir" + ": " + System.getProperty("user.dir"));
Util.d("user.home" + ": " + System.getProperty("user.home"));
Util.d("user.name" + ": " + System.getProperty("user.name"));
Util.d("getFilesDir()" + ": " + myDir);
Util.d("max mem" + ": " + DataHelper.formatSize(Runtime.getRuntime().maxMemory()));
Util.d("Package" + ": " + ctx.getPackageName());
Util.d("Version" + ": " + _ourVersion);
Util.d("MODEL" + ": " + Build.MODEL);
Util.d("DISPLAY" + ": " + Build.DISPLAY);
Util.d("VERSION" + ": " + Build.VERSION.RELEASE);
Util.d("SDK" + ": " + Build.VERSION.SDK);
}
void initialize() {
@ -121,7 +121,7 @@ class InitActivities {
if ( allcertificates != null) {
for (int i = 0; i < allcertificates.length; i++) {
File f = allcertificates[i];
Util.i("Deleting old certificate file/dir " + f);
Util.d("Deleting old certificate file/dir " + f);
FileUtil.rmdir(f, false);
}
}
@ -144,7 +144,7 @@ class InitActivities {
InputStream in = null;
FileOutputStream out = null;
Util.i("Creating file " + f + " from resource");
Util.d("Creating file " + f + " from resource");
byte buf[] = new byte[4096];
try {
// Context methods
@ -170,7 +170,7 @@ class InitActivities {
FileOutputStream out = null;
ZipInputStream zis = null;
Util.i("Creating files in '" + myDir + "/" + f + "/' from resource");
Util.d("Creating files in '" + myDir + "/" + f + "/' from resource");
try {
// Context methods
in = ctx.getResources().openRawResource(resID);
@ -186,7 +186,7 @@ class InitActivities {
baos.write(buffer, 0, count);
}
String filename = ze.getName();
Util.i("Creating file " + myDir + "/" + f +"/" + filename + " from resource");
Util.d("Creating file " + myDir + "/" + f +"/" + filename + " from resource");
byte[] bytes = baos.toByteArray();
out = new FileOutputStream(new File(myDir + "/" + f +"/" + filename));
out.write(bytes);
@ -228,9 +228,9 @@ class InitActivities {
try {
fin = new FileInputStream(new File(myDir, f));
DataHelper.loadProps(props, fin);
Util.i("Merging resource into file " + f);
Util.d("Merging resource into file " + f);
} catch (IOException ioe) {
Util.i("Creating file " + f + " from resource");
Util.d("Creating file " + f + " from resource");
}
// override user settings
@ -240,7 +240,7 @@ class InitActivities {
props.putAll(overrides);
File path = new File(myDir, f);
DataHelper.storeProps(props, path);
Util.i("Saved " + props.size() +" properties in " + f);
Util.d("Saved " + props.size() +" properties in " + f);
} catch (IOException ioe) {
} catch (Resources.NotFoundException nfe) {
} finally {
@ -262,7 +262,7 @@ class InitActivities {
fin = ctx.openFileInput(CONFIG_FILE);
DataHelper.loadProps(props, fin);
} catch (IOException ioe) {
Util.i("Looks like a new install");
Util.d("Looks like a new install");
} finally {
if (fin != null) try { fin.close(); } catch (IOException ioe) {}
}
@ -272,12 +272,12 @@ class InitActivities {
boolean newVersion = !_ourVersion.equals(oldVersion);
if (newVersion) {
Util.i("New version " + _ourVersion);
Util.d("New version " + _ourVersion);
props.setProperty(PROP_INSTALLED_VERSION, _ourVersion);
try {
DataHelper.storeProps(props, ctx.getFileStreamPath(CONFIG_FILE));
} catch (IOException ioe) {
Util.i("Failed to write " + CONFIG_FILE);
Util.d("Failed to write " + CONFIG_FILE);
}
}
return newVersion;

View File

@ -40,7 +40,7 @@ public class MainActivity extends I2PActivityBase implements
@Override
protected void onPostCreate(Bundle savedInstanceState) {
Util.i("Initializing...");
Util.d("Initializing...");
InitActivities init = new InitActivities(this);
init.debugStuff();
init.initialize();
@ -54,13 +54,13 @@ public class MainActivity extends I2PActivityBase implements
try {
if (mStateService.isStarted()) {
// Update for the current state.
Util.i("Fetching state.");
Util.d("Fetching state.");
String curState = mStateService.getState();
Message msg = mHandler.obtainMessage(STATE_MSG);
msg.getData().putString("state", curState);
mHandler.sendMessage(msg);
} else {
Util.i("StateService not started yet");
Util.d("StateService not started yet");
}
} catch (RemoteException e) {}
}
@ -114,7 +114,7 @@ public class MainActivity extends I2PActivityBase implements
intent.setClassName(this, "net.i2p.android.router.service.RouterService");
mTriedBindState = bindService(intent,
mStateConnection, 0);
Util.i("Bind to IRouterState successful: " + mTriedBindState);
Util.d("Bind to IRouterState successful: " + mTriedBindState);
}
super.onRouterBind(svc);
@ -125,12 +125,12 @@ public class MainActivity extends I2PActivityBase implements
public void onServiceConnected(ComponentName className,
IBinder service) {
mStateService = IRouterState.Stub.asInterface(service);
Util.i("StateService bound");
Util.d("StateService bound");
try {
if (mStateService.isStarted()) {
mStateService.registerCallback(mStateCallback);
// Update for the current state.
Util.i("Fetching state.");
Util.d("Fetching state.");
String curState = mStateService.getState();
Message msg = mHandler.obtainMessage(STATE_MSG);
msg.getData().putString("state", curState);

View File

@ -204,7 +204,7 @@ public class SettingsActivity extends PreferenceActivity {
if (defaultval.endsWith(")")) {
// strip the ")" off the tail end, this is the default value!
String string = defaultval.substring(0, defaultval.length() - 1);
Util.i("Resetting property '" + x + "' to default '" + string +"'");
Util.d("Resetting property '" + x + "' to default '" + string +"'");
props.setProperty(x, string);
}

View File

@ -33,7 +33,7 @@ public class AddressEntryLoader extends AsyncTaskLoader<List<AddressEntry>> {
public List<AddressEntry> loadInBackground() {
// get the names
NamingService ns = NamingServiceUtil.getNamingService(mRContext, mBook);
Util.i("NamingService: " + ns.getName());
Util.d("NamingService: " + ns.getName());
// After router shutdown we get nothing... why?
List<AddressEntry> ret = new ArrayList<AddressEntry>();
Map<String, Destination> names = new TreeMap<String, Destination>();

View File

@ -63,7 +63,7 @@ public class NetDbSummaryPagerFragment extends I2PFragmentBase implements
@Override
public void onRouterConnectionNotReady() {
Util.i("Router not running or not bound to NetDbSummaryPagerFragment");
Util.d("Router not running or not bound to NetDbSummaryPagerFragment");
}
@Override
@ -77,7 +77,7 @@ public class NetDbSummaryPagerFragment extends I2PFragmentBase implements
switch (item.getItemId()) {
case R.id.action_refresh:
if (getRouterContext() != null) {
Util.i("Refresh called, restarting Loader");
Util.d("Refresh called, restarting Loader");
mNetDbPagerAdapter.setData(null);
mViewPager.invalidate();
getLoaderManager().restartLoader(0, null, this);

View File

@ -34,7 +34,7 @@ class Init {
if (files != null) {
for (int i = 0; i < files.length; i++) {
File f = files[i];
Util.i("Deleting old file/dir " + f);
Util.d("Deleting old file/dir " + f);
FileUtil.rmdir(f, false);
}
}

View File

@ -84,17 +84,17 @@ class LoadClientsJob extends JobImpl {
public String getName() { return "Start I2P Tunnel"; };
public void runJob() {
Util.i("Starting i2ptunnel");
Util.d("Starting i2ptunnel");
TunnelControllerGroup tcg = TunnelControllerGroup.getInstance();
int sz = tcg.getControllers().size();
Util.i("i2ptunnel started " + sz + " clients");
Util.d("i2ptunnel started " + sz + " clients");
}
}
private class ClientShutdownHook implements Runnable {
public void run() {
Util.i("client shutdown hook");
Util.d("client shutdown hook");
// i2ptunnel registers its own hook
// statsummarizer registers its own hook
if (_bob != null)

View File

@ -75,7 +75,7 @@ public class RouterService extends Service {
mStartCalled = false;
State lastState = getSavedState();
setState(State.INIT);
Util.i(this + " onCreate called"
Util.d(this + " onCreate called"
+ " Saved state is: " + lastState
+ " Current state is: " + _state);
@ -108,7 +108,7 @@ public class RouterService extends Service {
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Util.i(this + " onStart called"
Util.d(this + " onStart called"
+ " Intent is: " + intent
+ " Flags is: " + flags
+ " ID is: " + startId
@ -116,7 +116,7 @@ public class RouterService extends Service {
mStartCalled = true;
boolean restart = intent != null && intent.getBooleanExtra(EXTRA_RESTART, false);
if(restart) {
Util.i(this + " RESTARTING");
Util.d(this + " RESTARTING");
}
synchronized(_stateLock) {
if(_state != State.INIT) //return START_STICKY;
@ -155,7 +155,7 @@ public class RouterService extends Service {
private class Waiter implements Runnable {
public void run() {
Util.i(MARKER + this + " waiter handler"
Util.d(MARKER + this + " waiter handler"
+ " Current state is: " + _state);
if(_state == State.WAITING) {
if(Util.isConnected(RouterService.this)) {
@ -178,11 +178,11 @@ public class RouterService extends Service {
private class Starter implements Runnable {
public void run() {
Util.i(MARKER + this + " starter thread"
Util.d(MARKER + this + " starter thread"
+ " Current state is: " + _state);
//Util.i(MARKER + this + " JBigI speed test started");
//Util.d(MARKER + this + " JBigI speed test started");
//NativeBigInteger.main(null);
//Util.i(MARKER + this + " JBigI speed test finished, launching router");
//Util.d(MARKER + this + " JBigI speed test finished, launching router");
// Before we launch, fix up any settings that need to be fixed here.
@ -344,7 +344,7 @@ public class RouterService extends Service {
_context.addFinalShutdownTask(new FinalShutdownHook());
_starterThread = null;
}
Util.i("Router.main finished");
Util.d("Router.main finished");
}
}
@ -417,21 +417,21 @@ public class RouterService extends Service {
@Override
public IBinder onBind(Intent intent) {
Util.i(this + "onBind called"
Util.d(this + "onBind called"
+ " Current state is: " + _state);
Util.i("Intent action: " + intent.getAction());
Util.d("Intent action: " + intent.getAction());
// Select the interface to return.
if (RouterBinder.class.getName().equals(intent.getAction())) {
// Local Activity wanting access to the RouterContext
Util.i("Returning RouterContext binder");
Util.d("Returning RouterContext binder");
return _binder;
}
if (IRouterState.class.getName().equals(intent.getAction())) {
// Someone wants to monitor the router state.
Util.i("Returning state binder");
Util.d("Returning state binder");
return mStatusBinder;
}
Util.i("Unknown binder request, returning null");
Util.d("Unknown binder request, returning null");
return null;
}
@ -502,7 +502,7 @@ public class RouterService extends Service {
* Stop and don't restart the router, but keep the service
*/
public void manualStop() {
Util.i("manualStop called"
Util.d("manualStop called"
+ " Current state is: " + _state);
synchronized(_stateLock) {
if(!canManualStop()) {
@ -523,7 +523,7 @@ public class RouterService extends Service {
* Stop the router and kill the service
*/
public void manualQuit() {
Util.i("manualQuit called"
Util.d("manualQuit called"
+ " Current state is: " + _state);
synchronized(_stateLock) {
if(!canManualStop()) {
@ -547,7 +547,7 @@ public class RouterService extends Service {
* Stop and then spin waiting for a network connection, then restart
*/
public void networkStop() {
Util.i("networkStop called"
Util.d("networkStop called"
+ " Current state is: " + _state);
synchronized(_stateLock) {
if(_state == State.STARTING) {
@ -568,7 +568,7 @@ public class RouterService extends Service {
}
public void manualStart() {
Util.i("restart called"
Util.d("restart called"
+ " Current state is: " + _state);
synchronized(_stateLock) {
if(!canManualStart()) {
@ -618,7 +618,7 @@ public class RouterService extends Service {
*/
@Override
public void onDestroy() {
Util.i("onDestroy called"
Util.d("onDestroy called"
+ " Current state is: " + _state);
_handler.removeCallbacks(_updater);
@ -669,14 +669,14 @@ public class RouterService extends Service {
public void run() {
try {
Util.i(MARKER + this + " stopper thread"
Util.d(MARKER + this + " stopper thread"
+ " Current state is: " + _state);
RouterContext ctx = _context;
if(ctx != null) {
ctx.router().shutdown(Router.EXIT_HARD);
}
_statusBar.remove();
Util.i("********** Router shutdown complete");
Util.d("********** Router shutdown complete");
synchronized(_stateLock) {
if(_state == nextState) {
setState(stopState);
@ -695,7 +695,7 @@ public class RouterService extends Service {
private class ShutdownHook implements Runnable {
public void run() {
Util.i(this + " shutdown hook"
Util.d(this + " shutdown hook"
+ " Current state is: " + _state);
_statusBar.replace(StatusBar.ICON_SHUTTING_DOWN, "I2P is shutting down");
I2PReceiver rcvr = _receiver;
@ -734,7 +734,7 @@ public class RouterService extends Service {
public void run() {
try {
Util.i(this + " final shutdown hook"
Util.d(this + " final shutdown hook"
+ " Current state is: " + _state);
//I2PReceiver rcvr = _receiver;
@ -753,7 +753,7 @@ public class RouterService extends Service {
_handler.postDelayed(new Waiter(), 10 * 1000);
} else if(_state == State.STARTING || _state == State.RUNNING
|| _state == State.ACTIVE || _state == State.STOPPING) {
Util.i(this + " died of unknown causes");
Util.w(this + " died of unknown causes");
setState(State.STOPPED);
// Unregister all callbacks.
mStateCallbacks.kill();

View File

@ -35,7 +35,7 @@ public class RateGraphFragment extends I2PFragmentBase {
}
public void update(Observable o, Object arg) {
Util.i("Redrawing plot");
Util.d("Redrawing plot");
plot.redraw();
}
}
@ -86,7 +86,7 @@ public class RateGraphFragment extends I2PFragmentBase {
public void onStop() {
super.onStop();
if (_listener != null && _plotUpdater != null) {
Util.i("Removing plot updater from listener");
Util.d("Removing plot updater from listener");
_listener.removeObserver(_plotUpdater);
}
_handler.removeCallbacks(_setupTask);
@ -97,15 +97,15 @@ public class RateGraphFragment extends I2PFragmentBase {
String rateName = getArguments().getString(RATE_NAME);
long period = getArguments().getLong(RATE_PERIOD);
Util.i("Setting up " + rateName + "." + period);
Util.d("Setting up " + rateName + "." + period);
if (StatSummarizer.instance() == null) {
Util.i("StatSummarizer is null, delaying setup");
Util.d("StatSummarizer is null, delaying setup");
_handler.postDelayed(this, 1000);
return;
}
_listener = StatSummarizer.instance().getListener(rateName, period);
if (_listener == null) {
Util.i("Listener is null, delaying setup");
Util.d("Listener is null, delaying setup");
_handler.postDelayed(this, 1000);
return;
}
@ -116,7 +116,7 @@ public class RateGraphFragment extends I2PFragmentBase {
_ratePlot.addSeries(rateSeries, new LineAndPointFormatter(Color.rgb(0, 0, 0), null, Color.rgb(0, 80, 0), null));
Util.i("Adding plot updater to listener");
Util.d("Adding plot updater to listener");
_listener.addObserver(_plotUpdater);
_ratePlot.setDomainStepMode(XYStepMode.SUBDIVIDE);
@ -153,7 +153,7 @@ public class RateGraphFragment extends I2PFragmentBase {
});
Util.i("Redrawing plot");
Util.d("Redrawing plot");
_ratePlot.redraw();
}
}