[logback-user] Hi

Navin Math hinavinmath at gmail.com
Fri Jan 13 14:25:04 CET 2017


Hi Guys

This is my conf file for logging in the app. In my java application, I want
to display the exceptions in the file.
What are the changes required in the following configuration to display all
the e.printStackTrace() from the exception block whenever I get exception
in my Java program instead of displaying it on the console.


<configuration>

  <conversionRule conversionWord="coloredLevel"
converterClass="play.api.Logger$ColoredLevel" />

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%coloredLevel - %logger - %message%n%xException</pattern>
    </encoder>
  </appender>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
     <file>${application.home}/logs/play.log</file>
     <encoder>
       <pattern>%date [%level] from %logger in %thread -
%message%n%xException</pattern>
     </encoder>
  </appender>

 <logger name="play" level="INFO" />
  <logger name="application" level="DEBUG" />

  <logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
  <logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader"
level="OFF" />
  <logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread"
level="OFF" />
  <logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF" />

  <root level="ERROR">
    <appender-ref ref="STDOUT" />
  </root>
  <root level="ERROR">
    <appender-ref ref="FILE" />
  </root>

  <logger name="INFO" level="INFO">
        <appender-ref ref="FILE" />
  </logger>

</configuration>


Thanks
Math


On Fri, Jan 13, 2017 at 6:48 PM, Navin Math <hinavinmath at gmail.com> wrote:

> Can I ask my questions here?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20170113/11177018/attachment.html>


More information about the logback-user mailing list