在Ektron中,如何处理错误或异常.有没有办法处理这个?Ektron DB中的任何表都存储错误或异常.我们如何使用类Ektron.Cms.EkException处理事件?
您可以使用Ektron.Cms.Instrumentation类中的辅助函数.您需要在配置文件中启用一些设置才能使用这些功能.
Web.config:将LogLevel更新为"4"
Run Code Online (Sandbox Code Playgroud)<!-- 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"/>
Instrumentation.config:
将"Trace"添加到"Verbose"
Run Code Online (Sandbox Code Playgroud)<add switchValue="All" name="Verbose"> <listeners> <add name="Event Log" /> <add name="Trace" /> </listeners> </add>
在配置文件中进行这些更改后,您可以使用帮助程序功能.
例如,
Exception ex = new Exception("Test Exception");
Ektron.Cms.Instrumentation.Log.WriteError(前);
(浏览Ektron.Cms.Instrumentation类以获取更多详细信息)