lighty's life

lighty developer blog

Log-condition-handling, the Hidden Feature for Debuging

Many features was introduced into lighttpd 1.4.x series to improve config file handling. But there’s something left undocumented, yet nice feature, for debuging.

It was originally implemented to debug the new condition caching system internally for developers only.

But i found it nice for user to debug how to condition is matching, seeing the 2 values on both side of the operator, and if they matched. A new patch was commited to make it a bit cleaner for your use.

  1. just add or uncomment: debug.log-condition-handling = “enable” in your configuration.
  2. restart your lighttpd, or start it with sbin/lighttpd -Df lighttpd.conf
  3. request the url, and check the error.log, or stderr in case u haven’t specified error.log

./sbin/ligittpd -pf test.conf

config {
  var.PID                      = 25629
  var.CWD                      = "/usr/src/lighttpd/branches/lighttpd-merge-1.4.x"
  server.modules               = ("mod_indexfile", "mod_staticfile")
  server.port                  = 8080
  server.document-root         = "/tmp"
  debug.log-condition-handling = "enable"
  
  
  $HTTP["useragent"] =~ "MSIE" {
    # block 1
  
  } # end of $HTTP["useragent"] =~ "MSIE"
}

./sbin/lighttpd -Df test.conf

2006-04-02 13:40:05: (src/log.c.75) server started 
2006-04-02 13:40:07: (src/response.c.150) run condition 
2006-04-02 13:40:07: (src/configfile-glue.c.404) === start of 1 condition block === 
2006-04-02 13:40:07: (src/configfile-glue.c.356)
HTTP["useragent"] ( Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) ) compare to MSIE 
2006-04-02 13:40:07: (src/configfile-glue.c.419) 1 result: true

See also: advanced configuration in 1.4.x, lighttpd unleashed part one, lighttpd unleashed part two

lighttpd

Please note that we won't accept comments for posts older than 3 months! Also please use our bug tracker to report bugs, and our irc channel #lighttpd@libera to chat.

« Jan on Tour One more opcache for php (Preview) »