0

My app is running with dev_appserver but app is not building the response as I'm expecting it (I get a blank page)

See here: App Engine no output in browser

It has been suggested I debug the requests but I'm not sure how to do this.

What PHP code do I need to debug my Wordpress app and where do I place that code in my project? Where will the output log appear?

Update - Making Request log

Is it correct to:

1/ Add following code this to index.php then run dev_appserver.py

<?php

use google\appengine\api\log\LogService;

// LogService API usage sample to display application logs for last 24 hours.
$options = [
  // Fetch last 24 hours of log data
  'start_time' => (time() - (24 * 60 * 60)) * 1e6,
  // End time is Now
  'end_time' => time() * 1e6,
  // Include all Application Logs (i.e. your debugging output)
  'include_app_logs' => true,
  // Filter out log records based on severity
  'minimum_log_level' => LogService::LEVEL_INFO,
];

$logs = LogService::fetch($options);

?>

2/ and after that, add to body ...

<?php foreach ($logs as $log): ?>
  <h3>REQUEST LOG</h3>
  <ul>
    <li>IP: <?= $log->getIp() ?></li>
    <li>Status: <?= $log->getStatus() ?></li>
    <li>Method: <?= $log->getMethod() ?></li>
    <li>Resource: <?= $log->getResource() ?></li>
    <li>Date: <?= $log->getEndDateTime()->format('c') ?></li>
    <li>
<?php foreach ($log->getAppLogs() as $app_log): ?>
        <strong>APP LOG</strong>
        <ul>
          <li>Message: <?= $app_log->getMessage() ?></li>
          <li>Date: <?= $app_log->getDateTime()->format('c') ?></li>
        </ul>
<?php endforeach ?>
    </li>
  </ul>
<?php endforeach ?>

Do I place all this code in the index.php file? Does the first lot of code go in the head or the body of the document?

TimothyAURA
  • 1,329
  • 5
  • 21
  • 44
  • a) check /var/log/apache2/error.log or /var/log/apache/error.log to see what is the actual error – Satya Nov 14 '17 at 05:04
  • I dont have my Apache server running as the project is running in my Google App Engine development environment using dev_appserver.py. Would apache not running effect this? – TimothyAURA Nov 14 '17 at 05:06
  • no , it will not be affected . however check this link https://cloud.google.com/appengine/docs/standard/php/logs/ to be more familiar with GAE logs – Satya Nov 14 '17 at 05:09
  • Updated original post with code as per your advice, but not sure how to properly implement that code. – TimothyAURA Nov 14 '17 at 05:31
  • place all of this in one php file , and then call that file in your browser – Satya Nov 14 '17 at 05:40
  • OK so put it in a req-log.php file in the root and then load localhost:8080/req-log.php ? – TimothyAURA Nov 14 '17 at 05:43
  • yes , that's right – Satya Nov 14 '17 at 06:21

0 Answers0