I want to do postgresql database logging in my application via JDBC driver
I found out that there is an SQL query, thanks to which you can get the path to the log file, so as not to specify it in the application, and he himself automatically got his path "SHOW data_directory", is this how it works?
To generate the config, you need to reboot the database, is it possible to implement a database reboot using a query, or what other options besides manual reboot?
The SHOW data_directory
command will return the path to the data directory where the log files are stored. That is correct, in my case it returns C:/Program Files/PostgreSQL/16/data
, another way is to use the
SELECT current_setting('data_directory') || '/' || current_setting('log_directory') AS log_directory;
that will give you the absolute path to the log file.
As for your second question, I think what you are looking for is the pg_reload_conf() function that will apply the changes to postgres's configuration.