LoggerContext now has a method called reset() which can be called multiple times. There is also a LoggerContext.stop() method which is permanent.
On 10.03.2010 14:34, Federico Schroder wrote:
I switched to the latest version of logback and everything is working now. I have a minor issue now. The project uses the classes from a previous (rather old) thread which, notably it.stratosfera.commons.logback.LogbackConfigurer which invokes context.shutdownAndReset() a number of times. I see that that method is no longer available in the API. Is there a replacement or is the shutdown no longer needed? Thanks for your help, Federico
On Wed, Mar 10, 2010 at 9:23 AM, Federico Schroder <[email protected] <mailto:[email protected]>> wrote: I have the following files in the classpath: logback-classic-0.9.9.jar logback-core-0.9.9.jar jcl-over-slf4j-1.5.10.jar log4j-over-slf4j-1.5.10.jar slf4j-api-1.5.10.jar and javamail-1.4.3.jar activation-jaf-1.1.1.jar Here is the whole file: <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <appender name="mainFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>${webapp.root}/WEB-INF/semplest-main.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>${webapp.root}/WEB-INF/semplest-main.%d{yyyy-MM-dd}.log</FileNamePattern> <!-- keep 90 days' worth of history --> <MaxHistory>90</MaxHistory> </rollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern> </layout> </appender> <appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>${webapp.root}/WEB-INF/semplest-error.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>${webapp.root}/WEB-INF/semplest-error.%d{yyyy-MM-dd}.log</FileNamePattern> <!-- keep 90 days' worth of history --> <MaxHistory>90</MaxHistory> </rollingPolicy> <!-- deny all events with a level below ERROR --> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>ERROR</level> </filter> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern> </layout> </appender> <!-- NOT WORKING --> <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <SMTPHost>smtp.gmail.com <http://smtp.gmail.com></SMTPHost> <SMTPPort>465</SMTPPort> <SSL>true</SSL> <Username>[email protected] <mailto:[email protected]></Username> <Password>xxx</Password> <To>[email protected] <mailto:[email protected]></To> <From>[email protected] <mailto:[email protected]></From> <Subject>SEMPLEST ERROR: %class{20} - %m</Subject> <!-- deny all events with a level below ERROR --> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>ERROR</level> </filter> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern> </layout> </appender> <!-- --> <logger name="com.semplest"> <level value="INFO" /> </logger> <root> <level value="WARN" /> <appender-ref ref="mainFile" /> <appender-ref ref="errorFile" /> <appender-ref ref="email" /> </root> </configuration> Thanks, Federico On Wed, Mar 10, 2010 at 4:41 AM, Ceki Gülcü <[email protected] <mailto:[email protected]>> wrote: The config file snippet looks good. I really don't see how the error you are seeing could occur. Which version of logback are you using? You could you also provide the whole config file? On 10/03/2010 12:56 AM, Federico Schroder wrote: Hello, I'm having problems trying to use the gmail example provided here: http://logback.qos.ch/manual/appenders.html My config is: ... <appender name="email" class="ch.qos.logback.classic.net.SMTPAppender"> <SMTPHost>http://smtp.gmail.com</SMTPHost> <SMTPPort>465</SMTPPort> <SSL>true</SSL> <Username>[email protected] <mailto:[email protected]></Username> <Password>xxx</Password> <To>[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>></To> <From>[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>></From> <Subject>APP ERROR: %class{20} - %m</Subject> <!-- deny all events with a level below ERROR --> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>ERROR</level> </filter> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern> </layout> </appender> ... ... and I'm getting this in the log: 19:41:03,031 |-ERROR in ch.qos.logback.core.joran.spi.interpre...@38:16 - no applicable action for [SMTPPort], current pattern is [[configuration][appender][SMTPPort]] 19:45:30,244 |-ERROR in ch.qos.logback.core.joran.spi.interpre...@39:11 - no applicable action for [SSL], current pattern is [[configuration][appender][SSL]] 19:45:40,367 |-ERROR in ch.qos.logback.core.joran.spi.interpre...@40:16 - no applicable action for [Username], current pattern is [[configuration][appender][Username]] 19:45:40,740 |-ERROR in ch.qos.logback.core.joran.spi.interpre...@41:16 - no applicable action for [Password], current pattern is [[configuration][appender][Password]] Any suggestion on what could be wrong? Thanks, Federico _______________________________________________ Logback-user mailing list [email protected] <mailto:[email protected]> http://qos.ch/mailman/listinfo/logback-user _______________________________________________ Logback-user mailing list [email protected] http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list [email protected] http://qos.ch/mailman/listinfo/logback-user
