Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see 'syslog' output at app_server running PHP

I'm testing a PHP application at my computer using the app_server launched by "Google App Engine Launcher".

But, at its logs, I am not seeing the output from the syslogs that are inserted at my PHP code.

I've tried the parameters --log_level and --dev_appserver_log_level without any success.

Do anybody knows what can be done?

My Google App Engine Launcher is version 1.8.6.

like image 246
dudinha-dedalus Avatar asked Nov 12 '22 19:11

dudinha-dedalus


1 Answers

The default configuration should have syslogging enabled so no additional parameters should be necessary when launching app_server. Could you execute a very simple test script and post the output?

<?php
print 'Using syslog() '. (syslog(LOG_DEBUG, 'Testing syslog() functionality') ? 'succeeded' : 'failed');

After executing the above script and getting a positive result message you should find at least one entry in your local syslog.

If you want to read the logs programmatically (source [1]):

you can iterate over messages added by syslog() using AppEngine's LogService API:

use google\appengine\api\log\LogService;
use google\appengine\util as util;

$start = (float) $_GET["start"];
$end = (float) $_GET["end"];

$options = [
  'start_time' => $start * 1e6,
  'end_time' => $end * 1e6,
  'include_app_logs' => true
];

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

[1] https://developers.google.com/appengine/docs/php/logs/

like image 94
SaschaM78 Avatar answered Nov 15 '22 04:11

SaschaM78