Peter:

I recommend pages 60-62 in Stuart's book for demonstrating how to do
this. The notes about (. Math PI) or Math/PI (equivalent notations)
are very much to point.

To demonstrate:

;first the import
user=> (import '(java.util.logging Logger Level))
nil

;create a logger
user=> (def our-logger (. Logger getLogger ""))
#'user/our-logger


;set the level
user=> (. our-logger setLevel Level/WARNING)
nil

;check
user=> (. our-logger getLevel)
#<Level WARNING>

I only knew where to look because as a java-slinging N00B myself, I
had many questions about java interop.

Dan



On Nov 24, 1:39 pm, Peter Wolf <opus...@gmail.com> wrote:
> Hi all,
>
> Here is a N00B question, but I can not find the answer by Googling, or
> reading Stuart's book.  So, I assume that others will want to find this
> FAQ in the future.
>
> I am calling legacy code, and I need to set the level on the Java Logger.
>
> In Java it would look like this
>
>    import java.util.logging.Logger
>    import java.util.logging.Level
>
>    Logger.getLogger("").setLevel(Level.WARNING)
>
> What is the Clojure equivalent?  In particular, what is the equivalent
> of Level.WARNING?
>
> Level.WARNING is a static field of Level, and is an instance of Level.  
> There is no getter method.  I can't find anything about accessing static
> fields in the docs.
>
> Thanks in advance
> Peter

-- 
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

Reply via email to