Use Case You have problem with certain modules in CQ/CRX and you want to debug it
Setting Debug mode in CQ
For example if I have to set debug for package com.day.cq.dam.core
[1] Log into Felix Console: http://<host>:<port>/system/console/configMgr
[2] From "Factory Configurations", create "Apache Sling Logging Writer Configuration"
[2.1] Set value of "Log File" to "../logs/dam.log"
[2.2] Click on "Save"
[3] From "Factory Configurations", create "Apache Sling Logging Logger Configuration"
[3.1] Set value of "Log Level" to "Debug"
[3.2] Set value of "Log File" to "../logs/dam.log"
[3.3] Add "Logger" => com.day.cq.dam.core
[3.4] Click on "Save"
Now all debug information for package com.day.cq.dam.core will be redirected to /crx-quickstart/logs/dam.log
Click Here to see how to Rotate custom logs in CQ.
Note: Note that OOTB logger information will be redirected
For example everything with
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final Logger logger = LoggerFactory.getLogger(getClass());
and then logger.debug("Your message");
Setting debug mode for CRX
Suppose you want to enable logging for com.day.crx.security.ldap package.
1. Open the log4j.xml file (located in crx-quickstart/server/runtime/0/_crx/WEB-INF/) and add another appender:
<!-- ldap.log -->
<appender name="ldap" class="org.apache.log4j.FileAppender">
<param name="File" value="crx-quickstart/logs/crx/ldap.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %m%n"/>
</layout>
</appender>
2. Add another logger:
<logger name="com.day.crx.security.ldap">
<level value="debug"/>
<appender-ref ref="ldap"/>
</logger>
NOTE
Optionally, you can use "com.day.crx.security" instead of "com.day.crx.security.ldap" to see all CRX security-related debug log messages in the logs/crx/ldap.log file.
3. Restart the server.
4. Try logging into CRX directly with your LDAP account.
5. Examine the ldap.log and error.log files from CRX to debug for errors.
NOTE
If you are troubleshooting LDAP for a CQ instance, first try logging CRX at http://<host>:<port>/crx. Second, try logging into CQ at http://<host>:<port>. Then examine the ldap.log and error.log files from CRX and CQ for errors.
For CQ5.5 there is no log4j.xml. All the CRX logger needs to configured using sling config. So If you want to debug LDAP in CQ5.5, You have to use sling logging logger configuration
Just as a side note you can start your CRXDE in debug mode by adding "-d" in the end of start option. For example to start CRXDE in debug mode you can chose java -jar <CQ jar file name> -d
Good post Yogesh. Thanks - it came in handy to troubleshoot an LDAP issue.
ReplyDeleteGreat Article. Thank you for sharing! Really an awesome post for every one.
ReplyDeleteDiscerning Feature Supported Encoder for Image Representation Project For CSE
Dual Stream Interactive Networks for No Reference Stereoscopic Image Quality Assessment Project For CSE
Efficient Multiple Organ Localization in CT Image using 3D Region Proposal Network Project For CSE
Enhanced Non Local Total Variation Model and Multi Directional Feature Prediction Prior for Single Image Super Resolution Project For CSE
External Patch Based Image Restoration Using Importance Sampling Project For CSE
Foreground Fisher Vector Encoding Class Relevant Foreground to Improve Image Classification Project For CSE
Fundamental Visual Concept Learning from Correlated Images and Text Project For CSE
Generative Adversarial Networks and Perceptual Losses for Video Super Resolution Project For CSE
Hybrid LSTM and Encoder Decoder Architecture for Detection of Image Forgeries Project For CSE
Hyperspectral Image Unmixing With End member Bundles and Group Sparsity Inducing Mixed Norms Project For CSE