RedisRequestLogger无法正常工作

时间:2015-07-14 23:33:23

标签: logging service servicestack

我已将RequestLogger添加到我的服务代码中以启用日志记录。它运作良好

    Plugins.Add(new RequestLogsFeature());

现在我用RedisRequestLogger替换它。现在日志记录不起作用。 我不确定RedisRequestLogger无法正常工作

          Plugins.Add(new RequestLogsFeature
        {
            RequestLogger = new RedisRequestLogger(
                container.Resolve<IRedisClientsManager>(), capacity: 1000)
        });

2 个答案:

答案 0 :(得分:1)

The issue was due to snake case I was using in the code I added the following JsConfig.PropertyConvention = PropertyConvention.Lenient;to AppHost.cs and it worked

答案 1 :(得分:0)

RedisRequestLogger需要配置IRedisClientsManager,例如:

container.Register<IRedisClientsManager>(c => 
    new RedisManagerPool(redisConnectionString));

redisConnectionString对可访问的主 redis-server Redis connection string

在注册RequestLogsFeature插件一次后,这将是有效的,我,e:

Plugins.Add(new RequestLogsFeature {
    RequestLogger = new RedisRequestLogger(
        container.Resolve<IRedisClientsManager>(), capacity: 1000)
});

如果您未在/requestlogs看到任何请求记录,请检查?debug=requestinfo是否有任何启动错误。如果没有使用 redis-cli.exe 连接到上面配置的相同Redis主机(来自托管Web应用程序的同一服务器)并检查它是否连接以及{已创建并填充了{1}}排序集。