Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am currently a user of a Postgres database (I am not the DBA). Within my sandbox I run several business critical scripts every day and currently track their status by first in a log text file on my desktop while running the scripts in a batch file. I am trying to create a table in my sandbox that can be used for reporting and analysis that includes the status of the scripts as well as if any of them have failed to run properly or not. Such as:

----------------------------------------+-----------
 Beginning Script-A                     | Timestamp
 Script-A Completed Successfully        | Timestamp
 Beginning Script-B                     | Timestamp
 Script-B failed to Run Successfully    | Timestamp
----------------------------------------+-----------

How could I do this?

share|improve this question
1  
You might get better responses on Stack Overflow as this is a general database issue. Roughly speaking you'd create a new table with a text column for the log message and a timestamp column with the default value now(), then do insert statements like INSERT INTO my_table(log_column) VALUES('Starting Script A') for logging. –  Jason Scheirer 2 days ago
    
I just did this myself--basically what Jason says but if its all within a transaction (as my mine are), you'll need to use clock_timestamp() because now() is the start time of the transaction. –  Jay Cummins yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.