This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
EventLogLogger may throw an exception when the message is too big #305
Closed
Description
The Event log has a message size restriction
Log entry string is too long. A string written to the event log cannot exceed 32766 characters.
Note: The limit is not 32766 characters, but 31839!
Why 31839? See here http://msdn.microsoft.com/en-us/library/windows/desktop/aa363679.aspx
Also look at .NET framework code, which limits to 32766 see System.Diagnostics.EventLog.InternalWriteEvent
Microsoft.Data.Entity.DbContext
An exception occurred in the database while saving changes.
Microsoft.Data.Entity.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.AggregateException: An error occurred while writing to logger(s). ---> System.ArgumentException: Log entry string is too long. A string written to the event log cannot exceed 32766 characters.
at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category)
at Microsoft.Extensions.Logging.EventLog.EventLogLogger.Log(LogLevel logLevel, Int32 eventId, Object state, Exception exception, Func`3 formatter)
at Microsoft.Extensions.Logging.Logger.Log(LogLevel logLevel, Int32 eventId, Object state, Exception exception, Func`3 formatter)
--- End of inner exception stack trace ---
at Microsoft.Extensions.Logging.Logger.Log(LogLevel logLevel, Int32 eventId, Object state, Exception exception, Func`3 formatter)
at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log(LogLevel logLevel, Int32 eventId, Object state, Exception exception, Func`3 formatter)
at Microsoft.Data.Entity.Infrastructure.SensitiveDataLogger`1.Microsoft.Extensions.Logging.ILogger.Log(LogLevel logLevel, Int32 eventId, Object state, Exception exception, Func`3 formatter)
at Microsoft.Data.Entity.Storage.RelationalLoggerExtensions.LogInformation[TState](ILogger logger, RelationalLoggingEventId eventId, Func`1 state, Func`2 formatter)
at Microsoft.Data.Entity.Storage.RelationalLoggerExtensions.LogCommandExecuted(ISensitiveDataLogger logger, DbCommand command, Nullable`1 elapsedMilliseconds)
at Microsoft.Data.Entity.Storage.Internal.RelationalCommand.<ExecuteAsync>d__20`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Data.Entity.Storage.Internal.RelationalCommand.<ExecuteReaderAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Data.Entity.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__28.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Data.Entity.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Data.Entity.Update.Internal.BatchExecutor.<ExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Data.Entity.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Data.Entity.DbContext.<SaveChangesAsync>d__28.MoveNext()