diff --git a/.gitignore b/.gitignore index cac9c8e..376e13e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ releases/* !releases/*.zip #For developers temp/* +.fetch-client/ +.DS_Store \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index 9912f51..ff23b33 100755 --- a/build/build.sh +++ b/build/build.sh @@ -35,7 +35,8 @@ echo "Building release $VERSION_NUMBER" #Generate no_op code START_DIR="$PWD" cd ../source/packages -sqlplus $SQL_CONNECTION @../gen_no_op.sql +# sqlplus $SQL_CONNECTION @../gen_no_op.sql +sql -name $SQL_CONNECTION @../gen_no_op.sql cd $START_DIR @@ -181,7 +182,26 @@ chmod 777 $RELEASE_FOLDER/*.* #Replace any references for the version number sed -i.del "s/x\.x\.x/$VERSION_NUMBER/g" $RELEASE_FOLDER/logger_install.sql -sed -i.del "s/x\.x\.x/$VERSION_NUMBER/g" $RELEASE_FOLDER/logger.pks + +# Orginial: +# sed -i.del "s/x\.x\.x/$VERSION_NUMBER/g" $RELEASE_FOLDER/logger.pks +# #129: Change the version number to the individual components +echo $VERSION_NUMBER | while IFS=. read major minor patch beta +do + #Replace major version + sed -i.del "s/-91/$major/g" $RELEASE_FOLDER/logger.pks + sed -i.del "s/-91/$major/g" $RELEASE_FOLDER/logger_install.sql + #Replace minor version + sed -i.del "s/-92/$minor/g" $RELEASE_FOLDER/logger.pks + sed -i.del "s/-92/$minor/g" $RELEASE_FOLDER/logger_install.sql + #Replace patch version + sed -i.del "s/-93/$patch/g" $RELEASE_FOLDER/logger.pks + sed -i.del "s/-93/$patch/g" $RELEASE_FOLDER/logger_install.sql + #Replace #beta# version + sed -i.del "s/#beta#/$beta/g" $RELEASE_FOLDER/logger.pks + sed -i.del "s/#beta#/$beta/g" $RELEASE_FOLDER/logger_install.sql +done + #need to remove the backup file required for sed call rm -rf $RELEASE_FOLDER/*.del diff --git a/releases/logger_3.1.1.zip b/releases/logger_3.1.1.zip new file mode 100644 index 0000000..baedd88 Binary files /dev/null and b/releases/logger_3.1.1.zip differ diff --git a/source/packages/logger.pkb b/source/packages/logger.pkb index 8826ab6..6e6a29b 100644 --- a/source/packages/logger.pkb +++ b/source/packages/logger.pkb @@ -2952,5 +2952,93 @@ as end if; end get_plugin_rec; + --== + --== + procedure log_collection (p_collection_name in varchar2 + ,p_scope in varchar2 default null + ) + is + l_clob clob; + begin + l_clob := '*** Collection '||p_collection_name||' ***'||gc_line_feed; + for r in (select seq_id,c001,c002,c003,c004,c005,c006,c007 + ,c008,c009,c010,c011,c012,c013,c014,c015,c016,c017,c018,c019,c020,c021 + ,c022,c023,c024,c025,c026,c027,c028,c029,c030,c031,c032,c033,c034,c035 + ,c036,c037,c038,c039,c040,c041,c042,c043,c044,c045,c046,c047,c048,c049 + ,c050,n001,n002,n003,n004,n005,d001,d002,d003,d004,d005 + from apex_collections + where collection_name = p_collection_name + ) + loop + l_clob := l_clob ||'seq_id: '||to_char (r.seq_id)||gc_line_feed; + if r.c001 is not null then l_clob := l_clob ||'c001 : '||r.c001||gc_line_feed; end if; + if r.c002 is not null then l_clob := l_clob ||'c002 : '||r.c002||gc_line_feed; end if; + if r.c003 is not null then l_clob := l_clob ||'c003 : '||r.c003||gc_line_feed; end if; + if r.c004 is not null then l_clob := l_clob ||'c004 : '||r.c004||gc_line_feed; end if; + if r.c005 is not null then l_clob := l_clob ||'c005 : '||r.c005||gc_line_feed; end if; + if r.c006 is not null then l_clob := l_clob ||'c006 : '||r.c006||gc_line_feed; end if; + if r.c007 is not null then l_clob := l_clob ||'c007 : '||r.c007||gc_line_feed; end if; + if r.c008 is not null then l_clob := l_clob ||'c008 : '||r.c008||gc_line_feed; end if; + if r.c009 is not null then l_clob := l_clob ||'c009 : '||r.c009||gc_line_feed; end if; + if r.c010 is not null then l_clob := l_clob ||'c010 : '||r.c010||gc_line_feed; end if; + if r.c011 is not null then l_clob := l_clob ||'c011 : '||r.c011||gc_line_feed; end if; + if r.c012 is not null then l_clob := l_clob ||'c012 : '||r.c012||gc_line_feed; end if; + if r.c013 is not null then l_clob := l_clob ||'c013 : '||r.c013||gc_line_feed; end if; + if r.c014 is not null then l_clob := l_clob ||'c014 : '||r.c014||gc_line_feed; end if; + if r.c015 is not null then l_clob := l_clob ||'c015 : '||r.c015||gc_line_feed; end if; + if r.c016 is not null then l_clob := l_clob ||'c016 : '||r.c016||gc_line_feed; end if; + if r.c017 is not null then l_clob := l_clob ||'c017 : '||r.c017||gc_line_feed; end if; + if r.c018 is not null then l_clob := l_clob ||'c018 : '||r.c018||gc_line_feed; end if; + if r.c019 is not null then l_clob := l_clob ||'c019 : '||r.c019||gc_line_feed; end if; + if r.c020 is not null then l_clob := l_clob ||'c020 : '||r.c020||gc_line_feed; end if; + if r.c021 is not null then l_clob := l_clob ||'c021 : '||r.c021||gc_line_feed; end if; + if r.c022 is not null then l_clob := l_clob ||'c022 : '||r.c022||gc_line_feed; end if; + if r.c023 is not null then l_clob := l_clob ||'c023 : '||r.c023||gc_line_feed; end if; + if r.c024 is not null then l_clob := l_clob ||'c024 : '||r.c024||gc_line_feed; end if; + if r.c025 is not null then l_clob := l_clob ||'c025 : '||r.c025||gc_line_feed; end if; + if r.c026 is not null then l_clob := l_clob ||'c026 : '||r.c026||gc_line_feed; end if; + if r.c027 is not null then l_clob := l_clob ||'c027 : '||r.c027||gc_line_feed; end if; + if r.c028 is not null then l_clob := l_clob ||'c028 : '||r.c028||gc_line_feed; end if; + if r.c029 is not null then l_clob := l_clob ||'c029 : '||r.c029||gc_line_feed; end if; + if r.c030 is not null then l_clob := l_clob ||'c030 : '||r.c030||gc_line_feed; end if; + if r.c031 is not null then l_clob := l_clob ||'c031 : '||r.c031||gc_line_feed; end if; + if r.c032 is not null then l_clob := l_clob ||'c032 : '||r.c032||gc_line_feed; end if; + if r.c033 is not null then l_clob := l_clob ||'c033 : '||r.c033||gc_line_feed; end if; + if r.c034 is not null then l_clob := l_clob ||'c034 : '||r.c034||gc_line_feed; end if; + if r.c035 is not null then l_clob := l_clob ||'c035 : '||r.c035||gc_line_feed; end if; + if r.c036 is not null then l_clob := l_clob ||'c036 : '||r.c036||gc_line_feed; end if; + if r.c037 is not null then l_clob := l_clob ||'c037 : '||r.c037||gc_line_feed; end if; + if r.c038 is not null then l_clob := l_clob ||'c038 : '||r.c038||gc_line_feed; end if; + if r.c039 is not null then l_clob := l_clob ||'c039 : '||r.c039||gc_line_feed; end if; + if r.c040 is not null then l_clob := l_clob ||'c040 : '||r.c040||gc_line_feed; end if; + if r.c041 is not null then l_clob := l_clob ||'c041 : '||r.c041||gc_line_feed; end if; + if r.c042 is not null then l_clob := l_clob ||'c042 : '||r.c042||gc_line_feed; end if; + if r.c043 is not null then l_clob := l_clob ||'c043 : '||r.c043||gc_line_feed; end if; + if r.c044 is not null then l_clob := l_clob ||'c044 : '||r.c044||gc_line_feed; end if; + if r.c045 is not null then l_clob := l_clob ||'c045 : '||r.c045||gc_line_feed; end if; + if r.c046 is not null then l_clob := l_clob ||'c046 : '||r.c046||gc_line_feed; end if; + if r.c047 is not null then l_clob := l_clob ||'c047 : '||r.c047||gc_line_feed; end if; + if r.c048 is not null then l_clob := l_clob ||'c048 : '||r.c048||gc_line_feed; end if; + if r.c049 is not null then l_clob := l_clob ||'c049 : '||r.c049||gc_line_feed; end if; + if r.c050 is not null then l_clob := l_clob ||'c050 : '||r.c050||gc_line_feed; end if; + if r.n001 is not null then l_clob := l_clob ||'n001 : '||to_char (r.n001)||gc_line_feed; end if; + if r.n002 is not null then l_clob := l_clob ||'n002 : '||to_char (r.n002)||gc_line_feed; end if; + if r.n003 is not null then l_clob := l_clob ||'n003 : '||to_char (r.n003)||gc_line_feed; end if; + if r.n004 is not null then l_clob := l_clob ||'n004 : '||to_char (r.n004)||gc_line_feed; end if; + if r.n005 is not null then l_clob := l_clob ||'n005 : '||to_char (r.n005)||gc_line_feed; end if; + if r.d001 is not null then l_clob := l_clob ||'d001 : '||to_char (r.d001, gc_date_format)||gc_line_feed; end if; + if r.d002 is not null then l_clob := l_clob ||'d002 : '||to_char (r.d002, gc_date_format)||gc_line_feed; end if; + if r.d003 is not null then l_clob := l_clob ||'d003 : '||to_char (r.d003, gc_date_format)||gc_line_feed; end if; + if r.d004 is not null then l_clob := l_clob ||'d004 : '||to_char (r.d004, gc_date_format)||gc_line_feed; end if; + if r.d005 is not null then l_clob := l_clob ||'d005 : '||to_char (r.d005, gc_date_format)||gc_line_feed; end if; + l_clob := l_clob||'---------------------'||gc_line_feed; + end loop; + logger.log_information (p_text => 'APEX Collection ('||p_collection_name||') in Extra' + ,p_scope => p_scope + ,p_extra => l_clob + ); + end log_collection; + + end logger; / diff --git a/source/packages/logger.pks b/source/packages/logger.pks index 40c0c2b..a045ca4 100644 --- a/source/packages/logger.pks +++ b/source/packages/logger.pks @@ -40,8 +40,22 @@ as -- VARIABLES - g_logger_version constant varchar2(10) := 'x.x.x'; -- Don't change this. Build script will replace with right version number - g_context_name constant varchar2(35) := substr(sys_context('USERENV','CURRENT_SCHEMA'),1,23)||'_LOGCTX'; + -- #129 + -- Don't change the version number. Build script will + -- set the right version number + g_major_version constant pls_integer := -91; + g_minor_version constant pls_integer := -92; + g_patch_version constant pls_integer := -93; + g_beta_version constant varchar2(10) := '#beta#'; + g_logger_version constant varchar2(20) := + g_major_version||'.'|| + g_minor_version||'.'|| + g_patch_version|| + case when g_beta_version is not null + then '_'||g_beta_version + end; + -- g_logger_version constant varchar2(10) := 'x.x.x'; -- Don't change this. Build script will replace with right version number + g_context_name constant varchar2(35) := substr(sys_context('USERENV','CURRENT_SCHEMA'),1,23)||'_LOGCTX'; g_off constant number := 0; g_permanent constant number := 1; @@ -381,5 +395,16 @@ as function get_plugin_rec( p_logger_level in logger_logs.logger_level%type) return logger.rec_logger_log; + + --== + -- Log the contents of an APEX Collection for a given collection name + -- Only attributes that are filled in will be written to LOGGER_LOGS + -- Attributes that are not logged are: + -- CLOB001 + -- BLOB001 + -- XMLTYPE001 + procedure log_collection (p_collection_name in varchar2 + ,p_scope in varchar2 default null + ); end logger; / diff --git a/source/tables/logger_prefs.sql b/source/tables/logger_prefs.sql index d812269..0121d00 100644 --- a/source/tables/logger_prefs.sql +++ b/source/tables/logger_prefs.sql @@ -25,6 +25,49 @@ create table logger_prefs( end; / +-- #127: Add pref_type +declare + type typ_tab_col is record ( + column_name varchar2(30), + data_type varchar2(100), + default_val varchar2(100)); + type typ_arr_tab_col is table of typ_tab_col index by pls_integer; + + l_count pls_integer; + l_new_col typ_tab_col; + l_new_cols typ_arr_tab_col; +begin + + l_new_col.column_name := 'PREF_TYPE'; + l_new_col.data_type := 'VARCHAR2(30)'; + l_new_col.default_val := 'LOGGER'; + l_new_cols(l_new_cols.count+1) := l_new_col; + + for i in 1 .. l_new_cols.count loop + select count(1) + into l_count + from user_tab_columns + where 1=1 + and upper(table_name) = upper('logger_prefs') + and column_name = l_new_cols(i).column_name; + + if l_count = 0 then + execute immediate 'alter table logger_prefs add (' || l_new_cols(i).column_name || ' ' || l_new_cols(i).data_type || nvl2(l_new_cols (i).default_val, ' default '''||l_new_cols(i).default_val||'''', null)|| ')' ; + + -- Custom post-add columns + + -- #127 + if lower(l_new_cols(i).column_name) = 'pref_type' then + -- If "LOGGER" is changed then modify logger.pks g_logger_prefs_pref_type value + execute immediate q'!update logger_prefs set pref_type = 'LOGGER'!'; + execute immediate q'!alter table logger_prefs modify pref_type not null!'; + end if; + + end if; -- l_count = 0 + end loop; + +end; +/ -- Append existing PLSQL_CCFLAGS @@ -65,7 +108,7 @@ begin :new.pref_type := upper(:new.pref_type); if 1=1 - and :new.pref_type = logger.g_pref_type_logger + and :new.pref_type = 'LOGGER' -- logger.g_pref_type_logger and :new.pref_name = 'LEVEL' then :new.pref_value := upper(:new.pref_value); end if; @@ -130,7 +173,7 @@ begin merge into logger_prefs p using ( select 'PURGE_AFTER_DAYS' pref_name, '7' pref_value from dual union - select 'PURGE_MIN_LEVEL' pref_name, 'DEBUG' pref_value from dual union + select 'PURGE_MIN_LEVEL' pref_name, 'INFORMATION' pref_value from dual union select 'LOGGER_VERSION' pref_name, 'x.x.x' pref_value from dual union -- x.x.x will be replaced when running the build script select 'LEVEL' pref_name, 'DEBUG' pref_value from dual union select 'PROTECT_ADMIN_PROCS' pref_name, 'TRUE' pref_value from dual union @@ -151,8 +194,8 @@ begin else p.pref_value end when not matched then - insert (p.pref_name,p.pref_value) - values (d.pref_name,d.pref_value); + insert (p.pref_name,p.pref_value, pref_type) + values (d.pref_name,d.pref_value, 'LOGGER'); $end end; / @@ -160,48 +203,6 @@ end; --- #127: Add pref_type -declare - type typ_tab_col is record ( - column_name varchar2(30), - data_type varchar2(100)); - type typ_arr_tab_col is table of typ_tab_col index by pls_integer; - - l_count pls_integer; - l_new_col typ_tab_col; - l_new_cols typ_arr_tab_col; -begin - - l_new_col.column_name := 'PREF_TYPE'; - l_new_col.data_type := 'VARCHAR2(30)'; - l_new_cols(l_new_cols.count+1) := l_new_col; - - for i in 1 .. l_new_cols.count loop - select count(1) - into l_count - from user_tab_columns - where 1=1 - and upper(table_name) = upper('logger_prefs') - and column_name = l_new_cols(i).column_name; - - if l_count = 0 then - execute immediate 'alter table logger_prefs add (' || l_new_cols(i).column_name || ' ' || l_new_cols(i).data_type || ')'; - - -- Custom post-add columns - - -- #127 - if lower(l_new_cols(i).column_name) = 'pref_type' then - -- If "LOGGER" is changed then modify logger.pks g_logger_prefs_pref_type value - execute immediate q'!update logger_prefs set pref_type = 'LOGGER'!'; - execute immediate q'!alter table logger_prefs modify pref_type not null!'; - end if; - - end if; -- l_count = 0 - end loop; - -end; -/ - -- #127 If old PK, then drop it declare