Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
madhanbalus
Posts: 18
Registered: ‎02-10-2012
My Device: playbook
Accepted Solution

File based Logging in playbook

Hell all,

 

    Can anyone tell me abt file based logging in playbook? I developed apps in Qt creator(windows) and able to successfully deploy it in the plabook using qt(linux) with some modifications in the .pro and xml file. Now i need to debug the code by printing the values in a file. How should i actually do that?

 

 

 

Thanks,

Madhan

Please use plain text.
Contributor
azazello
Posts: 40
Registered: ‎01-15-2012
My Device: Playbook Tablet

Re: File based Logging in playbook

[ Edited ]

QFile works well (don't forget to use flush - in case of saving debug info it can be important). to make it accessible via USB connection/WiFi file sharing - use /accounts/1000/shared/yourFile and add <action>access_shared</action> to permissions request

PS: also, while debugging from IDE Momentix - standard QDebug can be used (it's display output to IDE console)

/rgds
Andrey Yaromenok aka azazello
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: File based Logging in playbook

>PS: also, while debugging from IDE Momentix - standard QDebug can be used (it's display output to IDE console)

... and puts all output in log file -)

Please use plain text.
Contributor
madhanbalus
Posts: 18
Registered: ‎02-10-2012
My Device: playbook

Re: File based Logging in playbook

Thanks fr ur quick rply,

 

    pls tell me a bit more clear on this "use /accounts/1000/shared/yourFile and add <action>access_shared</action> to permissions request" like ouput file path to give for QFile and whether am able to open the file in playbook itself or shud i need to connect  to pc to do that...

 

 

 

Thanks in advance. 

 

Please use plain text.
Contributor
azazello
Posts: 40
Registered: ‎01-15-2012
My Device: Playbook Tablet

Re: File based Logging in playbook

>> like ouput file path to give for QFile

yes, thats correct.     <action>access_shared</action> is a string in bar-description.xml (it's give a permission for apllication to access not only local folder, but shared folder too - to access from other applications)

from PC - you can connect  via USB+BB Desktop (on Windows/Mac), or via WiFi (on Linux/Win/Max) - it use Samba protocol(smb) (plz, check Settings> Storage & Sharing on playbook to allow file shiaring).

from Playbook you can open it in WebBrowser (like file:///acoounts/1000/shared/FileName.txt - for some reason it's no default application to open simple ASCII text file from file browser)

/rgds
Andrey Yaromenok aka azazello
Please use plain text.
Contributor
madhanbalus
Posts: 18
Registered: ‎02-10-2012
My Device: playbook

Re: File based Logging in playbook

Many Thanks.

 

 Sorry to bug you again... so we(Qt symbian developers)  used to give the file path like this... QFile file("c:\\data\\file.txt");
In the device we can actually locate the file in the same path. Is there something similar to this for playbook or any default path it takes eventually when we name a file?

 

 

 thanks again

Please use plain text.
Contributor
azazello
Posts: 40
Registered: ‎01-15-2012
My Device: Playbook Tablet

Re: File based Logging in playbook

[ Edited ]

the same is on playbook, with respect to unix slashes :smileywink:

 

from Qt(and in webBrowser) it will look like "/accounts/1000/shared/FileName.txt" (better to store it to directory, so "/accounts/1000/shared/misc/YourAppName/FileName.txt" )

from usb/wifi: 192.168.x.x/media/FileName.txt (or 192.168.x.x/media/misc/YourAppName/FileName.txt )

 on windows(in windows explorer) you need to add backslash (\\192.168.x.x), while on linux smb://192.168.x.x (probably, same on mac)

 

udp: difference in file path is "shared"  on device and "media" while access from PC ()

/rgds
Andrey Yaromenok aka azazello
Please use plain text.
Retired
davidcummings
Posts: 20
Registered: ‎10-27-2010
My Device: Bold 9800

Re: File based Logging in playbook

You shouldn't be using the shared data directory for logging. There is a specific directory in your application sandbox for logging.

 

It can be accessed via the path ./logs

 

So something like:

QFile file(".logs/mylog.txt")

 

Also if you do access shared, please do not access it through its full file path. That path is not guaranteed to exist. A symlink is available in your application's sandbox. E.g. ./shared

Please use plain text.
Contributor
madhanbalus
Posts: 18
Registered: ‎02-10-2012
My Device: playbook

Re: File based Logging in playbook

Thanks Andrey let me try that..

Please use plain text.
Contributor
madhanbalus
Posts: 18
Registered: ‎02-10-2012
My Device: playbook

Re: File based Logging in playbook

Hi Andrey and david,

 

      I tried both of ur suggetstions.. i gave QFile file(".logs/mylog.txt") but i didn't found any directory or a file like that in the playbook. when i tried QFile file("/accounts/1000/shared/My_app/out.log"), i didn't get any o/p file.


pls help me out

 

Thanks,

madhan

Please use plain text.