cancel
Showing results for 
Search instead for 
Did you mean: 

Logging Error

Adventurer

Logging Error

Hi All,

We are using postgresql community 9.6.8 version and we noticed that the SQL statements are getting logged in pg_log files even though log_statement is "none" (Even a simple "select 2+2" is getting logged). As per my understanding, when log_statement = none; no sql statement should to logged right?

Following are other paramteres related to error and reporting log as per the confirguration file.

log_min_messages = notice

log_min_duration_statement = 0

log_error_verbosity = default

client_min_messages = notice 

log_statement = none

Could any one suggest what could be the root cause for this behaviour.

Thanks !

2 REPLIES 2
EDB Team Member

Re: Logging Error

Set log_min_duration_statement to a value greater than 0, so only statement that take longer than that get logged.

 

You can read more about log_min_duration_statement setting here:

https://www.postgresql.org/docs/9.6/runtime-config-logging.html

 

log_min_duration_statement (integer)

Causes the duration of each completed statement to be logged if the statement ran for at least the specified number of milliseconds. Setting this to zero prints all statement durations. Minus-one (the default) disables logging statement durations. For example, if you set it to 250ms then all SQL statements that run 250ms or longer will be logged. Enabling this parameter can be helpful in tracking down unoptimized queries in your applications. Only superusers can change this setting.

 

EDB Team Member

Re: Logging Error

Set log_min_duration_statement to a value greater than 0, so only statement that take longer than that get logged.

 

You can read more about log_min_duration_statement setting here:

https://www.postgresql.org/docs/9.6/runtime-config-logging.html

 

log_min_duration_statement (integer)

Causes the duration of each completed statement to be logged if the statement ran for at least the specified number of milliseconds. Setting this to zero prints all statement durations. Minus-one (the default) disables logging statement durations. For example, if you set it to 250ms then all SQL statements that run 250ms or longer will be logged. Enabling this parameter can be helpful in tracking down unoptimized queries in your applications. Only superusers can change this setting.