Project

General

Profile

« Previous | Next » 

Revision 9990

Added by Jing Tao about 8 years ago

Add the method PropertyConfigurator.configureAndWatch to monitor the change on log4j.properties file.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/ApplicationController.java
26 26

  
27 27
import org.apache.commons.configuration.ConfigurationException;
28 28
import org.apache.commons.logging.Log;
29
import org.apache.log4j.PropertyConfigurator;
29 30
import org.apache.commons.logging.LogFactory;
30 31
import org.apache.solr.client.solrj.SolrServer;
31 32
import org.dataone.configuration.Settings;
......
133 134
        }
134 135
        if(foundProperty) {
135 136
            period = Settings.getConfiguration().getLong("index.regenerate.interval");
137
            String log4jPropFile =  Settings.getConfiguration().getString("application.deployDir") + "/" +
138
                    Settings.getConfiguration().getString("index.context") + "/WEB-INF/classes/log4j.properties";
139
            log.info("ApplicationController.initializeSharedConfiguration - the log4j.properties file is "+log4jPropFile);
140
            //When the log4j.properties is changed, it will reload the properties without restart tomcat
141
            PropertyConfigurator.configureAndWatch(log4jPropFile);
136 142
        }
137 143
        
138 144
    }
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
591 591
        if(isArchive ) {
592 592
            //delete the index for the archived objects
593 593
            remove(pid.getValue(), systemMetadata);
594
            log.info("SolrIndex.update============================= archive the idex for the identifier "+pid);
594
            log.info("SolrIndex.update============================= archive the idex for the identifier "+pid.getValue());
595 595
        } else {
596 596
            //generate index for either add or update.
597 597
            insert(pid, systemMetadata, objectPath);
598
            log.info("SolrIndex.update============================= insert index for the identifier "+pid);
598
            log.info("SolrIndex.update============================= insert index for the identifier "+pid.getValue());
599 599
        }
600 600
    }
601 601
    

Also available in: Unified diff