Search code examples
iossipvoippjsippjsua2

How to create Log files separately for PJSUA app running?


I have an iOS Voip app that uses pjsua. And I have to write all logs coming from pjsua to the file, but I don't know how and where to start. Can anyone help me?


Solution

  • To write logs from pjsua to file we have to define optional property log_filename of app_config structure for app_init function:

         /* logFileName is a constant of pj_str_t type.*/
         pj_str_t logFileName = pj_str("/Users/user/Documents/logfile.log")
         /* Public API */ 
         pj_status_t app_init(int argc, char *argv[]) {
            //Optional log filename if app wishes the library to write to log file.
                        app_config.log_cfg.log_filename = logFileName;
         }