summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Jacq2010-10-24 01:32:21 (GMT)
committermig52010-10-24 01:32:21 (GMT)
commit3dad6ecf40e966f54285d4d7ca2025ba68245aa3 (patch)
tree3d4b8b0ec43cbf2018b9cdc753e848c0786b7213
parent0896635de8b6eacbab5212c13b9f97b3543a944d (diff)
working on adding a log directory to split apache logsdev-log_directory
-rw-r--r--http/apache/apache_service.inc20
-rw-r--r--http/apache/vhost.tpl.php4
-rw-r--r--http/http.drush.inc2
-rw-r--r--provision.context.site.inc1
-rw-r--r--provision.service.inc8
5 files changed, 35 insertions, 0 deletions
diff --git a/http/apache/apache_service.inc b/http/apache/apache_service.inc
index bf5dc21..3005786 100644
--- a/http/apache/apache_service.inc
+++ b/http/apache/apache_service.inc
@@ -3,11 +3,16 @@
class provisionService_http_apache extends provisionService_http_public {
protected $application_name = 'apache';
protected $has_restart_cmd = TRUE;
+ protected $has_log_directory = TRUE;
function default_restart_cmd() {
return provisionService_http_apache::apache_restart_cmd();
}
+ function default_log_directory() {
+ return provisionService_http_apache::apache_log_directory();
+ }
+
function cloaked_db_creds() {
return TRUE;
}
@@ -47,6 +52,21 @@ class provisionService_http_apache extends provisionService_http_public {
return "sudo $command graceful";
}
+ public static function apache_log_directory() {
+ $log_directory = '/var/log/apache2'; #debian/ubuntu
+ $options[] = '/var/log/apache'; #centos?
+ $options[] = '/var/log/httpd'; #redhat/centos ?
+ $options[] = $log_directory;
+
+ foreach ($options as $test) {
+ if(is_dir($test)) {
+ $log_directory = $test;
+ break;
+ }
+ }
+ return $log_directory;
+ }
+
/**
* Restart apache to pick up the new config files.
*/
diff --git a/http/apache/vhost.tpl.php b/http/apache/vhost.tpl.php
index bc29d52..8d8e063 100644
--- a/http/apache/vhost.tpl.php
+++ b/http/apache/vhost.tpl.php
@@ -42,6 +42,10 @@ if ($this->redirection || $ssl_redirection) {
print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [L,R=301]\n";
}
}
+
+if ($this->split_logfiles) {
+ print " CustomLog " . $http_log_directory . "/" . $this->uri . ".log combined";
+}
?>
diff --git a/http/http.drush.inc b/http/http.drush.inc
index 3f12b56..737a019 100644
--- a/http/http.drush.inc
+++ b/http/http.drush.inc
@@ -67,6 +67,8 @@ class provisionService_http_public extends provisionService_http {
$data['http_port'] = $this->server->http_port;
+ $data['http_log_directory'] = $this->server->http_log_directory;
+
// We assign this generic catch all for standard http.
// The SSL based services will override this with the
// correct ip address.
diff --git a/provision.context.site.inc b/provision.context.site.inc
index 397e312..6060cac 100644
--- a/provision.context.site.inc
+++ b/provision.context.site.inc
@@ -35,6 +35,7 @@ class provisionContext_site extends provisionContext {
$this->setProperty('client_email');
$this->setProperty('aliases', array(), TRUE);
$this->setProperty('redirection', FALSE);
+ $this->setProperty('split_logfiles', FALSE);
// this can potentially be handled by a Drupal sub class
$this->setProperty('profile', 'default');
diff --git a/provision.service.inc b/provision.service.inc
index 92ecd72..b882dfe 100644
--- a/provision.service.inc
+++ b/provision.service.inc
@@ -14,6 +14,7 @@ class provisionService extends provisionChainedState {
protected $has_restart_cmd = FALSE;
protected $has_port = FALSE;
+ protected $has_log_directory = FALSE;
protected $configs = array();
@@ -49,6 +50,9 @@ class provisionService extends provisionChainedState {
if ($this->has_restart_cmd) {
$this->server->setProperty($this->service . '_restart_cmd', $this->default_restart_cmd());
}
+ if ($this->has_log_directory) {
+ $this->server->setProperty($this->service . '_log_directory', $this->default_log_directory());
+ }
}
return TRUE;
}
@@ -70,6 +74,10 @@ class provisionService extends provisionChainedState {
return false;
}
+ function default_log_directory() {
+ return false;
+ }
+
/**
* Set the currently active configuration object.
*