Bonjour,
Je suis actuellement en train de mettre en place une gestion de trace au sein de package PL/SQL.
J'ai déjà mis une procédure me permettant de logger dans un fichier externe des traces formattées pour aider à la qualification de problèmes client.
Bon maintenant la seconde étape pour pouvoir des qualifications complètes serait de pouvoir tracer le contenu de requêtes SQL dans un fichier.
En gros je voudrais un equivalent la procédure suivante mais pour une requête SQL comme un SELECT :
D'avance merci pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 procedure writeLog ( message in string) is file UTL_FILE.FILE_TYPE; begin /*To write Logs in a file*/ /*But you have to complete following command to have something: CREATE DIRECTORY SCLOG AS 'D:\tmpOra\'; GRANT READ,WRITE ON DIRECTORY SCLOG TO USER; */ begin IF not UTL_FILE.IS_OPEN(file) THEN file:= UTL_FILE.FOPEN('SCLOG','fichier.log','a'); end if; IF UTL_FILE.IS_OPEN(file) THEN UTL_FILE.PUT(file,TO_CHAR(SYSDATE, '[DD/MM/YYYY HH24:MI:SS]')||' DEBUG'||': '); UTL_FILE.PUT_LINE(file,message); UTL_FILE.FFLUSH(file); utl_file.fclose(file); end if; exception when others then IF UTL_FILE.IS_OPEN(file) THEN UTL_FILE.PUT(file,TO_CHAR(SYSDATE, '[DD/MM/YYYY HH24:MI:SS]')||' ERROR'||': '); UTL_FILE.PUT_LINE(file,'ERROR ==> Problem to write into log file '|| dbms_utility.format_error_stack); UTL_FILE.FFLUSH(file); utl_file.fclose(file); end if; end; end;
Cdt,
Razmoket
Partager