Skip to content

Commit

Permalink
Fixes some log issues mentioned in #42. In particular, you couldn't u…
Browse files Browse the repository at this point in the history
…se a custom log folder if BATCH_MODE=yes was set. So you can now set:

    LOG_FOLDER="__DOCUMENT_ROOT__/logs"

In your `~/.virtualhost.sh.conf` file, and `__DOCUMENT_ROOT__` will get substituted for the document root you've picked. Note that this requires a Ruby runtime, which should be already satisfied on any Mac OS X platform. sed wizards are welcome to submit a PR to remove this requirement.
  • Loading branch information
pgib committed Aug 20, 2013
1 parent e478f68 commit 5d4d151
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion virtualhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ ALWAYS_CREATE_LOGS="yes"
# By default, log files will be created in DOCUMENT_ROOT/logs. If you wish to
# override this to a static location, you can do so here.
#LOG_FOLDER="/var/log/httpd"
# If you want your logs in your document root, uncomment the following
#LOG_FOLDER="__DOCUMENT_ROOT__/logs"

# If you have an atypical setup, and you don't need or want entries in your
# /etc/hosts file, you can set the following option to "yes".
Expand Down Expand Up @@ -282,7 +284,9 @@ create_virtualhost()
log="#"
else
log=""
if [ ! -z $LOG_FOLDER ]; then
if [ -n "$LOG_FOLDER" ]; then
# would love a pure shell way to do this, but sed makes it oh so hard
LOG_FOLDER=`ruby -e "puts '$LOG_FOLDER'.gsub(/__DOCUMENT_ROOT__/, '$2')"`
log_folder_path=$LOG_FOLDER
access_log="${log_folder_path}/access_log-$1"
error_log="${log_folder_path}/error_log-$1"
Expand Down Expand Up @@ -816,6 +820,7 @@ if checkyesno ${PROMPT_FOR_LOGS}; then

y*|Y*)
log="1"
LOG_FOLDER="$FOLDER/logs"
;;

*)
Expand Down

0 comments on commit 5d4d151

Please sign in to comment.