Bug 786425 - Always log debug messages to logcat, even if file logging disable;r=jmaher

This commit is contained in:
William Lachance 2012-08-30 14:51:16 -04:00
parent a43096768a
commit 1f6729be6c
2 changed files with 15 additions and 14 deletions

View File

@ -98,7 +98,7 @@ public class CmdWorkerThread extends Thread
String inputLine, outputLine;
DoCommand dc = new DoCommand(theParent.svc);
SUTAgentAndroid.logToFile(dc, "CmdWorkerThread starts: "+getId());
SUTAgentAndroid.log(dc, "CmdWorkerThread starts: "+getId());
int nAvail = cmdIn.available();
cmdIn.skip(nAvail);
@ -136,7 +136,7 @@ public class CmdWorkerThread extends Thread
{
String message = String.format("%s : %s",
socket.getInetAddress().getHostAddress(), inputLine);
SUTAgentAndroid.logToFile(dc, message);
SUTAgentAndroid.log(dc, message);
outputLine = dc.processCommand(inputLine, out, in, cmdOut);
if (outputLine.length() > 0)
@ -166,7 +166,7 @@ public class CmdWorkerThread extends Thread
in.close();
in = null;
socket.close();
SUTAgentAndroid.logToFile(dc, "CmdWorkerThread ends: "+getId());
SUTAgentAndroid.log(dc, "CmdWorkerThread ends: "+getId());
}
catch (IOException e)
{

View File

@ -166,7 +166,7 @@ public class SUTAgentAndroid extends Activity
SUTAgentAndroid.RegSvrIPPort = dc.GetIniData("Registration Server", "PORT", sIniFile);
SUTAgentAndroid.HardwareID = dc.GetIniData("Registration Server", "HARDWARE", sIniFile);
SUTAgentAndroid.Pool = dc.GetIniData("Registration Server", "POOL", sIniFile);
logToFile(dc, "onCreate");
log(dc, "onCreate");
tv = (TextView) this.findViewById(R.id.Textview01);
@ -362,7 +362,7 @@ public class SUTAgentAndroid extends Activity
super.onDestroy();
if (isFinishing())
{
logToFile(dc, "onDestroy - finishing");
log(dc, "onDestroy - finishing");
Intent listenerSvc = new Intent(this, ASMozStub.class);
listenerSvc.setAction("com.mozilla.SUTAgentAndroid.service.LISTENER_SERVICE");
stopService(listenerSvc);
@ -377,7 +377,7 @@ public class SUTAgentAndroid extends Activity
}
else
{
logToFile(dc, "onDestroy - not finishing");
log(dc, "onDestroy - not finishing");
}
}
@ -388,8 +388,8 @@ public class SUTAgentAndroid extends Activity
DoCommand dc = new DoCommand(getApplication());
if (dc != null)
{
logToFile(dc, "onLowMemory");
logToFile(dc, dc.GetMemoryInfo());
log(dc, "onLowMemory");
log(dc, dc.GetMemoryInfo());
String procInfo = dc.GetProcessInfo();
if (procInfo != null)
{
@ -398,11 +398,11 @@ public class SUTAgentAndroid extends Activity
{
if (line.contains("mozilla"))
{
logToFile(dc, line);
log(dc, line);
String words[] = line.split("\t");
if ((words != null) && (words.length > 1))
{
logToFile(dc, dc.StatProcess(words[1]));
log(dc, dc.StatProcess(words[1]));
}
}
}
@ -762,8 +762,10 @@ public class SUTAgentAndroid extends Activity
return null;
}
public static void logToFile(DoCommand dc, String message)
public static void log(DoCommand dc, String message)
{
Log.i("SUTAgentAndroid", message);
if (SUTAgentAndroid.LogCommands == false)
{
return;
@ -771,16 +773,15 @@ public class SUTAgentAndroid extends Activity
if (message == null)
{
Log.e("SUTAgentAndroid", "bad arguments in logToFile()!");
Log.e("SUTAgentAndroid", "bad arguments in log()!");
return;
}
Log.i("SUTAgentAndroid", message);
String fileDateStr = "00";
String testRoot = dc.GetTestRoot();
String datestamp = dc.GetSystemTime();
if (testRoot == null || datestamp == null)
{
Log.e("SUTAgentAndroid", "Unable to get testRoot or datestamp in logToFile!");
Log.e("SUTAgentAndroid", "Unable to get testRoot or datestamp in log!");
return;
}