nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 305 forks source link

Logging Not Working #65

Closed razzam21 closed 10 years ago

razzam21 commented 11 years ago

{ "redis_host": "127.0.0.1", "redis_port": 6379, "redis_auth": null, "http_host": "192.168.0.110", "http_port": 7369, "threads": 1, "pool_size": 10, "daemonize": true, "websockets": false, "database": 0, "acl": [ { "disabled": ["DEBUG"] }, { "http_basic_auth": "user:password", "enabled": ["DEBUG"] } ], "verbosity": 0, "logfile": "/var/log/webdis/webdis.log" }

The directory permissions as set to 777 and the log file permissions are set to 777. I also tried different numbers in verbosity. And no luck. Any ideas what I am doing wrong?

I cloned the git repository and compiled the code on my server. It runs but just doesn't log. I am having some issues and logging would be a huge help.

nicolasff commented 11 years ago

Hello Eric,

You need to set the verbosity to 1 at the minimum. 0 filters everything out.

(edit) - When changing the verbosity, you also need to restart webdis for the changes to be taken into account.

razzam21 commented 11 years ago

I have tried 1 in the verbosity and I still don't seem to get any logs.

nicolasff commented 11 years ago

I have changed the logging code to print an error message to stderr when the file can't be opened (e.g. "Permission denied"). That said, webdis already uses stderr when the log file can't be opened. Are you using daemonize: true by any chance? That would explain why you don't see anything since that means stdout and stderr are closed after calling fork().

It'd be great if you could try this fix and report what webdis prints out as the error.

Thanks!

razzam21 commented 11 years ago

I checked out the updated code, recompilted it. Turned off daemoize. I tried running if from my script and directly and still nothing. I also tried changing the verbosity to (0,1,2,3,4) and each resulted in nothing being logged.

Thanks.

nicolasff commented 11 years ago

@razzam21 is the file created?

Note that webdis doesn't immediately log messages at startup. Try setting a verbosity to 4 and running curl http://localhost:7379/PING and tail the log file, you should see two lines printed.

razzam21 commented 11 years ago

I am able to get the system to give me feedback. However it only occurs on the thread that starts it and not to the logfile. I tried piping it to a file when the service starts but that didn't work. I verified the file and directory are created and both have permissions of 777.

Thanks for your help.

nicolasff commented 11 years ago

Try using ./webdis 2&>logfile to redirect stderr messages.

razzam21 commented 11 years ago

Thank you. It is going into the log file now. Is there any more details that I can get about the request. Is 4 the most detailed or is there more detail will a different number?

The reason I have been asking these questions is we have a product that can only communicate to an external system is though http. By using webdis I can simplify the process by posting directly to redis and let it act like a queue. However the post isn't working properly and I need to debug what is happening. The response I am getting back in the other program seems to be acting like an encoding issue. However if I post the url from the other program directly into a browser it does what it is suppose to. So more detail on what webdis is getting/doing is the next step to look at.

nicolasff commented 11 years ago

4 is the most detailed, yes. In addition to webdis, you can debug what's happening in a Redis process using the MONITOR command, too.

wiwat-tharateeraparb commented 9 years ago

Does Webdis log any PUBLISH command?

wiwat-tharateeraparb commented 9 years ago

Seems like it does not log POST method, only GET.