Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 892
Sergey K. Avatar asked Oct 28 '12 19:10

Sergey K.


4 Answers

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

slog2info -w 

Which will display the slogger2 logs.

like image 77
donturner Avatar answered Nov 09 '22 15:11

donturner


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.

like image 26
Richard Avatar answered Nov 09 '22 15:11

Richard


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.

like image 6
Sergey K. Avatar answered Nov 09 '22 16:11

Sergey K.


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;
like image 4
Ray Vahey Avatar answered Nov 09 '22 14:11

Ray Vahey