@@ -33,9 +33,9 @@ public class AzureBlobStorageAppender : AppenderSkeleton
3333 public DateTime CurrentDate { get ; protected set ; }
3434
3535 /// <summary>
36- /// The cloud block BLOB for storing log entries.
36+ /// The cloud BLOB for storing log entries.
3737 /// </summary>
38- private ICloudBlob cloudBlockBlob ;
38+ private ICloudBlob cloudBlob ;
3939
4040 #endregion
4141
@@ -45,21 +45,21 @@ public class AzureBlobStorageAppender : AppenderSkeleton
4545 /// Gets the BLOB.
4646 /// </summary>
4747 /// <value>
48- /// The cloud block BLOB.
48+ /// The cloud BLOB.
4949 /// </value>
5050 private ICloudBlob Blob
5151 {
5252 get
5353 {
5454 // Create a new blob if this is the first time it is used.
55- if ( this . cloudBlockBlob == null )
55+ if ( this . cloudBlob == null )
5656 {
57- this . cloudBlockBlob = this . GetNewBlob ( ) ;
57+ this . cloudBlob = this . GetNewBlob ( ) ;
5858 }
5959 // Recreate a blob if a container is no longer exists.
60- else if ( ! this . cloudBlockBlob . Container . Exists ( ) )
60+ else if ( ! this . cloudBlob . Container . Exists ( ) )
6161 {
62- this . cloudBlockBlob = LogStorageManager . GetBlob ( this . cloudBlockBlob . Name ) ;
62+ this . cloudBlob = LogStorageManager . GetBlob ( this . cloudBlob . Name ) ;
6363 }
6464 // Create a new blob if the current shouldn't be used.
6565 else
@@ -69,11 +69,11 @@ private ICloudBlob Blob
6969
7070 if ( needNewBlob )
7171 {
72- this . cloudBlockBlob = this . GetNewBlob ( ) ;
72+ this . cloudBlob = this . GetNewBlob ( ) ;
7373 }
7474 }
7575
76- return this . cloudBlockBlob ;
76+ return this . cloudBlob ;
7777 }
7878 }
7979
@@ -102,44 +102,17 @@ protected override void Append(LoggingEvent loggingEvent)
102102 {
103103 Sitecore . Diagnostics . Assert . ArgumentNotNull ( loggingEvent , "loggingEvent" ) ;
104104
105- var blob = this . Blob as CloudBlockBlob ;
105+ var blob = this . Blob as CloudAppendBlob ;
106106 string message = this . RenderLoggingEvent ( loggingEvent ) ;
107107
108- this . AddMessageToBlock ( blob , message ) ;
109- }
110-
111- /// <summary>
112- /// Adds the diagnostic message to block blob.
113- /// </summary>
114- /// <param name="blob">The cloud blob.</param>
115- /// <param name="message">The message.</param>
116- protected virtual void AddMessageToBlock ( CloudBlockBlob blob , string message )
117- {
118- Sitecore . Diagnostics . Assert . ArgumentNotNull ( blob , "blob" ) ;
119- Sitecore . Diagnostics . Assert . ArgumentNotNull ( message , "message" ) ;
120-
121- var blockIds = new List < string > ( ) ;
122-
123- if ( blob . Exists ( ) )
124- {
125- blockIds . AddRange ( blob . DownloadBlockList ( ) . Select ( b => b . Name ) ) ;
126- }
127-
128- string blockId = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , string . Empty ) ;
129- blockIds . Add ( blockId ) ;
130-
131- using ( var blockData = new MemoryStream ( LogStorageManager . DefaultTextEncoding . GetBytes ( message ) , false ) )
132- {
133- blob . PutBlock ( blockId , blockData , null ) ;
134- blob . PutBlockList ( blockIds ) ;
135- }
136- }
108+ blob . AppendText ( message ) ;
109+ }
137110
138111 /// <summary>
139112 /// Gets the new cloud blob for diagnostic messages.
140113 /// </summary>
141114 /// <returns>
142- /// The cloud block blob.
115+ /// The cloud blob.
143116 /// </returns>
144117 protected virtual ICloudBlob GetNewBlob ( )
145118 {
0 commit comments