Thursday, November 02, 2017

Artifactory - How to Enable logger for Plugin

To enable logging for a plugin in Artifactory, what you need to do is update the "logback.xml" file. Let's use the "Artifactory Filestore Integrity User Plugin" as an example.

Assuming you already downloaded and installed the "filestoreIntegrity.groovy". Now we want to enable logging for this file integrity checks.

Locate your logback.xml file, default location is "/var/opt/jfrog/artifactory/etc"
# cd /var/opt/jfrog/artifactory/etc/
# vim logback.xml
Add
   <logger name="filestoreIntegrity">
       <level value="debug"/>
   </logger>

To the end of the file, before "</configuration>"

Save the file, and check the log file, you should see entries like:
[INFO ] (o.a.w.s.l.LogbackConfigListener$LogbackConfigWatchDog:168) - Reloaded logback config from: /var/opt/jfrog/artifactory/etc/logback.xml.

Now if you trigger the plugin, you will see
2017-11-02 15:46:32,408 [http-nio-8081-exec-2] [DEBUG] (filestoreIntegrity  :-2) - Reading from filestore at '/vol2/opt/nfs_repo/jfrog/artifactory/data/filestore'
2017-11-02 15:46:32,669 [http-nio-8081-exec-2] [DEBUG] (filestoreIntegrity  :-2) - Integrity check complete, 0 discrepancies found.

No comments: