Debugging Cherokee

If you need to debug the behavior of the web server (or an application), there are some helpful tools available for you.

  • To start with, if you are using gcc and you want to compile Cherokee with debug information just execute make like this:

  make CFLAGS="-O0 -g3"
And then you'll be able to execute gdb, cgdb, gdbtui..
  • You can use autoconf to set up Cherokee to use static modules:

  ./autogen.sh --localstatedir=/var --prefix=/usr --sysconfdir=/etc  \
  --with-wwwroot=/var/www --enable-static-module=all --enable-static \
  --enable-shared=no
  • You can also enable a new cool feature: CHEROKEE_TRACE, which will let you trace the behavior with a human-readable output:

  --enable-trace

Now, when you are going to launch the web server, just add the CHEROKEE_TRACE variable, with the desired options:

cherokee# CHEROKEE_TRACE="common" cherokee
Cherokee Web Server 0.7.0 (May 21 2008): Listening on port 80, TLS disabled
IPv6 enabled, using epoll, 1024 fds system limit, max. 507 connections
5 threads, 206 fds per thread, standard scheduling policyhandler_common.c:0143 (                     stat_file): /var/www//images/powered_by_cherokee.png, use_iocache=0 re=0
handler_common.c:0190 (   cherokee_handler_common_new): request: '/images/powered_by_cherokee.png', local: '/var/www//images/powered_by_cherokee.png', exists 1
handler_common.c:0236 (   cherokee_handler_common_new): going for handler_file
handler_common.c:0143 (                     stat_file): /var/www//images/default-bg.png, use_iocache=0 re=0
handler_common.c:0190 (   cherokee_handler_common_new): request: '/images/default-bg.png', local: '/var/www//images/default-bg.png', exists 1
handler_common.c:0236 (   cherokee_handler_common_new): going for handler_file
handler_common.c:0143 (                     stat_file): /var/www//images/cherokee-logo.png, use_iocache=0 re=0
handler_common.c:0190 (   cherokee_handler_common_new): request: '/images/cherokee-logo.png', local: '/var/www//images/cherokee-logo.png', exists 1
handler_common.c:0236 (   cherokee_handler_common_new): going for handler_file

Of course, you can trace all the modules (handlers, loggers..) you need:

CHEROKEE_TRACE="common,static,io_cache" /usr/bin/cherokee
CHEROKEE_TRACE="all" /usr/bin/cherokee