Re: Writing files with stored procedures
Posted in 2000
Topics: Stored Procedures & SPL
Hi Jonathan ! Jonathan Leffler wrote: > Watch out for databases with transactions where you want the log message > to survive a rollback operation... The purpose of my logs is only to track each call to a procedure, regardless to the execution of this procedure. So I don't have to synchronize my logs with transactions. Does any of you have references of a package which will allow me to access (write) to file ? Thanks for your help! -- - ------------------------------------------------------------------ - - Arnaud ANDRIEUX arnaud.andrieux@aql.fr - - Ingenieur en developpement tel direct : 02.99.12.52.22 - - Direction Metier Industrie - - ------------------------------------------------------------------ - - Alliance Qualite Logiciel http://www.aql.fr - - GROUPE SILICOMP http://www.silicomp.fr - - - - Rue de la Chataigneraie - - B.P. 127 - - 35513 CESSON SEVIGNE - - FRANCE - - tel : (33) (0)2.99.12.50.00 - - fax : (33) (0)2.99.63.70.40 - - ------------------------------------------------------------------ -
Use the TRACE statement? E.g.: SET DEBUG FILE TO '/tmp/logfile' WITH APPEND; TRACE 'whatever ...'; * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!
Mmmh, that's for debug surposes which means you will get a detailed output from your stored procedure. I think Arnaud will write only little information for each action to his protocol. What about using the system command ? LET mybuffer = '/usr/bin/echo "...inserting key ...' || my_key || '" into my_table" >> /path/my_logfile &'; SYSTEM mybuffer; That one will asynchronely append your information without big overhead to your logfile. Bye, Chris Zandy schrieb: > Use the TRACE statement? > > E.g.: > SET DEBUG FILE TO '/tmp/logfile' WITH APPEND; > > TRACE 'whatever ...'; > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * > The fastest and easiest way to search and participate in Usenet - Free!
Mmmh, that's for debug surposes which means you will get a detailed output from your stored procedure. I think Arnaud will write only little information for each action to his protocol. What about using the system command ? LET mybuffer = '/usr/bin/echo "...inserting key ...' || my_key || '" into my_table" >> /path/my_logfile &'; SYSTEM mybuffer; That one will asynchronely append your information without big overhead to your logfile. Bye, Chris Zandy schrieb: > Use the TRACE statement? > > E.g.: > SET DEBUG FILE TO '/tmp/logfile' WITH APPEND; > > TRACE 'whatever ...'; > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * > The fastest and easiest way to search and participate in Usenet - Free!
Not if don't turn tracing on as in :
TRACE ON;
I've verified this by the way...
The only drawback is that every line gets prepended by "trace
expression :" but you SP code will look much cleaner. ;-}
E.g.:
CREATE PROCEDURE ztrace()DEFINE x CHAR(1);
SET DEBUG FILE TO "/tmp/ztrace.log" WITH APPEND;
TRACE "LINE 1";
LET x = "X";
TRACE "LINE 2";
END PROCEDURE;
Output of ztrace.log:
trace expression :LINE 1
trace expression :LINE 2
Cheers,
Lyzander Marantal
In article <3946462F.54DCAEC2@funkytown.de>, Chris Brauer
<funky@funkytown.de> wrote:
>Mmmh, that's for debug surposes which means you will get
>a detailed output from your stored procedure. I think Arnaud
>will write only little information for each action to his
protocol.
>
>What about using the system command ?
>LET mybuffer = '/usr/bin/echo "...inserting key ...' || my_key
|| '" into
>my_table" >> /path/my_logfile &';
>SYSTEM mybuffer;
>
>That one will asynchronely append your information without big
overhead to your
>logfile.
>
>Bye, Chris
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!