Added connected pgAdmin user and connection name in the log file. Fixes #5452

Patch By: Nico T
This commit is contained in:
Akshay Joshi 2020-05-13 17:43:21 +05:30
parent 0620fafb6c
commit c0451cd454
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ This release contains a number of bug fixes and new features since the release o
New features
************
| `Issue #5452 <https://redmine.postgresql.org/issues/5452>`_ - Added connected pgAdmin user and connection name in the log file.
| `Issue #5489 <https://redmine.postgresql.org/issues/5489>`_ - Show the startup log as well as the server log in the runtime's log viewer.
Housekeeping

View File

@ -918,10 +918,16 @@ WHERE
query = query.encode(encoding)
dsn = self.conn.get_dsn_parameters()
current_app.logger.log(
25,
u"Execute (async) for server #{server_id} - {conn_id} (Query-id: "
u"Execute (async) by {pga_user} on {db_user}@{db_host}/{db_name} "
u"#{server_id} - {conn_id} (Query-id: "
u"{query_id}):\n{query}".format(
pga_user=current_user.email,
db_user=dsn['user'],
db_host=dsn['host'],
db_name=dsn['dbname'],
server_id=self.manager.sid,
conn_id=self.conn_id,
query=query.decode(encoding),