Best way to log errors
I have a code section which calls ExecWait and executes a batch file which runs a couple of postgresql commands to create and populate a database. I can turn off echo and pause the DOS cmd to view any errors that may occur but what I really need is a way to log the actual errors that are displayed in the DOS box. Here is my current code block. I have error handling on the ExecWait but it just tells me if the ExecWait failed overall, it doesn't have the granularity I need in case a non-tech customer runs into a problem. I need a log file of actual postgresql errors. Any help is greatly appreciated.
thanks
Nick
here is the current code block:
FileOpen $1 "createopenfiredb.bat" "w"
FileWrite $1 "@ECHO OFF$\r$\n"
FileWrite $1 "set PGPASSWORD=$password$\r$\n"
FileWrite $1 '"$PROGRAMFILES\PostgreSQL\8.4\bin\createdb.exe" -U postgres -h localhost --encoding=UNICODE openfire 2> "createopenfiredb_error.txt"$\r$\n'
FileWrite $1 '"$PROGRAMFILES\PostgreSQL\8.4\bin\psql.exe" -U postgres -h localhost -d openfire -f "openfire_postgresql.sql"$\r$\n'
FileWrite $1 '"$PROGRAMFILES\PostgreSQL\8.4\bin\psql.exe" -U postgres -h localhost -d openfire -f "openfire_update2.sql"$\r$\n'
#FileWrite $1 "PAUSE$\r$\n"
FileWrite $1 "exit %ERRORLEVEL%$\r$\n"
FileClose $1
DetailPrint "Creating openfire database."
ExecWait "createopenfiredb.bat" ; don't forget the .bat extension...
IfErrors +1 +3
Push "Creation of openfire database failed, please contact face2name with this error."
Call ErrorHandler
DetailPrint "Openfire database created."