Closed mesuttalebi closed 3 years ago
Could please tell me which Serilog MongoDB sink you are using and send me the whole exception stack trace.
Could please tell me which Serilog MongoDB sink you are using and send me the whole exception stack trace.
Hello,
"Exception": {
"_t": "FormatException",
"HelpLink": null,
"Source": "MongoDB.Bson",
"HResult": -2146233033,
"Message": "An error occurred while deserializing the Exception property of class Serilog.Ui.MongoDbProvider.MongoDbLogModel: Cannot deserialize a 'String' from BsonType 'Document'.",
"StackTrace": " at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)\r\n at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)\r\n at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)\r\n at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)\r\n at MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch[TDocument](RawBsonArray batch, IBsonSerializer`1 documentSerializer, MessageEncoderSettings messageEncoderSettings)\r\n at MongoDB.Driver.Core.Operations.FindCommandOperation`1.CreateFirstCursorBatch(BsonDocument cursorDocument)\r\n at MongoDB.Driver.Core.Operations.FindCommandOperation`1.CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument commandResult)\r\n at MongoDB.Driver.Core.Operations.FindCommandOperation`1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)\r\n at MongoDB.Driver.Core.Operations.FindOperation`1.ExecuteAsync(RetryableReadContext context, CancellationToken cancellationToken)\r\n at MongoDB.Driver.Core.Operations.FindOperation`1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)\r\n at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)\r\n at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)\r\n at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)\r\n at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListAsync[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)\r\n at Serilog.Ui.MongoDbProvider.MongoDbDataProvider.GetLogsAsync(Int32 page, Int32 count, String level, String searchCriteria, Nullable`1 startDate, Nullable`1 endDate)\r\n at Serilog.Ui.MongoDbProvider.MongoDbDataProvider.FetchDataAsync(Int32 page, Int32 count, String level, String searchCriteria, Nullable`1 startDate, Nullable`1 endDate)\r\n at Serilog.Ui.Web.SerilogUiMiddleware.FetchLogsAsync(HttpContext httpContext)\r\n at Serilog.Ui.Web.SerilogUiMiddleware.Invoke(HttpContext httpContext)",
"Data": {}
}
MongoDB sink changed the exception field type from string to object. I will fix that this weekend and sorry for the delay.
Hello, I just configured Serilog with mongo db, and Serlilog ui to see the logs, but the error show in an alert box as soon as page opens.
not: ı can see logs in mongodb compass software.
An error occurred while deserializing the Exception property of class Serilog.Ui.MongoDbProvider.MongoDbLogModel: Cannot deserialize a 'String' from BsonType 'Document'.
serilog version: 2.1 asp.net core version: 5 mongodb version: 5.0.2