In the eventlogger, if i change the Min log level to "Debug info" and do some network calls, I have noticed that the connection factory logs the network url .For example , I saw this
guid:0x287F0A38583E7BC6 time: Mon Jan 21 18:29:15 2013 severity:5 type:2 app:net.rim.networkapi data:FcoC https://xyz.co.uk/abc/test?appversion=1.2.3&;deviceside=false;ConnectionType=mds-public;ConnectionTimeout=20000;EndToEndRequired
This happens for all the apps I work for. Is there any way we could do something to avoid the connectionfactory from logging this information in the event logger
You were right, the full URL is logged with severity 5 (EventLogger.DEBUG_INFO
) by the app net.rim.networkapi data
. Sometimes, when using Wi-Fi or direct TCP, the URL is even logged twice. This can be a security problem as hosts and querystrings are logged.
Changing the severity level to EventLogger.INFORMATION
seems to prevent the undesired logging.
Sample app (manually clean event logger first):
public class Main extends Application{
public Main(){
doTest();
}
private void doTest(){
long GUID = 0x9cf1bac07b565732L;
EventLogger.register(GUID, "conn_factory_logging_test", EventLogger.VIEWER_STRING);
EventLogger.setMinimumLevel(EventLogger.INFORMATION);
ConnectionFactory factory = new ConnectionFactory();
factory.setPreferredTransportTypes(new int[]{ TransportInfo.TRANSPORT_TCP_WIFI, TransportInfo.TRANSPORT_TCP_CELLULAR});
ConnectionDescriptor cd = factory.getConnection("http://www.google.com");
HttpConnection httpConnection = (HttpConnection) cd.getConnection();
try {
httpConnection.setRequestMethod(HttpConnection.GET);
int responseCode = httpConnection.getResponseCode();
String result = "Server Response: " + responseCode;
EventLogger.logEvent(GUID, result.getBytes(), EventLogger.INFORMATION);
EventLogger.startEventLogViewer();
} catch (Exception e) {
System.err.println(e);
} finally {
try {
httpConnection.close();
} catch (IOException e) {}
}
System.exit(0);
}
public static void main(String[] args){
new Main().enterEventDispatcher();
}
}