Roy Prins
Roy Prins

Reputation: 3080

Log arbitrary messages in Apache (httpd.conf file)

I am trying to figure out a way to set up Apache for multiple projects on my development machine. Trying to get to the basics of it before configuring virtualhosts. My idea is switch active projects by setting and reading OS environment variables. Something like this:

Define PROJECT_ROOT osenv('APACHE_PROJECT_ROOT')
Define ACTIVE_PROJECT osenv('APACHE_ACTIVE_PROJECT')

DocumentRoot "%{PROJECT_ROOT}%{ACTIVE_PROJECT}"
<Directory "%{PROJECT_ROOT}%{ACTIVE_PROJECT}">

This isn't working and I really need a method to figure out what is happening in my httpd.conf file. Can I log arbitrary messages? Something like log "test" or log debug_log "%{MY_VARIABLE}"?

Upvotes: 1

Views: 634

Answers (1)

Roy Prins
Roy Prins

Reputation: 3080

I think I have the logging set up:

LoadModule log_debug_module lib/httpd/modules/mod_log_debug.so

LogLevel info

LogMessage "hi world"

This will throw a log message for every request. Somehow it does not work with variables:

Define TEST test
LogMessage %{TEST}

This causes Apache to crash. Not sure why or how I can find out.

Upvotes: 3

Related Questions