Create a log file to debug the Symbian Program

Source: Internet
Author: User

Author: Lee translated Article Source: newlc

 

Do I need to debug code or track the execution process on my mobile phone? Rfilelogger may help you. This class is very powerful and easy to use ._

First declare a file log connection and create a log file

Code:// Open the log file service connection
Rfilelogger ilog;
Ilog. Connect ();
Ilog. createlog (_ L ("myloggingdirectory"), _ L ("mylogfile"), efileloggingmodeoverwrite );

...
// Close the connection between the log file and the server
Ilog. closelog (); #, lfb9
Ilog. Close ();

The createlog function of Row 3 has three parameters: %

Log Path

Log File Name

Record mode (efileloggingmodeoverwrite | efileloggingmodeappend)

For example, the following code shows the full path of my log file (the file system on the mobile phone)

C:/logs/myloggingdirectory/mylogfile.

For me, I am used to putting opening code in the constructl () function of the class I want to trace, and then closing in the destructor. in real encoding, you 'd better check whether connect and createlog have returned kerrnone.

Once you have done this, you can input text and data to the log file. The basic commands are as follows:

Command Log File

Ilog. Write (_ L ("Hello World") fig 4:00:13 Hello World

Ilog. writeformat (_ L ("result = % d"), err) 11/07/2003 4:00:13 result = 0

Ilog. hexdump (aheader, aheader, myptr, 4) 11/07/2003 4:00:13 mybuf: 0000: 41 42 00 44 AB. d

If you do not want to record the date and time, you can use this statement to close them.

Code:Ilog. setdateandtime (tbool ausedate, tbool ausetime)

Do not forget to add flogger. lib to the MMP file and include the flogger. h header file. Now you can compile and execute your program.

No! The log file has not been created yet! Correct! This cannot be done in the code. We can only manually create a log file in the C:/logs/myloggingdirectory directory. Otherwise, no logs will be recorded. No need to recompile.

Note: If you do not know how to do this, you can use fexplorer to upload files to your mobile phone through a PC.

Http://www.symbianx.cn/viewthread.php? Tid = 27 & extra = Page % 3d1
Original address: http://newlc.com/article.php3? Id_article= 131

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.