1 PACKAGE BODY POA_LOG AS
2 /* $Header: POALOGB.pls 115.6 2003/12/29 13:50:05 sriswami ship $ */
3
4
5 -- ------------------------------------------------------------------
6 -- Name: put_names
7 -- Desc: Setup which directory to put the log and what the log file
8 -- name is. The directory setup is used only if the program
9 -- is not run thru concurrent manager
10 -- -----------------------------------------------------------------
11 PROCEDURE put_names(
12 p_log_file VARCHAR2,
13 p_out_file VARCHAR2,
14 p_directory VARCHAR2) IS
15 BEGIN
16 /*
17 FND_FILE.PUT_NAMES(p_log_file,p_out_file,p_directory);
18 */
19 return;
20 END put_names;
21
22
23 -- ------------------------------------------------------------------
24 -- Name: print_duration
25 -- Desc: Given a duration in days, it return the dates in
26 -- a more readable format: x days HH:MM:SS
27 -- -----------------------------------------------------------------
28 FUNCTION duration(
29 p_duration number) return VARCHAR2 IS
30 BEGIN
31 return(to_char(floor(p_duration)) ||' Days '||
32 to_char(mod(floor(p_duration*24), 24))||':'||
33 to_char(mod(floor(p_duration*24*60), 60))||':'||
34 to_char(mod(floor(p_duration*24*60*60), 60)));
35 END duration;
36
37
38 -- ------------------------------------------------------------------
39 -- Name: debug_line
40 -- Desc: If debug flag is turned on, the log will be printed
41 -- -----------------------------------------------------------------
42 PROCEDURE debug_line(
43 p_text VARCHAR2) IS
44 BEGIN
45 IF (g_debug) THEN
46 put_line(p_text);
47 END IF;
48 END debug_line;
49
50
51 -- ------------------------------------------------------------------
52 -- Name: put_line
53 -- Desc: For now, just a wrapper on top of fnd_file
54 -- -----------------------------------------------------------------
55 PROCEDURE put_line(
56 p_text VARCHAR2) IS
57 BEGIN
58 FND_FILE.PUT_LINE(FND_FILE.LOG, p_text);
59 END put_line;
60
61 -- ------------------------------------------------------------------
62 -- Name: output_line
63 -- Desc: For now, just a wrapper on top of fnd_file
64 PROCEDURE output_line(
65 p_text VARCHAR2) IS
66 BEGIN
67 FND_FILE.PUT_LINE(FND_FILE.OUTPUT, p_text);
68 END output_line;
69
70
71
72 PROCEDURE setup(
73 filename VARCHAR2) IS
74 BEGIN
75
76 IF (fnd_profile.value('POA_DEBUG') = 'Y') THEN
77 poa_log.g_debug := TRUE;
78 END IF;
79
80 poa_log.put_names(filename ||'.log',filename||'.out',
81 '/sqlcom/log');
82 poa_log.put_line('System time at the start of the process is: ' ||
83 fnd_date.date_to_charDT(sysdate));
84 poa_log.put_line( ' ');
85
86 END setup;
87
88 PROCEDURE wrapup(
89 status VARCHAR2) IS
90
91 BEGIN
92 IF (status = 'SUCCESS') THEN
93 poa_log.put_line('Process completed at: ' ||
94 fnd_date.date_to_charDT(sysdate));
95 ELSIF (status = 'ERROR') THEN
96 poa_log.put_line('Process terminated with error at: ' ||
97 fnd_date.date_to_charDT(sysdate));
98 END IF;
99
100 poa_log.put_line(' ');
101 END wrapup;
102
103 end POA_LOG;