Skip to content

Can't set Logger Level when not using contexts #252

@martindsouza

Description

@martindsouza

Change:

procedure null_global_contexts 
  is 
    pragma autonomous_transaction; 
    l_pref_value logger_prefs.pref_value%type;
  begin 
    $if $$no_op or $$rac_lt_11_2 or not $$logger_context $then 
      null; 
    $else 
     -- TODO THIS IS THE FIX
      select lp.pref_value
      into l_pref_value
      from logger_prefs lp
      where 1=1
        and lp.pref_type = 'LOGGER'
        and lp.pref_name = 'GLOBAL_CONTEXT_NAME'
      ;

      if l_pref_value != 'NONE' then
        dbms_session.clear_all_context(namespace => g_context_name); 
      end if;
    $end 
 
    commit; 
  end null_global_contexts; 

Same logic is needed in: save_global_context

procedure save_global_context(
    p_attribute in varchar2,
    p_value in varchar2,
    p_client_id in varchar2 default null)
  is
    pragma autonomous_transaction;
    l_pref_value logger_prefs.pref_value%type;
  begin
    $if $$no_op $then
      null;
    $else
      select lp.pref_value
      into l_pref_value
      from logger_prefs lp
      where 1=1
        and lp.pref_type = 'LOGGER'
        and lp.pref_name = 'GLOBAL_CONTEXT_NAME'
      ;
      
      if l_pref_value != 'NONE' then
        dbms_session.set_context(
          namespace => g_context_name,
          attribute => p_attribute,
          value => p_value,
          client_id => p_client_id);
      end if;
    $end

    commit; -- MD: moved commit to outside of the NO_OP check since commit or rollback must occur in this procedure
  exception

Should just have a function of is_context_enabled_yn or something that these procedures can use

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions