Invalid cookie header warnings #1

Closed
Raynes opened this Issue Nov 25, 2010 · 2 comments

Comments

Projects
None yet
2 participants

Raynes commented Nov 25, 2010

I've been using clojure-twitter and clj-oauth to add some twitter support to sexpbot (on the protocols branch). It appears that every time it makes a request, something like this prints:

Nov 24, 2010 10:16:04 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: guest_id=129065856351069239; path=/; expires=Sat, 25 Dec 2010 04:16:03 GMT". Unable to parse expires attribute: Sat, 25 Dec 2010 04:16:03 GMT

Is there any way to suppress these warnings? Or, better yet, am I doing something to cause these warnings?

Raynes commented Nov 26, 2010

After speaking with Matt on IRC, he quickly solved the problem. I just needed to set the logging level. He gave me this snippet for turning the log4j logger off:

 (defn set-log-level!
  ([level]
     (set-log-level! [(org.apache.log4j.Logger/getRootLogger)] level))
  ([loggers level]
     (let [loggers (map (fn [l] (if (string? l)
                                  (org.apache.log4j.Logger/getLogger l)
                                  l))
                        loggers)]
       (doseq [l loggers]
         (.setLevel l (case level
                            :all org.apache.log4j.Level/ALL
                            :debug org.apache.log4j.Level/DEBUG
                            :error org.apache.log4j.Level/ERROR
                            :fatal org.apache.log4j.Level/FATAL
                            :info org.apache.log4j.Level/INFO
                            :off org.apache.log4j.Level/OFF
                            :warn org.apache.log4j.Level/WARN))))))

(set-log-level! :off)

He also provided me with this page: http://www.paullegato.com/blog/setting-clojure-log-level/ which features a set-log-level! function for commons-logging.

gmwils commented Jun 6, 2011

This may provide some more details on the issue: https://issues.apache.org/jira/browse/HTTPCLIENT-1077

I'm not sure turning off the logging is the best approach. It looks like an issue in the HTTP header parser configuration in the Java client. However, according to the ticket, it should be working with http client 4.x, which is what I'm using.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment