CrashDumps.EnableCollectionToDirectory 메서드
업데이트 날짜: 2012년 6월
역할 인스턴스의 미니 크래시 덤프 또는 전체 크래시 덤프를 지정된 디렉터리에 수집할 수 있습니다.
네임스페이스: Microsoft.WindowsAzure.Diagnostics
어셈블리: Microsoft.WindowsAzure.Diagnostics.dll의 Microsoft.WindowsAzure.Diagnostics
구문
‘선언
<EditorBrowsableAttribute(EditorBrowsableState.Advanced)> _
Public Shared Sub EnableCollectionToDirectory ( _
directory As String, _
enableFullDumps As Boolean _
)
[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
public static void EnableCollectionToDirectory (
string directory,
bool enableFullDumps
)
[EditorBrowsableAttribute(EditorBrowsableState::Advanced)]
public:
static void EnableCollectionToDirectory (
String^ directory,
bool enableFullDumps
)
매개 변수
directory
종류: System.String로컬 디렉터리에 대한 절대 경로입니다.
enableFullDumps
종류: System.Booleantrue인 경우 전체 크래시 덤프를 수집합니다. false인 경우 미니 크래시 덤프를 수집합니다.
설명
크래시 덤프의 수집을 사용하도록 설정하면 결과 데이터는 지정된 된 디렉터리에 로컬로 기록됩니다.
크래시 덤프 데이터가 영구적 저장소에 전송되면 wad-crash-dumps
Blob 컨테이너에 저장됩니다. Directories의 ScheduledTransferPeriod 속성을 설정하여 지정된 디렉터리의 전송 간격을 지정할 수 있습니다.
Example
ServiceDefinition.csdef 파일에 LocalResources 요소를 추가하여 호스티드 서비스의 로컬 리소스를 만들 수 있습니다. 예를 들어, 다음 샘플은 MyCustomCrashDumpsLocation
이라는 로컬 리소스를 만듭니다.
ServiceDefinition.csdef
<ServiceDefinition name="MyServiceName" xmlns="https://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole1" vmsize="Small">
<LocalResources>
<LocalStorage name="MyCustomCrashDumpsLocation" sizeInMB="1024" cleanOnRoleRecycle="false" />
</LocalResources>
</WebRole>
</ServiceDefinition>
다음 코드 조각에서는 DiagnosticMonitorConfiguration 개체를 만들고, MyCustomCrashDumpsLocation
리소스에 전체 크래시 덤프를 수집할 수 있도록 설정하고, 진단 데이터에 대해 모니터링되는 디렉터리 목록에 경로를 추가하고, 전송 간격을 30분으로 설정합니다.
WorkerRole.cs
public override bool OnStart()
{
// Get the default initial configuration for DiagnosticMonitor.
DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
// Create a custom logging path for crash dumps.
string customCrashDumpsPath = RoleEnvironment.GetLocalResource("MyCustomCrashDumpsLocation").RootPath;
// Enable full crash dump collection to the custom path.
CrashDumps.EnableCollectionToDirectory(customCrashDumpsPath, true);
// Create a new DirectoryConfiguration object.
DirectoryConfiguration directoryConfiguration = new DirectoryConfiguration();
// Add the name for the blob container in Windows Azure storage.
directoryConfiguration.Container = "wad-crash-dumps";
// Add the directory size quota.
directoryConfiguration.DirectoryQuotaInMB = RoleEnvironment.GetLocalResource("MyCustomCrashDumpsLocation").MaximumSizeInMegabytes;
// Add the crash dumps path.
directoryConfiguration.Path = customCrashDumpsPath;
// Schedule a transfer period of 30 minutes.
diagnosticConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);
// Add the directoryConfiguration to the Directories collection.
diagnosticConfiguration.Directories.DataSources.Add(directoryConfiguration);
// Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);
return base.OnStart();
}
경고
이 API는 Azure SDK 버전 2.5 이상에서 지원되지 않습니다. 대신 diagnostics.wadcfg XML 구성 파일을 사용하세요. 자세한 내용은 Collect Logging Data by Using Azure Diagnostics를 참조하세요.
스레드 보안
이 유형의 public static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.
플랫폼
개발 플랫폼
Windows Vista, Windows 7 및 Windows Server 2008
대상 플랫폼
Change History
참고 항목
참조
CrashDumps 클래스
CrashDumps 멤버
Microsoft.WindowsAzure.Diagnostics 네임스페이스