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?
You can also SSH onto the device (ssh [email protected]) and run:
slog2info -w
Which will display the slogger2 logs.
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.
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.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With