Re: psql -L log errors

Поиск
Список
Период
Сортировка
От Hans Ginzel
Тема Re: psql -L log errors
Дата
Msg-id 20150311140112.GA96187@artax.karlin.mff.cuni.cz
обсуждение исходный текст
Ответ на Re: psql -L log errors  (Felipe Santos <felipepts@gmail.com>)
Ответы Re: psql -L log errors  (Felipe Santos <felipepts@gmail.com>)
Список pgsql-novice
On Wed, Mar 11, 2015 at 08:47:13AM -0300, Felipe Santos wrote:
>   When you are using the "--log-file" clause, you are telling the psql to
>   redirect the normal output to the file indicated, but the error output
>   keeps being sent to the standard output device.
>   To redirect the error output you have to append it to the file you're
>   logging into.
>   To do that, do the following (both Win and Linux, replace the psql
>   arguments ofr yours) :
>   psql -U sample_user -W -c "select * from foo;" sample_database
>   --log-file=sample_file.txt 2>> sample_file.txt

Thank you for your answer, Felipe.
Why the error output keeps being sent to the standard output device?
Does it get sense to redirect only stdout to file when "--log-file" is used?
Why not to also redirect stderr? Could the dup2() fuction be used for that?
Or even better could the stderr be "teed" both to the log file and to the standard output device?

Thanks
Hans


http://stackoverflow.com/questions/14543443/in-c-how-do-you-redirect-stdin-stdout-stderr-to-files-when-making-an-execvp-or
https://github.com/goj/coreutils/blob/rm-d/src/tee.c



В списке pgsql-novice по дате отправления:

Предыдущее
От: Felipe Santos
Дата:
Сообщение: Re: psql -L log errors
Следующее
От: Felipe Santos
Дата:
Сообщение: Re: psql -L log errors