- NLog.config: exception layout 从 format=Message 改为 format=toString 原配置只渲染外层异常 Message,不递归 InnerException。DbUpdateException 外层 Message 永远是 "See the inner exception for details.",真正的 SQL 错误(主键冲突/字段超长/外键约束)全在 InnerException 里被吞掉。 改为 toString 后输出完整异常链(含 InnerException + 堆栈),全局生效。 - SwapTrade2Controller.tradeEditJson catch 块对齐其他 Controller: e.Message → e.GetBaseException().Message,并补上 e.ToJson() 数据参数, 让前端也能拿到最内层错误信息。 验证:dotnet build 0 错误
22 lines
908 B
XML
22 lines
908 B
XML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
|
autoReload="true"
|
|
throwExceptions="false"
|
|
internalLogLevel="Off" internalLogFile="c:\nlog\internal.log">
|
|
|
|
<targets>
|
|
<!---Debug日志-->
|
|
<target name="debug" xsi:type="Console" layout="${longdate}|${logger}|${uppercase:${level}}[${threadid}]|${message};${exception:format=toString}" />
|
|
|
|
<target xsi:type="Console" name="lifetimeConsole" layout="${MicrosoftConsoleLayout}" />
|
|
</targets>
|
|
|
|
<rules>
|
|
<logger name="Microsoft.Hosting.Lifetime" minlevel="Debug" writeTo="lifetimeConsole" final="true" />
|
|
<logger name="Microsoft.AspNetCore.*" minlevel="Info" final="true" />
|
|
|
|
<logger name="*" minlevel="Info" writeTo="debug" />
|
|
</rules>
|
|
</nlog> |