0

I need to understand enable logging in Ingres stored procedure. I read a lot about "printqry", DBMS Server Query Tracing or security auditing. My requirement is does Ingres db gives option of custom logging where I can log custom messages.

db.trace("The value for x is ", x)
Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103
Sam
  • 747
  • 1
  • 8
  • 14

1 Answers1

0

You can use the MESSAGE statement to write an arbitrary message. The message can either go to the current SESSION (meaning the calling program has to run INQUIRE_SQL to get the text) or the security audit log or errlog. I suspect the later would be most useful.

It takes an optional error number and/or message text. If you want to write messages involving values other than a constant string you'll need to assign it to a variable e.g.

msg_txt = 'The value for x is "+VARCHAR(:x);
MESSAGE :msg_txt WITH DESTINATION = (ERROR_LOG);

HTH

PaulM
  • 446
  • 2
  • 12
  • Thanks for the suggestion. I have a python code calling the stored procedure. WHile i'm using the python lib ingresdb to access it the procedure is breaking as soon as any message is printed. Any solution on this ? – Sam Oct 12 '15 at 15:03
  • 1
    Not something I've tried to do in Python I'm afraid. Do you mean that you get errors as soon as the message statement is issued, or when you try to read it? Strictly speaking the message won't be "printed" but I'm not sure how ingresdbi handles this. – PaulM Oct 13 '15 at 16:10