Debug messages in NGINX Clojure framework

200 views
Skip to first unread message

vikrant singh

unread,
May 4, 2015, 6:44:13 PM5/4/15
to nginx-...@googlegroups.com
Hello,
I am invoking a java handler using nginx-clojure framework.  TO debug some of the issue I want to instrument the binary with some debug logs. I was wondering how I can enable the same. 
Following is what I have tried till now...

Have following in config file...
jvm_options "-Dnginx.clojure.logger.level=debug";

And writing logs like this in my  code...

  if (NginxClojureRT.log.isDebugEnabled()) {$
      NginxClojureRT.log.debug("vikrant testing = %s", uri);$
   }$

But is not really writing anything in code. I suspect that Iam not looking at the right place, or I do not have the correct configuration in place.
Can you please adivse how I should proceed in this case?

Thanks,
Vikrant

Yuexiang Zhang

unread,
May 4, 2015, 9:03:06 PM5/4/15
to vikrant singh, nginx-...@googlegroups.com
Hi,

We can use any logging framework with nginx-clojure, e.g. slf4j + logback,  please check here http://nginx-clojure.github.io/more.html#37--about-logging .

If we only want to debug with it. Please try this way :

(1) enable jvm debug

worker_processes  1;

http { 
    ...........
    jvm_options "-Xdebug";
    jvm_options "-Xrunjdwp:server=y,transport=dt_socket,address=8401,suspend=n";

}


(2)  Debug with your IDE e.g. Eclipse


Now we can set break point and watch all variables in the stack context.


Regards.
Xfeep



--
You received this message because you are subscribed to the Google Groups "Nginx-Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginx-clojur...@googlegroups.com.
To post to this group, send email to nginx-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nginx-clojure/47f61267-77fb-46ae-b765-ed2665158152%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yuexiang Zhang

unread,
May 4, 2015, 9:11:34 PM5/4/15
to vikrant singh, nginx-...@googlegroups.com
And debug with IntelliJ IDEA is just like this link 


.

vikrant singh

unread,
May 5, 2015, 12:45:08 PM5/5/15
to nginx-...@googlegroups.com, vikrant...@gmail.com
thank you very much for your reply... I will start working on these guidlines.
Regards,
Vikrant

xfeep

unread,
Aug 15, 2015, 9:38:08 AM8/15/15
to Nginx-Clojure, vikrant...@gmail.com
Hi,

Since v0.4.1 we can use a embedding nginx-clojure to debug our nginx handler quite easily.

viz. Start our nginx handler in a stardard clojure/java/groovy application.

More details can be found here http://nginx-clojure.github.io/embed.html .

Regards.
xfeep
Reply all
Reply to author
Forward
0 new messages