Ticket UUID: | 93ebedfa4a96b86471bdcf19fd023e768b3e09bb | ||
Title: | Replace log package by logger package | ||
Status: | Closed | Type: | Feature_Request |
Severity: | Minor | Priority: | Immediate |
Subsystem: | Client_Side | Resolution: | Fixed |
Assigned to: | unassigned | ||
Last Modified: | 2018-02-20 14:23:37 | ||
Version Found In: | trunk | ||
Description & Comments: | |||
Issue: slow due to logging, even if switched offTCLWS uses the tcllib log package to do logging. IMHO, this introduces performence penalties, specially when not logging. Example 1: Large XML message logged::log::log debug "Parsing WSDL {$wsdlXML}" Example 2: Procedure call with large xml message as parameter logged::log::log debug [list ::WS::Client::DoCall $serviceName $operationName $argList] ::WS::Client::DoCall $serviceName $operationName $argList Big string with often whole xml messages are formatted for the log message and thrown away, if no logging activated. The formatting of the list may not be avoided. In addition, the ::log::log call is IMHO quite exensive, if the log level is not set. I looked into the source... Possible solutionsCheck for debug on entry of procedures and if the log commandsset fDebug [::log::lvIsSuppressed debug] if {!$fDebug} {::log::log debug [list ::WS::Client::DoCall $serviceName} Use the logger package instead of log
New command which evaluates and invokes only if log level is setIMHO an optimal log package only gets a log command verbatim and only evaluates it if the log level is set. To get to the upper example: logCmdDebug {[list ::WS::Client::DoCall $serviceName $operationName $argList]} ::WS::Client::DoCall $serviceName $operationName $argListand logCmd will be defined depending on the log level as: if {[::log::lvIsSuppressed debug]} { proc logCmdDebug {cmd} {} } else { proc logCmdDebug {cmd} { log::log debug [uplevel 1 $cmd] } } Is this reasonable ? Thank you for any thoughts, Harald oehhar added on 2017-11-14 16:49:12 UTC:
Thank you for you thoughts, Harald oehhar added on 2017-11-14 21:05:45 UTC: % proc l {} { > set l [list a b [string repeat A 100000]] > puts [tcl::unsupported::representation $l] > log::log debug $l > puts [tcl::unsupported::representation $l] > } % l value is a list with a refcount of 2, object pointer at 0x7bbee80, internal representation 0x77485f0:0x0, no string representation value is a list with a refcount of 2, object pointer at 0x7bbee80, internal representation 0x77485f0:0x0, no string representation So apparently, it works. Thank you, Gerald ! oehhar added on 2018-02-20 14:23:37 UTC: This is now introduced into tclws starting with commit [150950db68]. I am so far satisfied with this so closing the ticket. Thank you all, Harald |