Skip to content
This repository was archived by the owner on Nov 10, 2017. It is now read-only.

Commit 244b412

Browse files
committed
Fixed an empty blog 'log.{date}' creating.
1 parent a5ed821 commit 244b412

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/Sitecore.Azure.Diagnostics/Appenders/AzureBlobStorageAppender.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using log4net.Appender;
22
using log4net.spi;
3+
using Microsoft.WindowsAzure.Storage;
34
using Microsoft.WindowsAzure.Storage.Blob;
45
using Sitecore.Azure.Diagnostics.Storage;
56
using System;
@@ -100,8 +101,14 @@ protected override void Append(LoggingEvent loggingEvent)
100101
Sitecore.Diagnostics.Assert.ArgumentNotNull(loggingEvent, "loggingEvent");
101102

102103
var blob = this.Blob as CloudAppendBlob;
103-
string message = this.RenderLoggingEvent(loggingEvent);
104104

105+
if (!blob.Exists())
106+
{
107+
// Create an empty append blob or throw an exception if the blob exists.
108+
blob.CreateOrReplace(AccessCondition.GenerateIfNotExistsCondition());
109+
}
110+
111+
string message = this.RenderLoggingEvent(loggingEvent);
105112
blob.AppendText(message);
106113
}
107114

src/Sitecore.Azure.Diagnostics/Storage/AzureBlobStorageProvider.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ public virtual ICloudBlob CreateBlob(string blobName)
258258
this.CloudBlobContainer.GetAppendBlobReference(blobName) :
259259
this.GetContainer(this.ContainerName).GetAppendBlobReference(blobName);
260260

261-
if (!blob.Exists())
262-
{
263-
// Create an empty append blob or throw an exception if the blob exists.
264-
blob.CreateOrReplace(AccessCondition.GenerateIfNotExistsCondition());
265-
}
261+
//if (!blob.Exists())
262+
//{
263+
// // Create an empty append blob or throw an exception if the blob exists.
264+
// blob.CreateOrReplace(AccessCondition.GenerateIfNotExistsCondition());
265+
//}
266266

267267
return blob;
268268
}

0 commit comments

Comments
 (0)