Re: Not seeing Faye internal processing/handling messages being logged

215 views
Skip to first unread message

James Coglan

unread,
Jan 10, 2014, 6:22:57 PM1/10/14
to faye-...@googlegroups.com
On 10 January 2014 14:06, San M. <soulsin...@gmail.com> wrote:
My apologies if this is a duplicate post. I'm new to the Faye users group. When I posted my first topic, I expected to get a "Post Pending" (if moderated group)
confirmation page or immediately see my post (if unmoderated group) appear in the group. Since neither result occurred, I'm sending post again.

Sorry about that, Google Groups mistakenly marked your post as spam. New posts don't usually require moderation.
 
   curl -d http://localhost:9292/faye 'message={channel:"/foo",data:"hello"}'

This is not a valid request, both because you're passing the URI to the -d option and because the JSON is invalid. Try this:

curl -X POST http://localhost:9292/faye -H 'Content-Type: application/json' -d '{"channel":"/foo","data":"hello"}' 
 
logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG
Faye.logger = logger

I've tried adding these lines to the Faye example server and they do cause logs to be emitted. 

San M.

unread,
Jan 13, 2014, 10:24:30 AM1/13/14
to faye-...@googlegroups.com
James,

Thanks for detecting that my post was treated as spam and getting it posted to the group.

Thanks for the corrected usage of the curl command.

I'm still not able to see Faye internal message logs on my Centos VM that is  located on our private work network,
I will verify the Faye (believe it's 0.8.9) and Thin versions we're using. Being it's a private network not connected
to the public Internet, are there other configuration concerns (proxies, firewalls, closed ports, etc.) that
might hinder Faye message logging?

On my home Windows 7 laptop connected to Internet via Verizon FIOS wireless router, I set-up Ryan Bate's Railscast
Episode-260 Faye Messaging Chat example application (http://railscasts.com/episodes/260-messaging-with-faye)
and was able to see the Faye internal messages logging upon starting the server. Also getting explicit logger.info
messages I put in the handshake/subscribe/unsubscribe monitoring callbacks in faye.ru. Hence the reason
I wonder if something about the network setup at work and/or Faye/Thin versions/configuration used in that
environment is causing the logging not the happen. I will setup Ryan's app at work today and see I can
get the logging working.

I also tried the curl command you provided below from my Windows 7 laptop (with and without 'message=' on the -d option as shown
below), but Faye raises a "Bad Request" error.  I saw in another Faye users post, you mentioned the issue in
https://github.com/faye/faye/issues/143. I wonder if perhaps my Verizon FIOS router is using a proxy that doesn't handle
Websocket requests and is changing the request to be GET with a message param.  I'm using Faye ruby server.
How would I confirm the source of these "Bad Request" errors?


curl -X POST http://localhost:9292/faye -H 'Content-Type: application/json' -d {"channel":"'/foo","data":"hello"}'

curl -X POST http://localhost:9292/faye -H 'Content-Type: application/json' -d 'message={"channel":"/foo","data":"hello"}'

Thanks again for your help.

James Coglan

unread,
Jan 13, 2014, 12:05:47 PM1/13/14
to faye-...@googlegroups.com
On 13 January 2014 15:24, San M. <soulsin...@gmail.com> wrote:
How would I confirm the source of these "Bad Request" errors?

In rack_adapter.rb in the Faye gem, you'll find code that issues 'Bad request' when it catches various errors. Try inserting code around that to see what's could on as the request is being processed.

I've no about the logging thing, other than try trying different Logger implementations to see if they work or not. `Faye.logger = Logger.new(STDOUT)` should just write directly to standard output. 
Message has been deleted

San M.

unread,
Jan 14, 2014, 7:30:15 AM1/14/14
to faye-...@googlegroups.com
I figured out any posts/replies from my work computer is treated as spam and auto-deleted from topic.
So I must post/reply from home computer.

Thanks for the info on adding logic in rack_adapter.rb should I wish to troubleshoot curl "Bad request" behavior.

Good news: I am finally able to get server logging working on my project at work!! Since we're using Faye 0.8.9,
                   I had to use the older Faye::Logging.log_level method to enable server logging.  At home, I use
                   Faye 1.0.1 which requires the Logger object method introduced in Faye 1.0.0.

FYI:        I'd read the 2011 post in this group (https://groups.google.com/forum/#!topic/faye-users/yWZYL_6B3jk)
              where you indicated the Faye::Logging.log_level usage, then mentioned the Logger object usage in a
             12/14/2013 reply within that same post. So, I'd simply followed the latest usage without consideration
              for the Faye versions. I'd read the blog announcing Faye 1.0 (https://blog.jcoglan.com/2013/10/01/announcing-faye-1-0/)
              and didn't see a reference to the new method for enabling server logging. Finally, I just compared the
              Faye 0.8.9 and 1.0.0 logging.rb source to verify when the change occurred.
             
How to Enable Server Logging (prior to Faye 1.0.0):

Faye::Logging.log_level = :debug
Faye.logger = lambda { |m| puts m }

How to Enable Server Logging (since Faye 1.0.0)


logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG
Faye.logger = logger


Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages