所以我有这些示例代码:
package require logger
set logger [logger::init someservice]
proc second {} {}
proc first {} {second}
${logger}::trace on
${logger}::trace add first second
puts "monitored procesured are: [${logger}::trace status]"
first
${logger}::delete
运行代码后得到以下结果:
[Wed Mar 14 11:44:11 EDT 2018] [someservice] [trace] 'enter {proc ::first
level 1 script {} caller {} procargs {}}'
[Wed Mar 14 11:44:11 EDT 2018] [someservice] [trace] 'enter {proc ::second
level 2 script {} caller ::first procargs {}}'
[Wed Mar 14 11:44:11 EDT 2018] [someservice] [trace] 'leave {proc ::second
level 2 script {} caller ::first status ok result {}}'
[Wed Mar 14 11:44:11 EDT 2018] [someservice] [trace] 'leave {proc ::first
level 1 script {} caller {} status ok result {}}'
我试图找出如何使用logger通过设置文件处理程序将结果写入文本文件。我试着把" $ {:: filehandler}"在代码中间,但它只打印出#34;第一个"在文本文件中。我应该如何键入命令以在另一个日志文件中打印出工作进程?