关闭ServiceStack日志记录

时间:2013-09-03 17:43:20

标签: c# log4net servicestack

ServiceStack的内部日志记录不是我希望在日志中使用的内容。我们如何禁用内部日志记录,或至少抑制它以使其不会阻塞日志?

2 个答案:

答案 0 :(得分:4)

配置LogManager时,只需将其设置为NullLogFactory

的实例
LogManager.LogFactory = new NullLogFactory();

答案 1 :(得分:1)

ServiceStack Ver 5 >

SetConfig(new HostConfig {
            DefaultRedirectPath = "/metadata",
            DefaultContentType = MimeTypes.Json,
            AppendUtf8CharsetOnContentTypes = new HashSet<string> { MimeTypes.Html, MimeTypes.Json },
            DebugMode = false,
            LogFactory = new NullLogFactory(),
            EnableFeatures = Feature.All.Remove(disableFeatures)
)