Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 85b247d

Browse files
committed
Fix problem with logging filtering
1 parent 516cfa3 commit 85b247d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/utils/logger.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,16 @@ elog_internal(int elevel, bool file_only, const char *message)
159159

160160
write_to_file = elevel >= logger_config.log_level_file
161161
&& logger_config.log_directory
162-
&& logger_config.log_directory[0] != '\0'
163-
&& !remote_agent;
162+
&& logger_config.log_directory[0] != '\0';
164163
write_to_error_log = elevel >= ERROR && logger_config.error_log_filename &&
165-
logger_config.log_directory && logger_config.log_directory[0] != '\0'&& !remote_agent;
166-
write_to_stderr = (elevel >= (remote_agent ? ERROR : logger_config.log_level_console) && !file_only) || remote_agent;
164+
logger_config.log_directory && logger_config.log_directory[0] != '\0';
165+
write_to_stderr = elevel >= logger_config.log_level_console && !file_only;
167166

167+
if (remote_agent)
168+
{
169+
write_to_stderr |= write_to_error_log | write_to_file;
170+
write_to_error_log = write_to_file = false;
171+
}
168172
pthread_lock(&log_file_mutex);
169173
loggin_in_progress = true;
170174

src/utils/remote.c

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ static void* error_reader_proc(void* arg)
9797
elog(ERROR, "%s", buf + 7);
9898
} if (strncmp(buf, "WARNING: ", 9) == 0) {
9999
elog(WARNING, "%s", buf + 9);
100+
} if (strncmp(buf, "VERBOSE: ", 9) == 0) {
101+
elog(VERBOSE, "%s", buf + 9);
100102
} else if (strncmp(buf, "LOG: ", 5) == 0) {
101103
elog(LOG, "%s", buf + 5);
102104
} else if (strncmp(buf, "INFO: ", 6) == 0) {

0 commit comments

Comments
 (0)