Logging diagnostic information plays a key part for any application. The QuickBooks Online PHP SDKprovides two types of logging:
The SDK maintains an execution log in the executionlog.txt
file, which resides in the sdk
folder. The execution log cannot be turned off. The following is an example of the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | GetSerializer(Request): Xml GetSerializer GetSerializer(Request): Xml GetSerializer GetSerializer(Response): XML Exception appears during response processing. Http response was 200: #0 [internal function]: DataServiceQboTest->testDownloadPDF_ProcessingException() #1 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/Framework/TestCase.php(860): ReflectionMethod->invokeArgs(Object(DataServiceQboTest), Array) #2 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/Framework/TestCase.php(737): PHPUnit_Framework_TestCase->runTest() #3 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/Framework/TestResult.php(609): PHPUnit_Framework_TestCase->runBare() #4 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/Framework/TestCase.php(693): PHPUnit_Framework_TestResult->run(Object(DataServiceQboTest)) #5 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/Framework/TestSuite.php(716): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult)) #6 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(398): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult)) #7 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/TextUI/Command.php(152): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #8 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/src/TextUI/Command.php(104): PHPUnit_TextUI_Command->run(Array, true) #9 /var/www/html/V3-PHP-SDK-develop/vendor/phpunit/phpunit/phpunit(36): PHPUnit_TextUI_Command::main() #10 {main} GetSerializer GetSerializer(Response): JSON GetSerializer GetSerializer(Request): JSON GetSerializer |
The SDK by default logs requests and responses to XML files. The logs help with application debugging and can be saved on a local file system. The SDK allows you to modify the log settings without having to redeploy the application by changing the location of the request/response logs, and by
disabling and re-enabling logging. You can modify the settings either by setting the parameters in the sdk.config
file, or by setting values in the $dataService
object.
For more information on the config file, see Configuration.
If logging is enabled, all requests and responses are logged to the default directory tmp/IdsLogs
. To change the log location, you can either set the location in the config file or use the logging methods in the $dataService
object.
Note
Note
The logging function works only if the specified directory exists and is accessible. If the path does not exist, the request/response log will not be recorded. Be aware that the requests/responses may contain sensitive company data.
To change the log location, set the requestResponseLoggingDirectory
parameter in the <logger>
section of the sdk.config
file to true for false:
1 2 3 4 5 6 7 8 | <intuit> <ipp> <logger> <!-- To enable/diSable Request and Response log--> <requestLog enableRequestResponseLogging="true" requestResponseLoggingDirectory="C:\IdsLogs" /> </logger> </ipp> </intuit> |
To disable the log, use the setLogLocation()
method of the $dataService
object:
1 2 3 | <?php $dataService->setLogLocation("/Your/Path/ForLog"); ?> |
To enable or disable request and response logging, you can either set the location in the config file or use the logging methods in the $dataService
object.
To enable or disable logging, set the enableRequestResponseLogging
paramenter in the <logger>
section of the sdk.config file to true for false:
1 2 3 4 5 6 7 8 | <intuit> <ipp> <logger> <!-- To enable/diSable Request and Response log--> <requestLog enableRequestResponseLogging="true" requestResponseLoggingDirectory="C:\IdsLogs" /> </logger> </ipp> </intuit> |
To disable logging, use the disableLog()
method of the $dataService
object:
1 2 3 | <?php $dataService->disableLog(); ?> |
Use setLogLocation()
to re-enable logging.
1 2 3 | <?php $dataService->setLogLocation("/Your/Path/ForLog"); ?> |