Ektron错误日志

Nim*_*mmi 7 ektron

在Ektron中,如何处理错误或异常.有没有办法处理这个?Ektron DB中的任何表都存储错误或异常.我们如何使用类Ektron.Cms.EkException处理事件?

mad*_*xej 6

默认情况下,错误会记录到事件查看器中.在"申请"下


Bis*_*esh 6

您可以使用Ektron.Cms.Instrumentation类中的辅助函数.您需要在配置文件中启用一些设置才能使用这些功能.

Web.config:将LogLevel更新为"4"

<!-- Determines the level of messages that are logged
    1 = Error:  Only Errors are logged.
    2 = Warning:  Only warnings and Errors are logged.
    3 = Information:  Only Informationals, Warnings, and Errors are logged.
    4 = Verbose:  Everything is logged.

    NOTE: you can configure where each message level is logged using the instrumentation.config.
  -->
        <add name="LogLevel" value="4"/>
Run Code Online (Sandbox Code Playgroud)

Instrumentation.config:

将"Trace"添加到"Verbose"

<add switchValue="All" name="Verbose">
  <listeners>
    <add name="Event Log" />
    <add name="Trace" />
  </listeners>
</add>
Run Code Online (Sandbox Code Playgroud)

在配置文件中进行这些更改后,您可以使用帮助程序功能.

例如,

Exception ex = new Exception("Test Exception");

Ektron.Cms.Instrumentation.Log.WriteError(前);

(浏览Ektron.Cms.Instrumentation类以获取更多详细信息)