Paul Batum
Paul Batum

Reputation: 8415

How to view executed redis commands in ServiceStack.Redis?

I'd like to better understand what ServiceStack.Redis is doing under the hood. My hope was that I could hook up a debug/console logger and it would just output the executed commands to that logger, but I haven't been able to find the appropriate API. I did find several references to using LogManager.LogFactory = new DebugLogFactory but even after doing this nothing from ServiceStack appears in my debug output.

I also tried using the MONITOR command from the redis-cli but there seems to be some problem with it when using the windows port of redis as it gives me the following error: (error) ERR unknown command 'monitor'.

Upvotes: 0

Views: 1044

Answers (3)

Paul Batum
Paul Batum

Reputation: 8415

I was able to get ServiceStack to output the redis commands it was executing by calling LogManager.LogFactory = new DebugLogFactory(debugEnabled:true) where DebugLogFactory was not the built in one provided by ServiceStack, but a copy of the factory and associated logger from here. This step was necessary because the release builds of ServiceStack (i.e. what you can get on NuGet) will not emit the debug information.

Upvotes: 1

Jeff Mitchell
Jeff Mitchell

Reputation: 1479

What version of MSOpenTech Redis are you running? I just grabbed 2.8.9, and monitoring is working.

On a side note, if you're interested in how ServiceStack implements specific commands, it might be worthwhile to browse around the source. On low level, ServiceStack has a byte client that implements Redis commands in a 1:1 fashion. The various clients and typed clients are built on top of that. For reference

Upvotes: 1

Related Questions