This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-logback-groovy-fragment.git
commit 345990979f16d45313a9675bf36b09f5d9cb5258 Author: Chetan Mehrotra <[email protected]> AuthorDate: Mon Aug 4 09:15:37 2014 +0000 SLING-3814 - Groovy fragment bundle for Commons Log to support scriptable event evaluation Add a readme git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1615516 13f79535-47bb-0310-9956-ffa450edef68 --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md new file mode 100644 index 0000000..9543478 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +Logback Groovy Fragment +======================= + +This fragment is required to make use of Groovy based event evaluation support +provided by Logback. This enables programatic filtering of the log messages and +is useful to get desired logs without flooding the system. For example Oak +logs the JCR operations being performed via a particular session. if this lo is +enabled it would flood the log with messages from all the active session. However +if you need logging only from session created in a particular thread then that +can be done in following way + + <?xml version="1.0" encoding="UTF-8"?> + <configuration> + <jmxConfigurator/> + <newRule pattern="*/configuration/osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAction"/> + <newRule pattern="*/configuration/appender-ref-osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAppenderRefAction"/> + <osgi/> + + <appender name="OAK" class="ch.qos.logback.core.FileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression><![CDATA[ + return event.getThreadName().contains("JobHandler"); + ]]></expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>ACCEPT</OnMatch> + </filter> + <file>${sling.home}/logs/oak.log</file> + <encoder> + <pattern>%d %-5level [%thread] %marker- %msg %n</pattern> + <immediateFlush>true</immediateFlush> + </encoder> + </appender> + + <logger name="org.apache.jackrabbit.oak.jcr.operations" level="DEBUG" additivity="false"> + <appender-ref ref="OAK"/> + </logger> + </configuration> + +Above logback config would route all log messages from `org.apache.jackrabbit.oak.jcr.operations` +category to `${sling.home}/logs/oak.log`. Further only those log messages would be logged +where the `threadName` contains `JobHandler`. Depending on the requirement the expression can +be customised. \ No newline at end of file -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
