SOLR-8359: Restrict child classes from using parent logger's state

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1718257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-12-07 06:59:18 +00:00
parent ceb66d34c0
commit b8a2745d94
8 changed files with 19 additions and 5 deletions

View File

@ -234,6 +234,9 @@ Other Changes
* SOLR-8313: SimpleQueryParser doesn't use MultiTermAnalysis for Fuzzy Queries (Tom Hill via Erick Erickson)
* SOLR-8359: Restrict child classes from using parent logger's state
(Jason Gerlowski, Mike Drob, Anshum Gupta)
================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -48,6 +48,7 @@ public class CdcrTransactionLog extends TransactionLog {
long startVersion; // (absolute) version of the first element of this transaction log
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static boolean debug = log.isDebugEnabled();
CdcrTransactionLog(File tlogFile, Collection<String> globalStrings) {
super(tlogFile, globalStrings);

View File

@ -64,6 +64,7 @@ public class CdcrUpdateLog extends UpdateLog {
public static String LOG_FILENAME_PATTERN = "%s.%019d.%1d";
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static boolean debug = log.isDebugEnabled();
@Override
public void init(UpdateHandler uhandler, SolrCore core) {

View File

@ -59,6 +59,8 @@ import org.slf4j.LoggerFactory;
*/
public class HdfsTransactionLog extends TransactionLog {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static boolean debug = log.isDebugEnabled();
private static boolean trace = log.isTraceEnabled();
Path tlogFile;

View File

@ -52,6 +52,7 @@ public class HdfsUpdateLog extends UpdateLog {
private Integer tlogDfsReplication;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static boolean debug = log.isDebugEnabled();
// used internally by tests to track total count of failed tran log loads in init
public static AtomicLong INIT_FAILED_LOGS_COUNT = new AtomicLong();
@ -350,6 +351,12 @@ public class HdfsUpdateLog extends UpdateLog {
}
}
@Override
public void preSoftCommit(CommitUpdateCommand cmd) {
debug = log.isDebugEnabled();
super.preSoftCommit(cmd);
}
public String[] getLogList(Path tlogDir) throws FileNotFoundException, IOException {
final String prefix = TLOG_NAME+'.';
FileStatus[] files = fs.listStatus(tlogDir, new PathFilter() {

View File

@ -59,7 +59,7 @@ import static org.apache.solr.update.processor.DistributingUpdateProcessorFactor
/** @lucene.experimental */
public class PeerSync {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public boolean debug = log.isDebugEnabled();
private static boolean debug = log.isDebugEnabled();
private List<String> replicas;
private int nUpdates;

View File

@ -64,8 +64,8 @@ import org.slf4j.LoggerFactory;
*/
public class TransactionLog {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final boolean debug = log.isDebugEnabled();
final boolean trace = log.isTraceEnabled();
private static boolean debug = log.isDebugEnabled();
private static boolean trace = log.isTraceEnabled();
public final static String END_MESSAGE="SOLR_TLOG_END";

View File

@ -77,8 +77,8 @@ public class UpdateLog implements PluginInfoInitialized {
public static String TLOG_NAME="tlog";
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public boolean debug = log.isDebugEnabled();
public boolean trace = log.isTraceEnabled();
private static boolean debug = log.isDebugEnabled();
private static boolean trace = log.isTraceEnabled();
// TODO: hack
public FileSystem getFs() {