Skip to content

Commit

Permalink
Removed ThreadConfigurableLogger class for upcoming SLF4J change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Thomas jjthom3 committed Oct 25, 2024
1 parent aeacac6 commit 9b0617e
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 139 deletions.
4 changes: 4 additions & 0 deletions core/common-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
4 changes: 4 additions & 0 deletions warehouse/query-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public ScannerStream visit(ASTEQNode node, Object data) {
return ScannerStream.unindexed(node);
}
} catch (TableNotFoundException e) {
log.error(String.valueOf(e));
log.error("", e);
throw new RuntimeException(e);
}
log.debug("{\"" + fieldName + "\": \"" + literal + "\"} is not an observed field.");
Expand Down Expand Up @@ -617,7 +617,7 @@ public ScannerStream visit(ASTEQNode node, Object data) {
return ScannerStream.initialized(scannerSession, entryParser, node);

} catch (Exception e) {
log.error(String.valueOf(e));
log.error("", e);
throw new RuntimeException(e);
}
}
Expand Down Expand Up @@ -673,7 +673,7 @@ public Object visit(ASTERNode node, Object data) {
return ScannerStream.unknownField(node);
}
} catch (TableNotFoundException e) {
log.error(String.valueOf(e));
log.error("", e);
throw new RuntimeException(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public synchronized void submit() {
range = new Range(startKey, true, endKey, literalRange.isUpperInclusive());
} catch (IllegalArgumentException e) {
QueryException qe = new QueryException(DatawaveErrorCode.RANGE_CREATE_ERROR, e, MessageFormat.format("{0}", this.literalRange));
log.debug(String.valueOf(qe));
log.debug("", qe);
throw new IllegalRangeArgumentException(qe);
}

Expand Down Expand Up @@ -183,12 +183,12 @@ public synchronized void submit() {
} catch (TableNotFoundException e) {
NotFoundQueryException qe = new NotFoundQueryException(DatawaveErrorCode.TABLE_NOT_FOUND, e,
MessageFormat.format("Table: {0}", config.getIndexTableName()));
log.error(String.valueOf(qe));
log.error("", qe);
throw new DatawaveFatalQueryException(qe);

} catch (IOException e) {
QueryException qe = new QueryException(DatawaveErrorCode.RANGE_CREATE_ERROR, e, MessageFormat.format("{0}", this.literalRange));
log.debug(String.valueOf(qe));
log.debug("", qe);
if (bs != null) {
scannerFactory.close(bs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public synchronized void submit() {
if (config.getDisallowedRegexPatterns().contains(pattern)) {
PreConditionFailedQueryException qe = new PreConditionFailedQueryException(DatawaveErrorCode.IGNORE_PATTERN_FOR_INDEX_LOOKUP,
MessageFormat.format("Pattern: {0}", pattern));
log.debug(String.valueOf(qe));
log.debug("", qe);
throw new DoNotPerformOptimizedQueryException(qe);
}

Expand All @@ -141,7 +141,7 @@ public synchronized void submit() {
log.debug("Ignoring pattern that was not capable of being looked up in the index: " + pattern, e);
continue;
} catch (TableNotFoundException e) {
log.error(String.valueOf(e));
log.error("", e);
throw new DatawaveFatalQueryException(e);
} catch (ExecutionException e) {
throw new DatawaveFatalQueryException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ else if (lenient) {
} catch (Exception e) {
QueryException qe = new QueryException(DatawaveErrorCode.NODE_EXPANSION_ERROR, e,
MessageFormat.format("Node: {0}, Datatypes: {1}", PrintingVisitor.formattedQueryString(node), dataTypes));
log.error(String.valueOf(qe));
log.error("", qe);
throw new DatawaveFatalQueryException(qe);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static <T extends JexlNode> T expandUnfielded(ShardQueryConfiguration con
private static <T extends JexlNode> T ensureTreeNotEmpty(T script) throws EmptyUnfieldedTermExpansionException {
if (script.jjtGetNumChildren() == 0) {
NotFoundQueryException qe = new NotFoundQueryException(DatawaveErrorCode.NO_UNFIELDED_TERM_EXPANSION_MATCH);
log.warn(String.valueOf(qe));
log.warn("", qe);
throw new EmptyUnfieldedTermExpansionException(qe);
}
return script;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ protected Set<String> loadExpansionFields(ShardQueryConfiguration config) {
return metadataHelper.getExpansionFields(config.getDatatypeFilter());
} catch (TableNotFoundException e) {
QueryException qe = new QueryException(DatawaveErrorCode.METADATA_ACCESS_ERROR, e);
log.info(String.valueOf(qe));
log.info("",qe);
throw new DatawaveFatalQueryException(qe);
}
}
Expand Down Expand Up @@ -1416,11 +1416,11 @@ protected ASTJexlScript timedExpandAnyFieldRegexNodes(QueryStopwatch timers, fin
} catch (EmptyUnfieldedTermExpansionException e) {
// The visitor will only throw this if we cannot expand anything resulting in empty query
NotFoundQueryException qe = new NotFoundQueryException(DatawaveErrorCode.UNFIELDED_QUERY_ZERO_MATCHES, e, MessageFormat.format("Query: ", query));
log.info(String.valueOf(qe));
log.info("",qe);
throw new NoResultsException(qe);
} catch (TableNotFoundException e) {
QueryException qe = new QueryException(DatawaveErrorCode.METADATA_ACCESS_ERROR, e);
log.info(String.valueOf(qe));
log.info("",qe);
throw new DatawaveFatalQueryException(qe);
}
}
Expand Down Expand Up @@ -1488,7 +1488,7 @@ protected void timedTestForNonExistentFields(QueryStopwatch timers, final ASTJex

BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.FIELDS_NOT_IN_DATA_DICTIONARY, MessageFormat.format(
"Datatype Filter: {0}, Missing Fields: {1}, Auths: {2}", datatypeFilterSet, nonexistentFields, settings.getQueryAuthorizations()));
log.error(String.valueOf(qe));
log.error("", qe);
throw new InvalidQueryException(qe);
}

Expand Down Expand Up @@ -1945,7 +1945,7 @@ protected ASTJexlScript applyQueryModel(MetadataHelper metadataHelper, ShardQuer
}
} catch (TableNotFoundException e) {
QueryException qe = new QueryException(DatawaveErrorCode.FIELD_FETCH_ERROR, e);
log.error(String.valueOf(qe));
log.error("", qe);
throw new DatawaveFatalQueryException(qe);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public QueryModel getQueryModel() {
config.setQueryModel(queryModel);
} catch (TableNotFoundException e) {
QueryException qe = new QueryException(DatawaveErrorCode.QUERY_MODEL_FETCH_ERROR, e);
log.error(String.valueOf(qe));
log.error("", qe);
throw new DatawaveFatalQueryException(qe);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public synchronized void stop() {
try {
rangeIterable.close();
} catch (IOException e) {
log.error(String.valueOf(e));
log.error("", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
import org.apache.commons.jexl3.parser.JexlNode;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.log4j.Logger;

import com.google.common.base.Function;
import com.google.common.cache.Cache;
Expand Down Expand Up @@ -175,7 +174,7 @@ public class ShardQueryLogic extends BaseQueryLogic<Entry<Key,Value>> implements

public static final String NULL_BYTE = "\0";
public static final Class<? extends ShardQueryConfiguration> tableConfigurationType = ShardQueryConfiguration.class;
protected static final Logger log = LoggerFactory.getLogger(ShardQueryLogic.class);
protected static final Logger log = Logger.getLogger(ShardQueryLogic.class);
static final ListeningExecutorService reloader = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1));
private static Cache<String,QueryModel> queryModelMap = CacheBuilder.newBuilder().maximumSize(100).concurrencyLevel(100)
.expireAfterAccess(24, TimeUnit.HOURS).build();
Expand Down
4 changes: 4 additions & 0 deletions web-services/metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static boolean isGeoQuery(BaseQueryMetric metric) {

return !GeoFeatureVisitor.getGeoFeatures(JexlASTHelper.parseAndFlattenJexlQuery(jexlQuery)).isEmpty();
} catch (Exception e) {
log.trace(String.valueOf(new Exception("Unable to parse the geo features")));
log.trace("", (new Exception("Unable to parse the geo features")));
}
return false;
}
Expand Down
Loading

0 comments on commit 9b0617e

Please sign in to comment.