Last active
December 28, 2015 11:49
-
-
Save chetanmeh/7496571 to your computer and use it in GitHub Desktop.
Sample Logback xml config file to be used with Sling based application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, | |
software distributed under the License is distributed on an | |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, either express or implied. See the License for the | |
specific language governing permissions and limitations | |
under the License. | |
--> | |
<configuration scan="true" scanPeriod="60 seconds"> | |
<!-- Uncomment this to enable JUL integration. Also see | |
http://sling.apache.org/documentation/development/logging-new.html#java-util-logging-jul-integration | |
--> | |
<!-- | |
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/> | |
--> | |
<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="/logs/error.log" class="ch.qos.logback.core.FileAppender"> | |
<encoder> | |
<pattern>%d %-5level %X{sling.userId:-NA} [%thread] %logger{30} %marker- %msg %n</pattern> | |
<immediateFlush>true</immediateFlush> | |
</encoder> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<fileNamePattern>${sling.home}/logs/error.%d{yyyy-MM-dd}.log</fileNamePattern> | |
<maxHistory>30</maxHistory> | |
</rollingPolicy> | |
</appender> | |
<appender name="query-log" class="ch.qos.logback.core.FileAppender"> | |
<file>${sling.home}/logs/query.log</file> | |
<encoder> | |
<pattern>%d %msg %n</pattern> | |
<immediateFlush>false</immediateFlush> | |
</encoder> | |
</appender> | |
<!-- | |
To see the JCR operation being performed set the log level to debug | |
--> | |
<logger name="org.apache.jackrabbit.oak.jcr.operations" level="INFO"> | |
<appender-ref ref="/logs/error.log" /> | |
</logger> | |
<!-- | |
To see the JCR Query being performed set the log level to debug | |
--> | |
<logger name="org.apache.jackrabbit.oak.query" level="INFO"> | |
<appender-ref ref="query-log" /> | |
</logger> | |
<root level="INFO"> | |
<appender-ref ref="/logs/error.log" /> | |
</root> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment