Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Seperate Logfiles and File cache, add diagnostics.

  • Loading branch information...
commit 80f33d9709aba83665a84220fdb6657c14aa9d7b 1 parent fda2bed
@beberlei authored
View
1  Deployment/AzureDeployment.php
@@ -97,6 +97,7 @@ public function createRole($name, $type = self::ROLE_WEB)
$filesystem->mkdir($this->configDir . '/' . $name);
$filesystem->copy(__DIR__ . '/../Resources/role_template/Web.config', $this->configDir . '/' . $name . '/web.config');
$filesystem->copy(__DIR__ . '/../Resources/role_template/index.php', $this->configDir . '/' . $name . '/index.php');
+ $filesystem->copy(__DIR__ . '/../Resources/role_template/diagnotics.wadcfg', $this->binDir . '/diagnostics.wadcfg');
// TODO: explicit directory more robust?
$filesystem->copy(__DIR__ . '/../Resources/role_template/config_azure.yml', $this->configDir . '/../config/config_azure.yml');
$filesystem->copy(__DIR__ . '/../Resources/role_template/parameters_azure.yml', $this->configDir . '/../config/parameters_azure.yml');
View
21 HttpKernel/AzureKernel.php
@@ -19,6 +19,11 @@
* Azure Kernel handles the temporary directory logic depending on the
* deployment status of the Symfony app: On Azure or not on Azure.
*
+ * See add-environment-variables.ps1 for how "SymfonyAzureFileCache" is set.
+ * The Storage is defined in ServiceDefinition.csdef <LocalResources>.
+ * Using the ENV Variable makes the temporary directory consistent for calls through the
+ * Symfony console and access through IIS.
+ *
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
abstract class AzureKernel extends Kernel
@@ -34,15 +39,7 @@ public function init()
$isAzure = isset( $_SERVER['RdRoleId'] );
if ($isAzure) {
- // See add-environment-variables.ps1 for how "LocalStorageRoot" is set.
- // The Storage is defined in ServiceDefinition.csdef <LocalResources>.
- // Using the ENV Variable makes the temporary directory consistent for calls through the
- // Symfony console and access through IIS.
- if (isset($_SERVER['LocalStorageRoot'])) {
- $this->tempDir = $_SERVER['LocalStorageRoot'] . "/sf_" . crc32($this->rootDir);
- } else {
- $this->tempDir = sys_get_temp_dir() . "/sf_" . crc32($this->rootDir);
- }
+ $this->tempDir = sys_get_temp_dir();
} else {
$this->tempDir = $this->rootDir;
}
@@ -50,11 +47,17 @@ public function init()
public function getCacheDir()
{
+ if (isset($_SERVER['SymfonyAzureFileCache']) && is_dir($_SERVER['SymfonyAzureFileCache'])) {
+ return $_SERVER['SymfonyAzureFileCache'] . '/cache/' . $this->getEnvironment();
+ }
return $this->tempDir . '/cache/' . $this->getEnvironment();
}
public function getLogDir()
{
+ if (isset($_SERVER['SymfonyAzureLogFiles']) && is_dir($_SERVER['SymfonyAzureLogFiles'])) {
+ return $_SERVER['SymfonyAzureLogFiles'] . '/logs';
+ }
return $this->tempDir . '/logs';
}
}
View
1  Resources/role_template/WebRole.xml
@@ -29,5 +29,6 @@
<LocalResources>
<!-- http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx -->
<LocalStorage name="SymfonyFileCache" sizeInMB="100" />
+ <LocalStorage name="SymfonyLogFiles" sizeInMB="1000" />
</LocalResources>
</WebRole>
View
3  Resources/role_template/bin/add-environment-variables.ps1
@@ -14,7 +14,8 @@ if (![Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::CurrentRoleInstanc
}
[Environment]::SetEnvironmentVariable('Path', $env:RoleRoot + '\base\x86;' + [Environment]::GetEnvironmentVariable('Path', 'Machine'), 'Machine')
-[Environment]::SetEnvironmentVariable("LocalStorageRoot", [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetLocalResource('SymfonyFileCache').RootPath, "Machine")
+[Environment]::SetEnvironmentVariable("SymfonyAzureFileCache", [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetLocalResource('SymfonyFileCache').RootPath, "Machine")
+[Environment]::SetEnvironmentVariable("SymfonyAzureLogFiles", [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetLocalResource('SymfonyLogFiles').RootPath, "Machine")
# Detect the script path of this ps1, assume its in "approot\bin" and
# find the application directory. Set this as environment variable.
View
60 Resources/role_template/diagnostics.wadcfg
@@ -1,35 +1,33 @@
-<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration" configurationChangePollInterval="PT1M" overallQuotaInMB="4096">
- <DiagnosticInfrastructureLogs bufferQuotaInMB="10"
- scheduledTransferLogLevelFilter="Error"
- scheduledTransferPeriod="PT1M" />
+<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration" configurationChangePollInterval="PT1M" overallQuotaInMB="1024">
+ <DiagnosticInfrastructureLogs bufferQuotaInMB="10"
+ scheduledTransferLogLevelFilter="Error"
+ scheduledTransferPeriod="PT1M" />
- <Logs bufferQuotaInMB="0"
- scheduledTransferLogLevelFilter="Verbose"
- scheduledTransferPeriod="PT1M" />
+ <Logs bufferQuotaInMB="0"
+ scheduledTransferLogLevelFilter="Verbose"
+ scheduledTransferPeriod="PT1M" />
- <Directories bufferQuotaInMB="0"
- scheduledTransferPeriod="PT5M">
-
- <!-- These three elements specify the special directories
- that are set up for the log types -->
- <CrashDumps container="wad-crash-dumps" directoryQuotaInMB="256" />
- <FailedRequestLogs container="wad-frq" directoryQuotaInMB="256" />
- <IISLogs container="wad-iis" directoryQuotaInMB="256" />
- </Directories>
+ <Directories bufferQuotaInMB="0" scheduledTransferPeriod="PT5M">
+ <CrashDumps container="wad-crash-dumps" directoryQuotaInMB="256" />
+ <FailedRequestLogs container="wad-frq" directoryQuotaInMB="256" />
+ <IISLogs container="wad-iis" directoryQuotaInMB="256" />
- <PerformanceCounters bufferQuotaInMB="0" scheduledTransferPeriod="PT1M">
- <!-- The counter specifier is in the same format as the imperative
- diagnostics configuration API -->
- <PerformanceCounterConfiguration
- counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT5M" />
- <PerformanceCounterConfiguration
- counterSpecifier="\Memory\Available Mbytes" sampleRate="PT5M" />
- </PerformanceCounters>
- <WindowsEventLog bufferQuotaInMB="0"
- scheduledTransferLogLevelFilter="Verbose"
- scheduledTransferPeriod="PT5M">
- <!-- The event log name is in the same format as the imperative
- diagnostics configuration API -->
- <DataSource name="System!*" />
- </WindowsEventLog>
+ <DataSources>
+ <DirectoryConfiguration container="wad-custom" directoryQuotaInMB="128">
+ <LocalResource name="SymfonyLogFiles" relativePath="logs" />
+ </DirectoryConfiguration>
+ </DataSources>
+ </Directories>
+
+ <PerformanceCounters bufferQuotaInMB="0" scheduledTransferPeriod="PT1M">
+ <PerformanceCounterConfiguration
+ counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT5M" />
+ <PerformanceCounterConfiguration
+ counterSpecifier="\Memory\Available Mbytes" sampleRate="PT5M" />
+ </PerformanceCounters>
+ <WindowsEventLog bufferQuotaInMB="0"
+ scheduledTransferLogLevelFilter="Verbose"
+ scheduledTransferPeriod="PT5M">
+ <DataSource name="System!*" />
+ </WindowsEventLog>
</DiagnosticMonitorConfiguration>
Please sign in to comment.
Something went wrong with that request. Please try again.