Added Log4J for logging to a file
This commit is contained in:
parent
e5ca4aea34
commit
fa69c367e5
18 changed files with 127 additions and 26 deletions
|
|
@ -9,6 +9,8 @@ import android.net.wifi.WifiManager;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -19,6 +21,7 @@ import java.text.SimpleDateFormat;
|
|||
* Created by ezivkoc on 2014-07-30.
|
||||
*/
|
||||
public class CSVWriter {
|
||||
private static final Logger log = Logger.getLogger(CSVWriter.class);
|
||||
public static final String[] HEADINGS = new String[]{
|
||||
"Timestamp", "Behaviour", "RX Throughput(b/s)", "TX Throughput(b/s)", "RAT"
|
||||
};
|
||||
|
|
@ -36,7 +39,7 @@ public class CSVWriter {
|
|||
public CSVWriter(Context context){
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String path = prefs.getString("logging_path", "/sdcard/uecontrol/");
|
||||
if(!path.endsWith("/")) path += "/";
|
||||
if(!path.endsWith(File.separator)) path += File.separator;
|
||||
file = new File(
|
||||
path,
|
||||
"log_"+fileDateFormater.format(System.currentTimeMillis())+".log");
|
||||
|
|
@ -77,7 +80,7 @@ public class CSVWriter {
|
|||
out.println(line);
|
||||
out.close();
|
||||
} catch(IOException e){
|
||||
e.printStackTrace();
|
||||
log.warn(null, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ericsson.uecontrol.gui.util;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
|
@ -12,6 +14,7 @@ import java.util.ArrayList;
|
|||
* Created by ezivkoc on 2014-07-24.
|
||||
*/
|
||||
public class Configurator {
|
||||
private static final Logger log = Logger.getLogger(Configurator.class);
|
||||
/**
|
||||
* Sets a field in a class as externally configurable.
|
||||
*/
|
||||
|
|
@ -48,7 +51,7 @@ public class Configurator {
|
|||
try {
|
||||
conf.add(new ConfigurationParam(f));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
log.warn(null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +64,7 @@ public class Configurator {
|
|||
try {
|
||||
param.set();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
log.warn(null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue