如何从标准ServiceStack错误respose取出堆栈跟踪 [英] How to remove the stacktrace from the standard ServiceStack error respose

查看:137
本文介绍了如何从标准ServiceStack错误respose取出堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始接触ServiceStack,我想看看是否有可能从标准错误响应删除堆栈跟踪。

I'm just getting started with ServiceStack, and I'd like to find out if it's possible to remove the stacktrace from the standard error response.

我已经试过关掉debugmode没有任何的运气:

I have tried shutting off debugmode without any luck:

public override void Configure(Funq.Container container)
{
    SetConfig(new EndpointHostConfig { DebugMode = false, });
}

感谢一大堆!

Thanks a bunch!

推荐答案

在默认情况下只以下的配置中删除的堆栈跟踪:

By default the configuration below only removes the StackTrace from being externally visible in your Web Service's response:

SetConfig(new EndpointHostConfig { DebugMode = false, });

我又测试了这一点,它按预期工作。

I've tested this again and it works as expected.

要禁用日志记录都在一起,你可以设置 ServiceStack 使用NullLogFactory

To disable Logging all together you can set ServiceStack to use a NullLogFactory

LogManager.LogFactory = new NullLogFactory();

另外,您可以通过创建自己的 ServiceStack.Logging 适配器设置它以同样的方式:

Alternatively you can control the granularity of all logging by creating your own ServiceStack.Logging adapter and setting it in the same way:

LogManager.LogFactory = new MyCustomLogFactory();

这篇关于如何从标准ServiceStack错误respose取出堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆