Re: Debugging lazy seqs with log4j

2011-11-11 Thread Alex Baranosky
You could consider contributing your improvements to the logging library.
On Nov 11, 2011 10:27 AM, "finbeu"  wrote:

> Thanks. I think when I tried it (correct me if I'm wrong) it was not
> possible to set the debug level dynamic. For instance I usually have a port
> where I can send messages to (simple UDP datagram packet), the message
> string is a map which I read-string and eval and upon that event, I reset
> some internal state like debugging or print the state of some objects or
> whatever. Maybe I should invent my own simple messaging system based on
> good old UPD datagram packets :-)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread finbeu
Thanks. I think when I tried it (correct me if I'm wrong) it was not 
possible to set the debug level dynamic. For instance I usually have a port 
where I can send messages to (simple UDP datagram packet), the message 
string is a map which I read-string and eval and upon that event, I reset 
some internal state like debugging or print the state of some objects or 
whatever. Maybe I should invent my own simple messaging system based on 
good old UPD datagram packets :-)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread Sean Corfield
On Fri, Nov 11, 2011 at 9:25 AM, finbeu  wrote:
> yes, when starting my project, I was looking at the logging library which
> resides (resided) in clojure.contrib and I didn't like it at that point in
> time. I think because it was trying to do too many things at once. If my use
> case can be solved with some small java wrappers, I try to do it on my own.

FWIW:

(use 'clojure.tools.logging)
(info (range 4))

happily logs (0 1 2 3) - with tools.logging 0.2.3

Sorry to seem to be belaboring the point but the "standard" logging
library "just works" and handles lazy sequences without needing any
workarounds (unless I'm missing something here?).

The reason I'm pushing on this is that it's entirely possible that a
contrib library wasn't suitable "back then" but things are moving
along pretty well with the modular contrib libraries now and it's
helpful - for all of us - for folks to use those, for a number of
reasons. It avoids reinventing the wheel. It gets more usage of
libraries that we want as robust as possible. If folks don't like the
modular contrib libraries, we need the feedback in the form of JIRA
tickets so that we can improve them - and open discussion on the
lists.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Debugging lazy seqs with log4j

2011-11-11 Thread finbeu
yes, when starting my project, I was looking at the logging library which 
resides (resided) in clojure.contrib and I didn't like it at that point in 
time. I think because it was trying to do too many things at once. If my 
use case can be solved with some small java wrappers, I try to do it on my 
own. This is of course not the case for jdbc where I appreciate java.jdbc 
although I have difficulties using c3p0 with sybase. I will follow up on 
this maybe later).

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread Sean Corfield
On Fri, Nov 11, 2011 at 8:53 AM, finbeu  wrote:
> no, not yet. I stick with my own simple logging ns which works nice so far.
> Just have to fix this ...)

I just wondered whether using a well-maintained "standard" library
might be an easier path than rolling your own...

> (but I use clojure.java.jdbc with Sybase ASE 15.0.3. I hope I will find some
> time soon to contribute some testcases.)

Thank you!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Debugging lazy seqs with log4j

2011-11-11 Thread finbeu
Yes! That's it. With pr-str it works. Thx!! 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread finbeu
Hi Sean

no, not yet. I stick with my own simple logging ns which works nice so far. 
Just have to fix this ...)

(but I use clojure.java.jdbc with Sybase ASE 15.0.3. I hope I will find 
some time soon to contribute some testcases.)

Finn

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread Meikel Brandmeyer (kotarak)
Hi,

what happens is probable that the logger tries to turn the lazy seq object 
itself into a string. Try calling pr-str on the seq before passing it to 
debug: (debug (pr-str your-seq-object)).

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Debugging lazy seqs with log4j

2011-11-11 Thread Sean Corfield
Have you tried clojure.tools.logging to see whether you get the same behavior?

On Fri, Nov 11, 2011 at 8:15 AM, finbeu  wrote:
> Hello,
> I'm using log4j and have some a simple wrappers in clojure that work well so
> far.
> Actually, I do
> (def *logger* (Logger/getRootLogger))
>
> Then I set loglevel, appenders, layout and so on.
> I have a function
> (defn debug [msg]
>  (.debug *logger* msg)
> This works nice as long as I do not try to log a lazy sequence. Instead, the
> string clojure.lang.LazySeq@hdk73gdf9 gets logged instead of the content.
> How can I enforce logging of a lazy sequence? I tried to wrap it with doall
> but it has no effect.
> Thx.
> Finn

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en