EventLogger.DEBUG_INFO
你是对的,完整的 URL由应用程序以严重性 5 ( ) 记录net.rim.networkapi data
。有时,在使用 Wi-Fi 或直接 TCP 时,URL 甚至会被记录两次。这可能是一个安全问题,因为会记录主机和查询字符串。
将严重级别更改为EventLogger.INFORMATION
似乎可以防止不需要的日志记录。
示例应用程序(首先手动清理事件记录器):
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();
}
}