This commit is contained in:
Sebastien Ros
2011-10-03 11:36:21 -07:00
436 changed files with 18658 additions and 11017 deletions
+10 -4
View File
@@ -345,11 +345,15 @@ namespace Orchard.Azure {
}
public string GetPath() {
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
using (new HttpContextWeaver()) {
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
}
}
public long GetSize() {
return GetDirectorySize(_blob);
using (new HttpContextWeaver()) {
return GetDirectorySize(_blob);
}
}
public DateTime GetLastUpdated() {
@@ -357,8 +361,10 @@ namespace Orchard.Azure {
}
public IStorageFolder GetParent() {
if ( _blob.Parent != null ) {
return new AzureBlobFolderStorage(_blob.Parent, _rootPath);
using (new HttpContextWeaver()) {
if (_blob.Parent != null) {
return new AzureBlobFolderStorage(_blob.Parent, _rootPath);
}
}
throw new ArgumentException("Directory " + _blob.Uri + " does not have a parent directory");
}
@@ -0,0 +1,40 @@
using System;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics.Management;
using Microsoft.WindowsAzure.ServiceRuntime;
using log4net.Appender;
using log4net.Core;
namespace Orchard.Azure.Logging {
/// <summary>
/// Azure specific implementation of a log4net appender.
/// Uses DataConnectionString to define the location of the log.
/// </summary>
public class AzureAppender : AppenderSkeleton {
private const string WadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
public AzureAppender() {
var cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(WadConnectionString));
var roleInstanceDiagnosticManager = cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
RoleEnvironment.DeploymentId,
RoleEnvironment.CurrentRoleInstance.Role.Name,
RoleEnvironment.CurrentRoleInstance.Id);
var diagnosticMonitorConfiguration = roleInstanceDiagnosticManager.GetCurrentConfiguration();
diagnosticMonitorConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
roleInstanceDiagnosticManager.SetCurrentConfiguration(diagnosticMonitorConfiguration);
}
protected override void Append(LoggingEvent loggingEvent) {
var formattedLog = RenderLoggingEvent(loggingEvent);
// this is the way to logging into Azure
System.Diagnostics.Trace.WriteLine(formattedLog);
}
}
}
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>1.3.0</ProductVersion>
<ProductVersion>1.5.0</ProductVersion>
<ProjectGuid>{03c5327d-4e8e-45a7-acd1-e18e7caa3c4a}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -45,7 +46,8 @@
</ItemGroup>
<!-- Import the target files for this project template -->
<PropertyGroup>
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\Cloud Service\1.0\Visual Studio 10.0\</CloudExtensionsDir>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\1.5\</CloudExtensionsDir>
</PropertyGroup>
<Import Project="$(CloudExtensionsDir)Microsoft.CloudService.targets" />
<Import Project="$(CloudExtensionsDir)Microsoft.WindowsAzure.targets" />
</Project>
@@ -4,6 +4,7 @@
<Instances count="1" />
<ConfigurationSettings>
<Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
@@ -8,6 +8,9 @@
</Bindings>
</Site>
</Sites>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
<ConfigurationSettings>
<Setting name="DataConnectionString" />
</ConfigurationSettings>
@@ -3,26 +3,25 @@
<root>
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
<priority value="WARN" />
<appender-ref ref="RollingLogFileAppender" />
<appender-ref ref="AzureAppender" />
</root>
<!--
<logger name="Orchard.Localization">
<priority value="WARN" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
-->
<logger name="Orchard.Data.SessionLocator">
<priority value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="App_Data/Logs/orchard-debug.txt" />
<appendToFile value="true" />
<immediateFlush value="true" />
<appender name="AzureAppender" type="Orchard.Logging.AzureAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<!-- only error and fatal messages end up in this target, even if child loggers accept lower priority -->
<levelMin value="ERROR" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%logger - %message%newline" />
<conversionPattern value="%date [%thread] %logger - %message%newline" />
</layout>
</appender>
</log4net>
@@ -85,11 +85,7 @@
<Reference Include="System.Data.DataSetExtensions">
<Private>False</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, PublicKeyToken=89845dcd8080cc91" />
<Reference Include="System.Web.ApplicationServices">
<Private>False</Private>
</Reference>
@@ -36,6 +36,20 @@
</namespaces>
</pages>
</system.web.webPages.razor>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,
Microsoft.WindowsAzure.Diagnostics,
Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
</add>
</listeners>
</trace>
</system.diagnostics>
<!--
Set default transaction timeout to 30 minutes so that interactive debugging
+7
View File
@@ -53,6 +53,11 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\lib\fluentnhibernate\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
@@ -76,6 +81,7 @@
<Compile Include="HttpContextWeaver.cs" />
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
<Compile Include="Logging\AzureAppender.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AzureFileSystem.cs" />
</ItemGroup>
@@ -103,6 +109,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.