On 11 Sep. 2016 11:31, "Jim Nasby" <jim.na...@bluetreble.com> wrote:
> Actually, I wish this was a straight-up logging level feature, because I need it all the time when debugging complicated user-level code. Specifically, I wish there was a GUC that would alter (client|log)_min_messages upon entering a specific function, either for just that function or for anything that function subsequently called. We have that or close to it, but it's restricted for security. IIRC you can't SET log_min_messages as non superuser including as part of CREATE FUNCTION ... SET. Presumably because lowering it would let the user hide activity admins expect to be recorded. Raising it would let them possibly DoS via log spam - though that argument is rather undermined by the ability to write plpgsql that does RAISE in a tight loop. I'd like to be able to let users make logging more detailed but not less, so they can only SET it to something equal to or more detailed to what their session has art the start. Should actually be pretty trivial to implement too. You can then SET at session level, function level, SET LOCAL, etc. If you want to control it dynamically via GUC you add calls to your functions to check a custom user GUC and SET log level accordingly. Using whatever logic you like. > Bonus points if you could also specify a regex that the message text had to match. > An errfinish() hook would be nice for that.