Thread: File name as application name in regression tests and elsewhere

File name as application name in regression tests and elsewhere

From
Andrew Dunstan
Date:
I was doing some work over the weekend and it occurred to me that it
would be quite nice to have the input file name from regression tests
set as the application name, and then use a log_line_prefix setting
including %a, so that this would appear on the logs.


My first thought was to alter all the tests with something like "SET
application_name 'testname.sql';", but then I thought maybe a better way
would be to provide psql with a switch (--file-application-name ?) that
would do this for us, and use it in the regression suite. That should be
a pretty small patch and could be more generally useful.


Thoughts?


cheers


andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: File name as application name in regression tests and elsewhere

From
Aleksander Alekseev
Date:
Hello Andrew,

> I was doing some work over the weekend and it occurred to me that it
> would be quite nice to have the input file name from regression tests
> set as the application name, and then use a log_line_prefix setting
> including %a, so that this would appear on the logs.
>
> My first thought was to alter all the tests with something like "SET
> application_name 'testname.sql';", but then I thought maybe a better way
> would be to provide psql with a switch (--file-application-name ?) that
> would do this for us, and use it in the regression suite. That should be
> a pretty small patch and could be more generally useful.
>
> Thoughts?

Personally, I see how it could be useful and don't see any drawbacks of
such a patch. I think it's a good idea.

--
Best regards,
Aleksander Alekseev

Attachment

Re: File name as application name in regression tests and elsewhere

From
Peter Eisentraut
Date:
On 12/18/17 06:59, Andrew Dunstan wrote:
> I was doing some work over the weekend and it occurred to me that it
> would be quite nice to have the input file name from regression tests
> set as the application name, and then use a log_line_prefix setting
> including %a, so that this would appear on the logs.

It does do that already, as of commit
a4327296df7366ecc657b706a9b5e87aa921311a.  Is it not working for you?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: File name as application name in regression tests and elsewhere

From
Andrew Dunstan
Date:

On 12/18/2017 03:00 PM, Peter Eisentraut wrote:
> On 12/18/17 06:59, Andrew Dunstan wrote:
>> I was doing some work over the weekend and it occurred to me that it
>> would be quite nice to have the input file name from regression tests
>> set as the application name, and then use a log_line_prefix setting
>> including %a, so that this would appear on the logs.
> It does do that already, as of commit
> a4327296df7366ecc657b706a9b5e87aa921311a.  Is it not working for you?
>


Hah! Totally missed that! It's not working for me because the buildfarm
is carefully overriding the log_line_prefix without including %a - it's
been like that for ages. I will change the default and go around and
change all my machine settings.

cheers

andrew

-- 

Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services