Search code examples
blackberry-10blackberry-ndk

The best way to get BlackBerry 10 logs?


BlackBerry 10 has quite sophisticated logs system compared to iOS and Android. The only solution i found is using javaloader tool like this:

javaloader.exe -u eventlog > eventlog.txt

But it seems to work only with pre-10 versions of BlackBerry OS. I cannot find this tool in BlackBerry 10 NDK.

What is the simplest method to get the logs using the command line?


Solution

  • There are two ways, both documented in the release notes.

    If you can copy the logger stream (for an application) to the console by defining a function like:

    void myMessageOutput(QtMsgType type, const char* msg) {
        fprintf(stdout, "%s\n", msg);
        fflush(stdout);
    }
    

    Then installing it as a message handler:

    int main(int argc, char **argv)
    {
        Application app(argc, argv);
        qInstallMsgHandler(myMessageOutput);
        ...
    }
    

    You can connect to the simulator or device with an ssh system and use the slog2info command.