1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-03-04 15:51:29 +02:00

Disable logging to file in agent

This commit is contained in:
Konstantin Knizhnik 2019-01-22 14:40:49 +03:00
parent 0df77d0c11
commit 03056c7238
2 changed files with 15 additions and 5 deletions

View File

@ -268,8 +268,16 @@ FILE* fio_fopen(char const* path, char const* mode, fio_location location)
FILE* f;
if (fio_is_remote(location))
{
int flags = O_RDWR|O_CREAT|PG_BINARY|(strchr(mode, '+') ? 0 : O_TRUNC);
int fd = fio_open(path, flags, location);
int flags = O_RDWR|O_CREAT;
int fd;
if (strcmp(mode, PG_BINARY_W) == 0) {
flags |= O_TRUNC|PG_BINARY;
} else if (strncmp(mode, PG_BINARY_R, strlen(PG_BINARY_R)) == 0) {
flags |= PG_BINARY;
} else if (strcmp(mode, "a") == 0) {
flags |= O_APPEND;
}
fd = fio_open(path, flags, location);
f = (FILE*)(size_t)((fd + 1) & ~FIO_PIPE_MARKER);
}
else

View File

@ -157,8 +157,10 @@ elog_internal(int elevel, bool file_only, const char *message)
time_t log_time = (time_t) time(NULL);
char strfbuf[128];
write_to_file = elevel >= logger_config.log_level_file &&
logger_config.log_directory && logger_config.log_directory[0] != '\0';
write_to_file = elevel >= logger_config.log_level_file
&& logger_config.log_directory
&& logger_config.log_directory[0] != '\0'
&& !remote_agent;
write_to_error_log = elevel >= ERROR && logger_config.error_log_filename &&
logger_config.log_directory && logger_config.log_directory[0] != '\0';
write_to_stderr = elevel >= (remote_agent ? ERROR : logger_config.log_level_console) && !file_only;