2016-12-01 25 views
0

我想調試我的.vcl文件。我想使用vmod_std和std.log或std.syslog來創建一些輸出並跟蹤我的請求的路徑。 std.syslog不寫入var/log/syslog。我查看了rsyslog.d的50-default.conf並嘗試重新啓動服務。 std.log導致清漆編譯失敗,消息像無法寫入varnishlog或系統日誌清漆

*** Killing all processes... 
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 
*** Running /etc/my_init.d/99-varnish.sh... 
Message from VCC-compiler: 
Expected an action, 'if', '{' or '}' 
('routines.vcl' Line 84 Pos 3) 
    std.log("********* FIND THIS IN THE LOG **************"); 
--#######-------------------------------------------------- 

Running VCC-compiler failed, exit 1 

VCL compilation failed 
*** /etc/my_init.d/99-varnish.sh failed with status 2 

包含日誌的子程序只是

sub cache_this { 
    std.log("log text"); 
    return(lookup); 
} 

這一切使它非常難以調試。 我正在使用Varnish 3.0

回答

0

std.log應該編譯。 您是否在您的vcl文件的開頭導入std?

import std; 

sub cache_this { 
    std.log("log text"); 
    return(lookup); 
} 

如果編譯,你應該能夠看到你的日誌(等等)與varnishlog ...