Using get_current_request, it does seem to end up working, sort of.

I still get a duplicate, I imagined to somehow get it down to just 1:

[image: chrome_P3YiTNWlNu.png]

I'm not getting the root log entry to show the log level though, which 
makes filtering by error or warning certainly a nightmare. Part of that, I 
think, is that it's emitting a log entry on each call to `logging`, rather 
than pooling them and emitting at the end of the request. Clicking that 
parent log entry, there are no children entries, but after about a second, 
that one^ pops in, as if it's querying for any matching trace IDs. This 
isn't how appengine Standard appears to work. Child log entries seem to 
exist on the parent as a whole/no querying needed.

Given that I am able to "group" these, maybe this is less a Pyramid issue 
and more a google one. Looking further into get_current_request, it seems 
to do basically the same thing as django and flask so I suppose for the 
purposes of logging, it's good enough?
On Sunday, November 8, 2020 at 9:36:10 PM UTC-6 jdavi...@gmail.com wrote:

> Trying to get appengine logging working under Pyramid. 
>
> Log entries are appearing, but they aren't grouped in the same request. 
> Not only are they not grouped in the same request, but I'm getting a 
> duplicate as well.
>
> [image: chrome_hZKb2p0Zdr.png]
>
> For those that aren't familiar with googles Logging system, the top line 
> should have the blue icon indicating the request contains an INFO log, and 
> clicking on it should expand to show all of the logging calls that were 
> made during that request. For example:
>
> [image: chrome_LiowoZYVa5.png]
>
> As you can see there, that particular request contains 2 logging entries, 
> so we see them there when that line is expanded.
>
> In order for log entries to be grouped together, the api needs to know 
> what request its a part of. Both django and flask appear to have methods 
> available to determine what the current request is, and look for a 
> particular header within that request. 
>
> Here is the place where I think needs an addition for Pyramid to be 
> supported here.   
>
>
> https://github.com/googleapis/python-logging/blob/master/google/cloud/logging/handlers/_helpers.py#L49-L65
>
> I see that pyramid has "pyramid.threadlocal.get_current_request()" but the 
> documentation seems to indicate that that maybe shouldn't be used.
>
> Can anyone point me in the right direction?
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/ab9525c4-2978-4e59-83a5-55a3e46ecae6n%40googlegroups.com.

Reply via email to