02-21-2012 04:31 AM
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
Solved! Go to Solution.
02-21-2012 05:25 AM - last edited on 02-21-2012 05:25 AM
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)
02-21-2012 08:28 AM
>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 -)
02-21-2012 08:54 AM
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.
02-21-2012 09:09 AM
>> 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)
02-21-2012 10:36 AM
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
02-21-2012 10:44 AM - last edited on 02-21-2012 10:49 AM
the same is on playbook, with respect to unix slashes ![]()
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.t
from usb/wifi: 192.168.x.x/media/FileName.txt (or 192.168.x.x/media/misc/YourAppName/FileName.tx
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 ()
02-21-2012 10:51 AM
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
02-22-2012 12:43 AM
Thanks Andrey let me try that..
02-22-2012 08:59 AM
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