I fixed the project id issue for PsrBatchLogger, but it always create 499 
error when make api call.

On Wednesday, May 31, 2017 at 4:55:09 PM UTC-7, Yao Li wrote:
>
> I tried Monolog and it is super fast (stdout in example), but it has 
> logging line by line and no severity, time and status code info like 
> original gcloud logging under one request, is there any way to achieve that 
> with Monolog?
>
> On Tuesday, May 30, 2017 at 11:24:01 PM UTC-7, Takashi Matsuo (Google) 
> wrote:
>>
>> Hi Yao,
>>
>> On Tue, May 30, 2017 at 9:39 PM Yao Li <y...@sazze.com> wrote:
>>
>>> > I think you can just use other PSR compliant logger, rather than using 
>>> the PsrBatchLogger on your local machine.
>>>
>>> Could you give me some examples for other PSR compliant logger?
>>>
>>
>> Monolog?
>>
>> ```
>> composer require monolog/monolog
>> ```
>>
>> ```
>> <?php
>>
>> require_once __DIR__ . '/vendor/autoload.php';
>>
>> use Monolog\Logger;
>> use Monolog\Handler\StreamHandler;
>> use Monolog\Formatter\LineFormatter;
>>
>> $handler = new StreamHandler('php://stdout');
>> $handler->setFormatter(new LineFormatter(null, null, false, true));
>>
>> $logger = new Logger('LocalLogger', [$handler]);
>>
>> $logger->info('test');
>> ```
>>
>>
>>  
>>
>>>
>>> > Is this happening on App Engine Flex production server, or locally? 
>>> ....
>>>
>>> It's on App Engine Flex production server. (I used my project id instead 
>>> of 'app', but it still complains, what's appropriate way to set the name? 
>>> just 'app' or 'projects/project-id/log/ID' as suggested?
>>>
>>
>> No you should be able to just set 'app', and it should just work. I can 
>> not reproduce your issue. Is it possible to somehow share your project so 
>> that i can repro?
>>  
>>
>>>
>>> my code:
>>>
>>> $batchLogger = new PsrBatchLogger('app'); // logName `app`, tried both 
>>> 'app' and 'my-project-id'
>>>
>>>  
>>>
>>> $batchLogger->log(LogLevel::DEBUG, 'This is a debug log');
>>>
>>> $batchLogger->debug('This is a debug log'); // The same thing
>>>
>>>
>>> > The new logging library will automatically add some useful metadata 
>>> (monitored resources, trace id, severity). They look very nice to me on the 
>>> logging UI, but what do you mean exactly by making the format pretty?
>>>
>>> I mean there are a lot of logging separated in multiple lines (as 
>>> following example) rather than list under a request like your screenshot.
>>>
>>
>> I think your app is still emitting the logs to stderr, and you are seeing 
>> the logs on stderr which is not very well formatted.
>>
>> Once the new logger starts working, your logs will be available in the 
>> `app` logs. Note that you need to explicitly choose `app` in the log 
>> dropdown.
>>
>> -- Takashi
>>   
>>
>>>
>>> -  2017/05/31 04:19:51 [error] 51#0: *1586 FastCGI sent in stderr: "PHP 
>>> message: [INFO] Array
>>>  
>>> -  (
>>>  
>>> -      [deviceId] => 0...C
>>>  
>>> -      [key] => 6....4
>>>  
>>> -      [userId] => 1602
>>>  
>>> -  )
>>>    
>>>  
>>>
>>>
>>> On Thursday, May 25, 2017 at 3:36:25 PM UTC-7, Yao Li wrote:
>>>>
>>>> I have an app is built on GAE Flex Custom env (GCloud PHP Ngnix docker 
>>>> image based), I want to improve the application logging format.
>>>>
>>>>
>>>> How can I make the application log format better (more readable, with 
>>>> timestamp, POST/GET method name, status code (200), size (22 B), time 
>>>> (4ms), browser(chrome) in one line, put stack trace together instead of 
>>>> multiple lines now) like GAE logging format?
>>>>
>>>>
>>>> All of the following logs are from Google Cloud Platform Console, Logging 
>>>> page/tab.
>>>>
>>>>
>>>>
>>>> (GAE default logging:)
>>>>
>>>>
>>>> 15:21:23.667POST20022 B4 msChrome 56/User/isHuman
>>>>
>>>>
>>>>  (my application log, I want to collect following lines into one part like 
>>>> above default one rather than multi lines:)
>>>>
>>>>
>>>> 15:21:27.0002017/05/25 22:21:27 [error] 23#23: *34128 FastCGI sent in 
>>>> stderr: "PHP message: [WARN] jsVersion does not match:3617 3623
>>>>
>>>> 15:21:27.000 Stack Trace:
>>>>
>>>> 15:21:27.000Array
>>>>
>>>> 15:21:27.000(
>>>>
>>>> 15:21:27.000[0] => Array
>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Google App Engine" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to google-appengi...@googlegroups.com.
>>> To post to this group, send email to google-a...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/google-appengine.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/google-appengine/366a25f6-6fd1-47ae-b4fb-bb6f5cbe7982%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/google-appengine/366a25f6-6fd1-47ae-b4fb-bb6f5cbe7982%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> -- Takashi
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e00aad6a-b781-448c-8f7f-191737355b97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to