Note that there are some explanatory texts on larger screens.

plurals
  1. POPlay 2.1.1: Use Logback Evaluators in application-logger.xml
    primarykey
    data
    text
    <p>I am using in Play 2.1.1 for my project a custom logging configuration. Therefor I created a application-logger.xml in the conf directory. This works like a charm.</p> <p>Now I wanted to add a logback evaluator (based on the official doc: <a href="http://logback.qos.ch/manual/layouts.html#Evaluators" rel="nofollow">http://logback.qos.ch/manual/layouts.html#Evaluators</a>) to the logging configuration file to output the %caller information only in specific cases:</p> <pre><code>&lt;configuration&gt; &lt;evaluator name="DISP_CALLER_EVAL"&gt; &lt;expression&gt;logger.contains("a specific string")&lt;/expression&gt; &lt;/evaluator&gt; &lt;conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" /&gt; &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt; &lt;file&gt;${application.home}/logs/application.log&lt;/file&gt; &lt;encoder&gt; &lt;pattern&gt;%date - [%level] - %logger in %thread in caller: %caller{3, DISP_CALLER_EVAL} %message%n%xException%n&lt;/pattern&gt; &lt;/encoder&gt; &lt;/appender&gt; &lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt; &lt;encoder&gt; &lt;pattern&gt;%coloredLevel %logger{15} - %message%n%xException{5}&lt;/pattern&gt; &lt;/encoder&gt; &lt;/appender&gt; &lt;logger name="play" level="INFO" /&gt; &lt;logger name="application" level="DEBUG" /&gt; &lt;root level="ERROR"&gt; &lt;appender-ref ref="STDOUT" /&gt; &lt;appender-ref ref="FILE" /&gt; &lt;/root&gt; </code></pre> <p></p> <p>However, if I start the play server after adding the evaluator snippet to the log configuration, no logging happens at all and the server doesn't execute the code at all. It looks that the server crashed.</p> <p>Has anyone an working example of a logging configuration with an evaluator rule on Play 2.1.1?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload