Re: Fwd: Psql.exe error logging

From: Aman Rathi <aman(dot)rathi0904(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL www <pgsql-www(at)postgresql(dot)org>
Subject: Re: Fwd: Psql.exe error logging
Date: 2016-02-29 07:11:34
Message-ID: CAOrOm8UxXEQo6YS1q7+-EEVzU9eteTocuf=SR26_Q5Q3YD-vfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

Hi David,

1) I thought that --set command is meant at DB level for all the commands
being run. So ran it first. Not sure how to use it within the command.

2) -c option: I was doing something but forgot to remove it and didn't
notice that it is still there. Now, if I run it with -c option, then also I
am facing the same issue.

3) I realize that the psql.log is different from java log. Reason for
creating this log is to read the error message from the file since command
exists successfully and not with some errors. %errorlevel% is 0 even if the
command fails, therefore my java does not stop. So i use this log file to
read if there is any error record else continue.

Now, I am facing one more issue: The creation of the log file command
sometimes creates a log file and sometimes doesn't ( through java). Wanted
to check if there is something I should keep in mind for this.? Command I
am running is:
"<path_to_exe>psql.exe" -U <value>-w -h <value>-d <value> -a -f "<path to
.sql file>copy_s_m_asset_391.sql" 2> ",log_file_path>psql.log"

Thanks a lot for you help on this. Really appreciate it.

Aman

On Fri, Feb 26, 2016 at 9:29 PM, Melvin Davidson <melvin6925(at)gmail(dot)com>
wrote:

>
>
> On Fri, Feb 26, 2016 at 10:21 AM, David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>> On Fri, Feb 26, 2016 at 7:36 AM, David G. Johnston <
>> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>>
>>> On Fri, Feb 26, 2016 at 4:29 AM, Aman Rathi <aman(dot)rathi0904(at)gmail(dot)com>
>>> wrote:
>>>
>>>> Hi David,
>>>>
>>>> Thanks for the reply, but it still doesn't seem to run.
>>>>
>>>> I followed the following steps:
>>>> 1) updated the on_error_stop value to 1
>>>>
>>>> [image: Inline image 1]
>>>>
>>>
>>>> 2) Ran a command that should fail and exit
>>>>
>>>> [image: Inline image 1]
>>>>
>>>>
>>> ​Any particular reason you didn't just add the --set option from #1 to
>>> the psql command in #2?
>>>
>>>
>>>
>> ​As an aside, the portion of the command "psql -c -a -f <file>" is wrong
>> (though apparently not broken...). You specify, via "c", that you are
>> going to provide a single command for psql to execute but then fail to
>> provide any such command and instead change you mind and tell it your are
>> going to provide a script file, via "f", instead.
>>
>> David J.​
>>
>
> >3) Checked my java log and it shows it ran without errors and continued
> with the program.
>
> Do you realize that all psql errors will go to the postgresql log file,
> not java log?
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>

In response to

Responses

Browse pgsql-www by date

  From Date Subject
Next Message David G. Johnston 2016-02-29 07:24:07 Re: Fwd: Psql.exe error logging
Previous Message Melvin Davidson 2016-02-26 15:59:53 Re: Fwd: Psql.exe error logging