Comments (31)
I will try to fix it tonight and publish new package
from serilog-ui.
Yes, I did. It's the problem with parsing the date value in DB to DateTime
from serilog-ui.
PR?
I resolved the issue by changing the datetime column type in sql from datetimeoffset(7) to datetime2(7).
from serilog-ui.
got same issue .
also getting faild to fetch issue
did you solve it ?
from serilog-ui.
@NaserElziadna no I have not.
@mo-esmp have you had a chance to look at this?
from serilog-ui.
@NaserElziadna no I have not.
@mo-esmp have you had a chance to look at this?
still cant figure this out
i will updated here if i do so
from serilog-ui.
Sorry guys for the inconvenience, I'm on a trip and I will check within the next few days. I guess the problem is -06:00 (time zone) at the end of the date column.
from serilog-ui.
@mo-esmp
its very urgent that i provide a solution to my boss by tomorrow.
Note :: i had a very hard time to convince my manger to accept working with this pakcage
from serilog-ui.
@mo-esmp thank you very much , waiting for your update
from serilog-ui.
Thank you @mo-esmp I appreciate your prompt response and resolution. Let me know when you have it updated and pushed and I will test it and provide feedback.
from serilog-ui.
@mo-esmp trying to speed you up, I think this may help
File: SerilogUIMiddleWare.cs
Line: 157, 158
Adjust to
// String with date and offset dateString = "05/01/2008 +7:00"; if (DateTimeOffset.TryParse(dateString, out parsedDate)) Console.WriteLine("{0} was converted to {1}.", dateString, parsedDate);
Source from:
https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tryparse?view=net-7.0
from serilog-ui.
@mruch2 and @NaserElziadna which version of Serilog.Sinks.MSSqlServer
you are using?
from serilog-ui.
@mo-esmp i am using Serilog.Sinks.MSSqlServer 6.2.0
from serilog-ui.
I tried to reproduce the error but everything works fine for me. Could you please provide a sample project by sharing a repo or a backup of your sample logs to restore on my DB?
from serilog-ui.
@mo-esmp badly i cant share a db backup or repo - but can you share the timestamp format that is been saved in your LogTable.
so , i just change mine as yours
from serilog-ui.
First, I'm just wondering how you got the time zone in the timestamp column
Second, the error message @mruch2 shared is about column order and basically, it should not be a problem!
https://github.com/mo-esmp/serilog-ui/blob/4434538f0fb6aca39b810ec4389724daac6e7c92/src/Serilog.Ui.MsSqlServerProvider/SqlServerDataProvider.cs#L47
from serilog-ui.
@mo-esmp here's what i have
from serilog-ui.
from serilog-ui.
@mo-esmp , this one of log rows , and i think its about the issue i have
Message
Error parsing column 3 (TimeStamp=2/1/2023 1:25:13 PM +02:00 - Object)
MessageTemplate
Error parsing column 3 (TimeStamp=2/1/2023 1:25:13 PM +02:00 - Object)
Level
Error
TimeStamp
2023-02-01 13:25:44.9103720 +02:00
Exception
System.Data.DataException: Error parsing column 3 (TimeStamp=2/1/2023 1:25:13 PM +02:00 - Object)
---> System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Deserialize37774c75-f66d-4eef-9a57-079c9976f7b4(IDataReader )
--- End of inner exception stack trace ---
at Dapper.SqlMapper.ThrowDataException(Exception ex, Int32 index, IDataReader reader, Object value) in //Dapper/SqlMapper.cs:line 3634
at Deserialize37774c75-f66d-4eef-9a57-079c9976f7b4(IDataReader )
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in //Dapper/SqlMapper.Async.cs:line 439
at Serilog.Ui.MsSqlServerProvider.SqlServerDataProvider.GetLogsAsync(Int32 page, Int32 count, String level, String searchCriteria, Nullable1 startDate, Nullable
1 endDate)
at Serilog.Ui.MsSqlServerProvider.SqlServerDataProvider.FetchDataAsync(Int32 page, Int32 count, String logLevel, String searchCriteria, Nullable1 startDate, Nullable
1 endDate)
at Serilog.Ui.Web.SerilogUiMiddleware.FetchLogsAsync(HttpContext httpContext)
at Serilog.Ui.Web.SerilogUiMiddleware.Invoke(HttpContext httpContext)
properties
Serilog.Ui.Web.SerilogUiMiddleware
0HMO48RN29Q3G:00000005
/logs/api/logs
0HMO48RN29Q3G
Guest
from serilog-ui.
@mo-esmp any updates ?
from serilog-ui.
Sorry, I'm out now and when I return to the hotel I will check
from serilog-ui.
sure , thanks
did you get any basic understanding of the issue from what i sent
from serilog-ui.
@mo-esmp will you be able to fix this issue and upload the fixes to the nuget market by today evening ?
(or should i find an excuse for my boss 😜)
from serilog-ui.
** @mo-esmp heres a fix , (i think)
File: SerilogUIMiddleWare.cs
Method: FetchLogsAsync**
private async Task FetchLogsAsync(HttpContext httpContext)
{
httpContext.Request.Query.TryGetValue("page", out var pageStr);
httpContext.Request.Query.TryGetValue("count", out var countStr);
httpContext.Request.Query.TryGetValue("level", out var levelStr);
httpContext.Request.Query.TryGetValue("search", out var searchStr);
httpContext.Request.Query.TryGetValue("startDate", out var startDateStar);
httpContext.Request.Query.TryGetValue("endDate", out var endDateStar);
int.TryParse(pageStr, out var currentPage);
int.TryParse(countStr, out var count);
var formats = new string[] {
"M/d/yyyy h:mm:ss tt zz",
"M/dd/yyyy hh:mm:ss",
"MM/dd/yyyy HH:mm:ss",
"MM/d/yyyy hh:mm:ss tt",
"M/dd/yyyy hh:mm:ss tt",
"MM/dd/yyyy hh:mm:ss tt",
// Add other date and time format strings here
};
var culture = CultureInfo.InvariantCulture;
DateTime startDate, endDate;
if (!DateTime.TryParseExact(startDateStar, formats, culture, DateTimeStyles.None, out startDate))
{
startDate = default;
}
if (!DateTime.TryParseExact(endDateStar, formats, culture, DateTimeStyles.None, out endDate))
{
endDate = default;
}
if (endDate != default)
endDate = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59);
currentPage = currentPage == default ? 1 : currentPage;
count = count == default ? 10 : count;
var provider = httpContext.RequestServices.GetService<IDataProvider>();
var (logs, total) = await provider.FetchDataAsync(currentPage, count, levelStr, searchStr,
startDate == default ? (DateTime?)null : startDate, endDate == default ? (DateTime?)null : endDate);
//var result = JsonSerializer.Serialize(logs, _jsonSerializerOptions);
var result = JsonConvert.SerializeObject(new { logs, total, count, currentPage }, _jsonSerializerOptions);
return result;
}
Here are some additional format strings that can be used with the DateTime.ToString method in C#:
- "MM/dd/yyyy" - month/day/year
- "dd/MM/yyyy" - day/month/year
- "yyyy/MM/dd" - year/month/day
- "dd-MM-yyyy" - day-month-year
- "dd.MM.yyyy" - day.month.year
- "MMM dd, yyyy" - abbreviated month name day, year
- "MMMM dd, yyyy" - full month name day, year
- "dd MMM yyyy" - day abbreviated month name year
- "dd MMMM yyyy" - day full month name year
- "yyyy MMMM dd" - year full month name day
- "yyyy-MM-dd" - year-month-day
- "MM-dd-yyyy" - month-day-year
- "dd.MM.yy" - day.month.two digit year
- "MM/dd/yy" - month/day/two digit year
- "dd-MMM-yy" - day-abbreviated month name-two digit year
- "dd MMM yy" - day abbreviated month name two digit year
- "dddd, dd MMMM yyyy HH:mm:ss" - full day name, day full month name year hour:minute:second
- "dddd, dd MMMM yyyy h:mm:ss tt" - full day name, day full month name year hour:minute:second AM/PM
- "dddd, dd MMMM yyyy H:mm:ss" - full day name, day full month name year hour:minute:second (24-hour format)
- "dddd, dd MMM yyyy HH:mm:ss" - full day name, day abbreviated month name year hour:minute:second
- "dddd, dd MMM yyyy h:mm:ss tt" - full day name, day abbreviated month name year hour:minute:second AM/PM
- "dddd, dd MMM yyyy H:mm:ss" - full day name, day abbreviated month name year hour:minute:second (24-hour format)
- "MM/dd/yyyy hh:mm tt" - month/day/year hour:minute AM/PM
- "MM/dd/yyyy HH:mm" - month/day/year hour:minute (24-hour format)
- "MM/dd/yyyy hh:mm:ss tt" - month/day/year hour:minute:second AM/PM
- "MM/dd/yyyy HH:mm:ss" - month/day/year hour:minute:second (24-hour format)
- "dd-MMM-yyyy hh:mm tt" - day-abbreviated month name-year hour:minute AM/PM
- "dd-MMM-yyyy HH:mm" - day-abbreviated month name-year hour:minute (24-hour format)
- "dd-MMM-yyyy hh:mm:ss tt" - day-abbreviated month name-year hour:minute:second AM/PM
- "dd-MMM-yyyy HH:mm:ss" - day-abbreviated month name-year hour:minute:second (24-hour format)
- "dd MMM yyyy hh:mm tt" - day abbreviated month name year hour:minute AM/PM
- "dd MMM yyyy HH:mm" - day abbreviated month name year hour:minute (24-hour format)
- "dd MMM yyyy hh:mm:ss tt" - day abbreviated month name year hour:minute:second AM/PM
- "dd MMM yyyy HH:mm:ss" - day abbreviated month name year hour:minute:second (24-hour format)
- "dd MMMM yyyy hh:mm tt" - day full month name year hour:minute AM/PM
- "dd MMMM yyyy HH:mm" - day full month name year hour:minute (24-hour format)
- "dd MMMM yyyy hh:mm:ss tt" - day full month name year hour:minute:second AM/PM
- "dd MMMM yyyy HH:mm:ss" - day full month name year hour:minute:second (24-hour format)
- "yyyy-MM-ddTHH:mm:ss" - year-month-day 'T' hour:minute:second (ISO 8601 format)
- "yyyy-MM-ddTHH:mm:ss.fff" - year-month-day 'T' hour:minute:second.milliseconds (ISO 8601 format)
- "yyyy-MM-ddTHH:mm:ss.fffffff" - year-month-day 'T' hour:minute:second.microseconds (ISO 8601 format)
- "yyyy-MM-ddTHH:mm:ss.fffffffff" - year-month-day 'T' hour:minute:second.nanoseconds (ISO 8601 format)
- "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'" - abbreviated day name, day abbreviated month name year hour:minute:second GMT
- "dddd, dd MMMM yyyy HH':'mm':'ss 'GMT'" - full day name, day full month name year hour:minute:second GMT
- "yyyy-MM-ddTHH:mm:ss.ffffffZ" - year-month-day 'T' hour:minute:second.microseconds time zone (ISO 8601 format)
- "yyyy-MM-ddTHH:mm:ss.fffffffZ" - year-month-day 'T' hour:minute:second.nanoseconds time zone (ISO 8601 format)
- "MMMM dd yyyy" - full month name day year
- "dddd, dd MMMM yyyy" - full day name, day full month name year
- "dddd dd MMMM yyyy" - full day name day full month name year
- "dddd, MMMM dd yyyy" - full day name, full month name day year
Note that these format strings can be combined and customized to match your specific needs.
from serilog-ui.
@mo-esmp to reproduce the error change the SQL column datatype for the TimeStamp to datetimeoffset(7)
Then let it log a few events with the datetime offset information
from serilog-ui.
@mo-esmp is there any updates ?
from serilog-ui.
@mo-esmp ?
from serilog-ui.
On the way home, tonight I will fix it, sorry again.
from serilog-ui.
@mo-esmp hi , do you need any help with solving the issue ?
when will the update be avaible ?
from serilog-ui.
If you could send the PR to fix the problem, I would appreciate that and when I have time I take of care it properly. Last night I arrive at 2 AM and am now at work.
from serilog-ui.
@mo-esmp sorry man , i am not valid that much time.
i have already provide a code solution on the comments above.
@mruch2 do you have time to do this?
from serilog-ui.
Related Issues (20)
- Deployed to developent, UI popup "You are not authorized to access logs" HOT 2
- Error Message column does not exist HOT 4
- BUG: when opening properties for the second time, the tags are escaped twice HOT 2
- Consider RavenDB support
- Any support for ColumnOptions? HOT 3
- Fails to insert data into MariaDB HOT 21
- Support provider name customization HOT 1
- UtcTimeStamp instead of TimeStamp in MongoDbDataProvider HOT 2
- Serilog UI version 3 is live!
- The url in v3 should end with a / else a 404 not found is returned HOT 3
- [feat] Auto-expand dropdowns option when opening 'Additional Columns' modal HOT 3
- Opening exception details tries to parse the field as XML rather than string for MSSQL HOT 10
- Exception occur if RemoveStandardColumn = "Properties" HOT 3
- Npgsql DateTime filtering problem HOT 2
- Insert log test data through sinks HOT 1
- When serilog column options properties are removed it does not fetch logs on UI #487 HOT 4
- Using options.Authorization.AuthenticationType = AuthenticationType.Jwt; in api project HOT 13
- When I am using MongoDb Sink provider Exception and properties column not populating in serilog.Ui HOT 8
- Timestamp returned as Jan 1, 1901 0:00:00.000 HOT 29
- XML output isn't rendered correctly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serilog-ui.