
Hi Sotirios, In your servlet code you are logging at debug level. In your junit test case you are logging at error level. The log back configuration create a logger at info level. This explains why the error log message gets to the log and not the debug log message gets to the log. Happy to help, Brett On 12/03/2012, at 9:59 AM, "Sotiris Delimanolis" <sotodel_89@hotmail.com<mailto:sotodel_89@hotmail.com>> wrote: Hi, I'm developing a Java web application through Tomcat with Java servlets. In my constructor for one servlet I call the following code: public MyServlet () { // Initialise the logger logger = (Logger)LoggerFactory.getLogger("application"); logger.debug("Starting application"); } My logback.xml configuration file is the following: <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>application.log</file> <append>true</append> <encoder> <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n </pattern> </encoder> </appender> <logger name="application" level="INFO"> <appender-ref ref="FILE" /> </logger> </configuration> When I launch the web app, the constructor is called by Tomcat, which should run the above code, but no file ("application.log") is created and no output is done anywhere. Within the same project, I try to test the Logger. In a junit test I have the following: public class TestLogging extends TestCase { public void testApplicationLogger() { // Initialise the logger Logger logger = (Logger)LoggerFactory.getLogger("application"); logger.error("Starting application"); } } This generates a file, a outputs "201 [main] ERROR application - Starting application" Why can't I get the logger to output anything from the servlet? Regards, Sotirios _______________________________________________ Logback-user mailing list Logback-user@qos.ch<mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user