The best way to get BlackBerry 10 logs?
Asked Answered
C

5

8

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?

Crackleware answered 28/10, 2012 at 19:50 Comment(2)
Are you tried this solution?Woolsack
@CAMOBAP: yes, but -getFile works faster for me.Crackleware
N
6

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.

Newborn answered 29/10, 2012 at 3:27 Comment(4)
Debug versions built by Momentics will produce a core file. QNX developer support people at BlackBerry events consistently recommend analyzing the core dump in Momentics.Newborn
It's the new topic of blackberry devblog: devblog.blackberry.com/2012/10/…Zusman
@Hithredin: any chance to do it without Qt?Crackleware
I do not know. With native I used Gameplay and their log system, but I haven't see a way to get crash log, etc...Zusman
G
9

You can also SSH onto the device (ssh [email protected]) and run:

slog2info -w 

Which will display the slogger2 logs.

Glidebomb answered 20/11, 2012 at 17:48 Comment(2)
What needs to be done before you can log in using SSH? I had to add my public RSA key to the authorized_keys2 file using the target file system explorer in Momentics before I could log in. I don't think they meant it to be that complex, so maybe I missed something :)Gwenora
telnet seems to work as well and does not need a key but I did not find the logs useful in my caseTrophoplasm
N
6

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.

Newborn answered 29/10, 2012 at 3:27 Comment(4)
Debug versions built by Momentics will produce a core file. QNX developer support people at BlackBerry events consistently recommend analyzing the core dump in Momentics.Newborn
It's the new topic of blackberry devblog: devblog.blackberry.com/2012/10/…Zusman
@Hithredin: any chance to do it without Qt?Crackleware
I do not know. With native I used Gameplay and their log system, but I haven't see a way to get crash log, etc...Zusman
C
6

Here is what i have found moving away from Momentics IDE to command line.

When application does printf() the output goes into the file

/accounts/1000/appdata/[your application folder name]/logs/log

You can use this command

blackberry-deploy -getFile [path-to-log]

to bring that file to your PC. Also, you can use target filesystem navigator from the IDE to inspect this (or any other) file.

Crackleware answered 30/10, 2012 at 17:3 Comment(0)
A
4

This is similar to another answer but with additional details that will be useful for momentics users (BlackBerry 10 IDE)

1. Enable the terminal view in the momentics IDE

Window --> Show view --> Other --> Terminal

Select the terminal and press OK

2. Connect to the terminal

Select the Terminal tab (possibly called 'Terminal 1') in your views window. Select the connect button, it's a green N shaped button on the top right of the top right of the views window.

3. Run the log viewer command

$ slog2info -w

To read more info about this command:

$ slog2info --help 

*Note that there shouldn't be any need to provide an ssh user or keys, that is taken care of by the IDE when you use this procedure.

Log statements

You can add logging to your app with the following commands

qDebug() << "This is debug";
qWarning() << "This is a warning";
qCritical() << "This is critical " << somevariable << ", some additional text";
qFatal() << "This is fatal" << somevariable;
Aachen answered 4/7, 2014 at 4:30 Comment(2)
Dont u get the same on the console on a debug run??? My app works in debug mode but it crashes in release ....In a release mode I get nothing using the slog2infoGosnell
The IDE may have gone through changes since last year. Release is another ball game, I'll update my answer to cover that at the weekend.Aachen
W
-1

You can view all the logs from the following path

/accounts/1000/appdata/[Application Name]/logs/log
Weightless answered 16/7, 2014 at 11:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.