Skip to content

Commit

Permalink
TRUNK-5115-new-1b:Replace use of conditional logging with slf4j param…
Browse files Browse the repository at this point in the history
…eteerized messages (#3714)
  • Loading branch information
gracebish authored Mar 9, 2021
1 parent 8e597d7 commit c434109
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 24 deletions.
4 changes: 1 addition & 3 deletions api/src/main/java/org/openmrs/Obs.java
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,7 @@ public String getValueAsString(Locale locale) {
* <strong>Should</strong> fail if the value of the string is empty
*/
public void setValueAsString(String s) throws ParseException {
if (log.isDebugEnabled()) {
log.debug("getConcept() == " + getConcept());
}
log.debug("getConcept() == {}", getConcept());

if (getConcept() != null && !StringUtils.isBlank(s)) {
String abbrev = getConcept().getDatatype().getHl7Abbreviation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,12 @@ public FullTextQuery createFullTextQuery(QueryDescriptor descriptor, Class<?>...
throw new DAOException("Can't create FullTextQuery for multiple persistent classes");
}

if (log.isDebugEnabled()) {
log.debug("Creating new FullTextQuery instance");
}
log.debug("Creating new FullTextQuery instance");

Class<?> entityClass = entities[0];
FullTextQuery query = delegate.createFullTextQuery(descriptor, entityClass);

if (log.isDebugEnabled()) {
log.debug("Notifying FullTextQueryCreated listeners...");
}
log.debug("Notifying FullTextQueryCreated listeners...");

//Notify listeners, note that we intentionally don't catch any exception from a listener
//so that failure should just halt the entire creation operation, this is possible because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1301,9 +1301,7 @@ private void checkIfDatatypeCanBeChanged(Concept concept) {
if (!(dao.getSavedConceptDatatype(concept).isBoolean() && concept.getDatatype().isCoded())) {
throw new ConceptInUseException();
}
if (log.isDebugEnabled()) {
log.debug("Converting datatype of concept with id " + concept.getConceptId() + " from Boolean to Coded");
}
log.debug("Converting datatype of concept with id {} from Boolean to coded", concept.getConceptId());
}
}

Expand Down
8 changes: 2 additions & 6 deletions api/src/main/java/org/openmrs/hl7/handler/ORUR01Handler.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ private Message processORU_R01(ORU_R01 oru) throws HL7Exception {
List<ConceptProposal> conceptProposals = new ArrayList<>();

// create observations
if (log.isDebugEnabled()) {
log.debug("Creating observations for message " + messageControlId + "...");
}
log.debug("Creating observations for message {}...", messageControlId);
// we ignore all MEDICAL_RECORD_OBSERVATIONS that are OBRs. We do not
// create obs_groups for them
List<Integer> ignoredConceptIds = new ArrayList<>();
Expand All @@ -244,9 +242,7 @@ private Message processORU_R01(ORU_R01 oru) throws HL7Exception {
ORU_R01_PATIENT_RESULT patientResult = oru.getPATIENT_RESULT();
int numObr = patientResult.getORDER_OBSERVATIONReps();
for (int i = 0; i < numObr; i++) {
if (log.isDebugEnabled()) {
log.debug("Processing OBR (" + i + " of " + numObr + ")");
}
log.debug("Processing OBR ({} of {})", i, numObr);
ORU_R01_ORDER_OBSERVATION orderObs = patientResult.getORDER_OBSERVATION(i);

// the parent obr
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/org/openmrs/module/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public void setExtensions(List<Extension> extensions) {
public void setExtensionNames(Map<String, String> map) {
if (log.isDebugEnabled()) {
for (Map.Entry<String, String> entry : extensionNames.entrySet()) {
log.debug("Setting extension names: " + entry.getKey() + " : " + entry.getValue());
log.debug("Setting extension names: {} : {}", entry.getKey(), entry.getValue());
}
}
this.extensionNames = map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ public BaseContextSensitiveTest() {

Properties props = getRuntimeProperties();

if (log.isDebugEnabled())
log.debug("props: " + props);
log.debug("props: {}", props);

Context.setRuntimeProperties(props);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,7 @@ else if (IMPLEMENTATION_ID_SETUP.equals(page)) {
wizardModel.remoteUsername, wizardModel.remotePassword);
}
catch (APIAuthenticationException e) {
if (log.isDebugEnabled()) {
log.debug("Error generated: ", e);
}
log.debug("Error generated: ", e);
page = TESTING_REMOTE_DETAILS_SETUP;
errors.put(ErrorMessageConstants.UPDATE_ERROR_UNABLE_AUTHENTICATE, null);
renderTemplate(page, referenceMap, httpResponse);
Expand Down

0 comments on commit c434109

Please sign in to comment.