Logging with slf4j, and 'logback', but not creating specified log file which is in configuration. (using maven, jetty) -
As specified in the title I am using Maven, and JTL using SLF4J and logback to logging my There is 'logback.xml' on the pass 'src / main / resources'.
& lt; Configuration & gt; & Lt; Appender name = "STDOUT" class = "ch.qos.logback.core.ConsoleAppender" & gt; & Lt; Layout class = "ch.qos.logback.classic.PatternLayout" & gt; & Lt; Pattern & gt;% - 4relative [% Thread]% -5 Level% Category -% Message% n & lt; / Pattern & gt; & Lt; / Layout & gt; & Lt; / Appender & gt; & Lt; Appender name = "FILE" class = "ch.qos.logback.core.FileAppender" & gt; & Lt; Layout class = "ch.qos.logback.classic.PatternLayout" & gt; & Lt; Pattern & gt;% - 4relative [% Thread]% -5 Level% Category -% Message% n & lt; / Pattern & gt; & Lt; / Layout & gt; & Lt; File & gt; MyLog.log & lt; / File & gt; & Lt; / Appender & gt; & Lt; Logger name = "org.mortbay" & gt; & Lt; Level value = "debug" /> & Lt; / Logger & gt; & Lt; Root & gt; & Lt; Level value = "error" /> & Lt; Appender-Riffe = "STDOUT" /> & Lt; Epander-Reef Ref = "FILE" /> & Lt; / Root & gt; & Lt; / Configuration & gt; But my problem is that if I run / debug the project, then 'myLog.log' is not making the file. What is the solution to getting the log file
Is there a way to get the log file with SLF4J only?
Sorry! I misread the use of 'logback'. I got the solution
i.e.
It seems that you misunderstood the purpose of SLF4J if you are located at slf4j-jdk14-1.5.6.jar then slf4j-api will be bound with java.util.logging. The logback will not be used. Only if you put the logback-core.jar and lockback-classic.jar on your square path (but not slf4j-jdk14-1.5.6.jar), the lockback will slip the SLF4J API. The SLF 4J binds with one and only the built-in logging API (per JVM launch).
hh,
Thanks to Seki Gulu, now I can get a log in my file.
Comments
Post a Comment