Skip to content

Commit ed95bb2

Browse files
author
283591387@qq.com
committed
修复日志文件在小程序上异常的问题
1 parent 6330f5c commit ed95bb2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.Net6版本/VOL.Core/Services/Logger.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ public static void SetServicesInfo(Sys_Log log, HttpContext context)
230230
log.ServiceIP = context.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + context.Connection.LocalPort;
231231

232232
log.BrowserType = context.Request.Headers["User-Agent"];
233+
if (log.BrowserType.Length > 190)
234+
{
235+
log.BrowserType = log.BrowserType.Substring(0, 190);
236+
}
233237
if (string.IsNullOrEmpty(log.RequestParameter))
234238
{
235239
try

Vue.Net/VOL.Core/Services/Logger.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ public static void SetServicesInfo(Sys_Log log, HttpContext context)
230230
log.ServiceIP = context.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + context.Connection.LocalPort;
231231

232232
log.BrowserType = context.Request.Headers["User-Agent"];
233+
if (log.BrowserType.Length>190)
234+
{
235+
log.BrowserType = log.BrowserType.Substring(0, 190);
236+
}
233237
if (string.IsNullOrEmpty(log.RequestParameter))
234238
{
235239
try

开发版dev/Vue.NetCore/Vue.Net/VOL.Core/Services/Logger.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ public static void SetServicesInfo(Sys_Log log, HttpContext context)
230230
log.ServiceIP = context.Connection.LocalIpAddress.MapToIPv4().ToString() + ":" + context.Connection.LocalPort;
231231

232232
log.BrowserType = context.Request.Headers["User-Agent"];
233+
if (log.BrowserType.Length>190)
234+
{
235+
log.BrowserType = log.BrowserType.Substring(0, 190);
236+
}
233237
if (string.IsNullOrEmpty(log.RequestParameter))
234238
{
235239
try

0 commit comments

Comments
 (0)