Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Java Interop by

How to convert below java code to clojure?

java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger(.class.getName());

1 Answer

+2 votes

You'll probably find it easier to simply use https://github.com/clojure/tools.logging which is a wrapper for all the Java logging stuff.

Thank you for your response.
Currently we have used tools.logging, but due to other dependencies like slf4j/log4j in the whole project it doesn't honour our util logging which we use across the project. And moreover we can not apply package level logging at runtime by using tools.logging which we use for our other java modules. So to accomplish both these problems I am looking at directly using java.util.logging instead of closure/tools.logging.

Thanks in advance for your help on converting Java code to clojure.
Fair enough.

The code you want is just:

(java.util.logging.Logger/getLogger (.getName class))

If you're having problems converting simple pieces of code like that, you probably ought to get on the Clojurians Slack and ask in the #beginners channel as you need help with each piece of code -- lots of people there are happy to help, in real-time, pretty much 24x7.

https://clojurians.slack.com/ -- sign up at http://clojurians.net/
Thank you. sure will follow that.