Index: openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl,v diff -u -r1.118.2.4 -r1.118.2.5 --- openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 18 Sep 2015 07:33:49 -0000 1.118.2.4 +++ openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 11 Oct 2015 17:35:21 -0000 1.118.2.5 @@ -826,9 +826,7 @@ ns_return 500 text/html $rendered_page - set headers [ns_conn headers] - ns_log Error "[ns_conn method] http://[ns_set iget $headers host][ns_conn url]?[ns_conn query]\ - referred by '$prev_url'\n$error_message" + ad_log error $error_message } ad_proc -private rp_path_prefixes {path} { Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.140.2.10 -r1.140.2.11 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 10 Oct 2015 20:16:23 -0000 1.140.2.10 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 11 Oct 2015 17:35:21 -0000 1.140.2.11 @@ -4708,7 +4708,29 @@ return $result } +ad_proc -public ad_log { + level + message +} { + Output ns_log message with detailed context. This function is + intended to be used typically with "error" to ease debugging. + + @param level Severity level such as "error" or "warning". + @param message Log message + @author Gustaf Neumann +} { + set prefix "" + if {[ns_conn isconnected]} { + set headers [ns_conn headers] + append prefix \ + [ns_conn method] \ + " http://[ns_set iget $headers host][ns_conn url]?[ns_conn query]" \ + " referred by '[get_referrer]'\n" + } + ns_log $level "${prefix}${message}\n[uplevel ad_get_tcl_call_stack]" +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-templating/tcl/tag-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/tag-init.tcl,v diff -u -r1.39.2.9 -r1.39.2.10 --- openacs-4/packages/acs-templating/tcl/tag-init.tcl 10 Oct 2015 12:26:15 -0000 1.39.2.9 +++ openacs-4/packages/acs-templating/tcl/tag-init.tcl 11 Oct 2015 17:35:22 -0000 1.39.2.10 @@ -141,7 +141,7 @@ template::adp_append_code " ns_cache set ds_page_bits \[ad_conn request\]:error \[lappend __include_errors \[list \"$src\" \$::errorInfo\]\]" template::adp_append_code " }" } - template::adp_append_code " ns_log Error \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\n\$::errorInfo\"" + template::adp_append_code " ad_log Error \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\"" template::adp_append_code " }" template::adp_append_code "}" @@ -697,7 +697,7 @@ template::adp_append_code "if { \[catch { ad_try { lappend __adp_include_optional_output \[$command\] } ad_script_abort val { } } errmsg\] } {" template::adp_append_code " append __adp_output \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \[ns_quotehtml \$errmsg\]\"" - template::adp_append_code " ns_log Error \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\n\$::errorInfo\"" + template::adp_append_code " ad_log Error \"Error in include template \\\"\[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]\\\": \$errmsg\"" template::adp_append_code "} else {" template::adp_append_code "if { \[string trim \[lindex \$__adp_include_optional_output end\]\] ne {} } {"