What is a good way to handle slf4j in a web application deployed in Glassfish 3.0.1?

I have a pretty ordinary web application that logs in using slf4j, which is great, and I used several slf4j blends without any problems.

Under Tomcat, I just told logback to specify a location in the file system and register there, but now I want to deploy several independent instances of this application each in my own domain in one instance of Glassfish 3.0.1, and I have now discovered that I would like to so that my slf4j magazine works well with Glassfish.

What would be a good way (I dare say “better”) for my magazine to take care of Glassfish. Should I just flatten my logs on System.out with logback and let Glassfish handle console output or is there a better standard way to access loggers inside Glassfish?


EDIT: The study showed that GlassFish 3.0.1 provides neither the SLF4J API nor the binding in the classes visible to the JSP page with the default configuration.

By providing slf4j-api-X.jar and slf4j-jdk14-X.jar, slf4j-logging events are forwarded to java.util.logging, which Glassfish correctly captures (see http://docs.sun.com/app/docs/ doc / 820-7692 / abluj? l = en & a = view ).

+3
1

, GlassFish 3.0.1 API SLF4J, , JSP- .

slf4j-api-X.jar slf4j-jdk14-X.jar, slf4j-logging java.util.logging, Glassfish (. http://docs.sun.com/app/docs/doc/820-7692/abluj?l=en&a=view).

. Glassfish .

+1

Source: https://habr.com/ru/post/1766949/


All Articles