kstyrc / embedded-redis

Redis embedded server for Java integration testing
854 stars 371 forks source link

Logs for redis server #17

Closed enisher closed 9 years ago

enisher commented 9 years ago

Now logs of embedded server goes to nowhere. It is very inconvenient, when some issues come up you can't check redis logs to figure out what is the cause.

Running the server with command line argument that specifies path to log is not an option because in this case it doesn't send log to system output, but RedisServer expect logs there to check if it has been activated.

kstyrc commented 9 years ago

Good idea!

My proposal is to make logs on system output as well as log file. Any idea how to integrate it into fluent API?

kstyrc commented 9 years ago

Maybe:

RedisServer redisServer = RedisServer.builder() .executable("/path/to/your/redis") .port(6379) .slaveOf("locahost", 6378) .configFile("/path/to/your/redis.conf") .withLogging('/path/to/redis.log') .build();

kstyrc commented 9 years ago

I've seen that @magro has some really contributions in his latest commits: https://github.com/magro/embedded-redis

@magro How about merging them?

magro commented 9 years ago

@kstyrc I'd need to clean up the commit because it was work in progress (actually some months old, I now only committed/pushed it to share it with someone else). Not sure what's exactly part of the commit, is there anything you find particularly interesting?

kstyrc commented 9 years ago

@enisher would like to preserve redis logs after test execution in order to investigate when they fail. A short look through your branch suggests that you implemented it via redirect of STDOUT to a file.

In general, I plan 0.4 release with the following improvements: 1) redis execution logs available via fluent api (explained above) 2) write test against a couple of different redis version (for sure major 2.6, 2.8, 3.0, as well as some minor?) 3) distribute in a couple of separate jars: embedded-redis-base - does not contain redis executable embedded-redis_2.6 embedded-redis_2.8 embedded-redis_3.0

magro commented 9 years ago

@kstyrc Ah, I already forgot this, too long ago :-) Of course you can pick relevant parts as you like, not sure when I'd find time to prepare a good pull request.

kstyrc commented 9 years ago

embedded-redis v0.4 logs errorStream from redis to System.out. Would it help to add possibility to log to a file? How about many redis instances? Separate files?