[Home] [Help]
PACKAGE BODY: APPS.FND_DEBUG_REP_UTIL
Source
1 package body FND_DEBUG_REP_UTIL as
2 /* $Header: AFCPRTUB.pls 120.3 2006/08/16 13:43:41 ckclark ship $ */
3
4 --
5 -- PUBLIC VARIABLES
6 --
7
8 -- Exceptions
9
10 -- Exception Pragmas
11
12 --
13 -- PRIVATE ROUTINES
14 --
15 --
16
17 --
18 -- PUBLIC FUNCTIONS
19 --
20 --
21 -- Name
22 -- get_trace_file_name
23 -- Purpose
24 -- get the trace file name
25 -- generate trace file name for use in os level.
26 --
27 -- return string which will contain the trace file name
28 --
29 function get_trace_file_name return varchar2 is
30 trc_file varchar2(500);
31 trc_file_node varchar2(100);
32 trc_file_name varchar2(30);
33 trc_file_dir varchar2(250);
34 path_sep varchar2(1);
35 begin
36
37 trc_file := '';
38
39 select 'dbg' || fnd_debug_rule_executions_s.nextval || '.log'
40 into trc_file_name
41 from dual;
42
43 trc_file_node := fnd_debug_rep_util.get_trace_file_node;
44
45 trc_file_dir := fnd_context_util.get_tag_value(trc_file_node, 'APPLTMP');
46 path_sep := fnd_context_util.get_tag_value(trc_file_node, 'pathsep');
47
48 if ( path_sep is null ) then
49 path_sep := '/';
50 end if;
51
52 if (trc_file_dir is null ) then
53 trc_file := '$APPLTMP' || path_sep || trc_file_name;
54 else
55 trc_file := trc_file_dir || path_sep || trc_file_name;
56 end if;
57
58 return trc_file;
59
60 exception
61 when others then
62 fnd_message.set_name ('FND', 'SQL-Generic error');
63 fnd_message.set_token ('ERRNO', sqlcode, FALSE);
64 fnd_message.set_token ('REASON', sqlerrm, FALSE);
65 fnd_message.set_token ('ROUTINE',
66 'FND_DEBUG_REP_UTIL.GET_TRACE_FILE_NAME',
67 FALSE);
68 if (FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
69 fnd_log.message(FND_LOG.LEVEL_EXCEPTION,
70 'fnd.plsql.FND_DEBUG_REP_UTIL.GET_TRACE_FILE_NAME.others',
71 FALSE);
72 end if;
73 return trc_file;
74
75 end;
76
77 --
78 -- Name
79 -- get_trace_file_node
80 -- Purpose
81 -- get the node m/c name on which trace file will be generated
82 -- for the current session
83 --
84 -- return string which will contain the node name
85 --
86 function get_trace_file_node return varchar2 is
87
88 node_name varchar2(64);
89
90 begin
91
92 select rtrim(substr(machine, instr(machine,'\')+1),
93 FND_GLOBAL.local_chr(0))
94 into node_name
95 from gv$session
96 where audsid = userenv('SESSIONID');
97
98 return node_name;
99
100 exception
101 when others then
102 fnd_message.set_name ('FND', 'SQL-Generic error');
103 fnd_message.set_token ('ERRNO', sqlcode, FALSE);
104 fnd_message.set_token ('REASON', sqlerrm, FALSE);
105 fnd_message.set_token ('ROUTINE',
106 'FND_DEBUG_REP_UTIL.GET_TRACE_FILE_NODE',
107 FALSE);
108 if (FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
109 fnd_log.message(FND_LOG.LEVEL_EXCEPTION,
110 'fnd.plsql.FND_DEBUG_REP_UTIL.GET_TRACE_FILE_NODE.others',
111 FALSE);
112 end if;
113 return null;
114 end;
115
116 --
117 -- Name
118 -- get_program_comp
119 -- Description
120 -- returns Concurrent Program component name for a given Execution Method
121 -- code.
122
123 function get_program_comp(emethod varchar2) return varchar2 is
124 dbg_comp varchar2(30) := 'NOT_SUPPORTED';
125 begin
126
127 select DECODE(emethod, 'P', 'REPORTS',
128 'I', 'PLSQL_CP',
129 'J', 'JAVA_STORED_CP',
130 'K', 'JAVA_CP',
131 'Q', 'SQLPLUS_CP',
132 'E', 'PERL_CP',
133 'S', 'SUBROUTINE_CP',
134 'A', 'SPAWNED_CP',
135 'H', 'HOST_CP',
136 'L', 'LOADER_CP',
137 'NOT_SUPPORTED')
138 into dbg_comp
139 from dual;
140
141 return dbg_comp;
142
143 exception
144 when others then
145 fnd_message.set_name ('FND', 'SQL-Generic error');
146 fnd_message.set_token ('ERRNO', sqlcode, FALSE);
147 fnd_message.set_token ('REASON', sqlerrm, FALSE);
148 fnd_message.set_token ('ROUTINE',
149 'FND_DEBUG_REP_UTIL.GET_PROGRAM_COMP',
150 FALSE);
151 if (FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
152 fnd_log.message(FND_LOG.LEVEL_EXCEPTION,
153 'fnd.plsql.FND_DEBUG_REP_UTIL.PROGRAM_COMP.others',
154 FALSE);
155 end if;
156 return 'NOT_SUPPORTED';
157 end;
158
159 end FND_DEBUG_REP_UTIL;