Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature configurable cql logging #338

Merged
merged 5 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public class HapiProperties {
static final String CDSHOOKS_FHIRSERVER_SEARCHSTYLE= "cds_hooks.fhirServer.searchStyle";
static final String CDSHOOKS_PREFETCH_MAXURILENGTH= "cds_hooks.prefetch.maxUriLength";

static final String CQL_DEBUG_LOGGING_ENABLED = "cql.debugLogging.enabled";

private static Properties properties;

/*
Expand Down Expand Up @@ -256,6 +258,10 @@ public static Boolean getLoggerLogExceptions() {
return HapiProperties.getBooleanProperty(LOGGER_LOG_EXCEPTIONS, true);
}

public static Boolean getCQLDebugLoggingEnabled() {
return HapiProperties.getBooleanProperty(CQL_DEBUG_LOGGING_ENABLED, false);
}

public static String getDataSourceDriver() {
return HapiProperties.getProperty(DATASOURCE_DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import org.apache.commons.lang3.tuple.Triple;
import org.cqframework.cql.elm.execution.Library;
import org.hl7.fhir.dstu3.model.Measure;
import org.opencds.cqf.common.config.HapiProperties;
import org.opencds.cqf.common.evaluation.EvaluationProviderFactory;
import org.opencds.cqf.common.helpers.DateHelper;
import org.opencds.cqf.common.helpers.UsingHelper;
import org.opencds.cqf.common.providers.LibraryResolutionProvider;
import org.opencds.cqf.cql.engine.data.DataProvider;
import org.opencds.cqf.cql.engine.debug.DebugMap;
import org.opencds.cqf.cql.engine.execution.Context;
import org.opencds.cqf.cql.engine.execution.LibraryLoader;
import org.opencds.cqf.cql.engine.runtime.DateTime;
Expand Down Expand Up @@ -102,5 +104,9 @@ public void setup(Measure measure, String periodStart, String periodEnd, String
}

context.setExpressionCaching(true);

DebugMap debugMap = new DebugMap();
debugMap.setIsLoggingEnabled(HapiProperties.getCQLDebugLoggingEnabled());
context.setDebugMap(debugMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
Context context = new Context(library);

DebugMap debugMap = new DebugMap();
debugMap.setIsLoggingEnabled(true);
debugMap.setIsLoggingEnabled(HapiProperties.getCQLDebugLoggingEnabled());
context.setDebugMap(debugMap);

context.registerDataProvider("http://hl7.org/fhir", provider); // TODO make sure tooling handles remote
Expand Down
7 changes: 6 additions & 1 deletion dstu3/src/main/resources/hapi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,9 @@ observationTransform.replaceCode=false
cds_hooks.fhirServer.maxCodesPerQuery=
cds_hooks.fhirServer.expandValueSets=
cds_hooks.fhirServer.searchStyle=
cds_hooks.prefetch.maxUriLength=
cds_hooks.prefetch.maxUriLength=

##################################################
# CQL Settings
##################################################
cql.debugLogging.enabled=false
4 changes: 4 additions & 0 deletions dstu3/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@
<!-- <appender-ref ref="htmlAppender" /> -->
</root>

<!-- added DebugUtilities logger to facilitate CQL debug logging without turning on debug logging for everything -->
<!-- to enable CQL debug logging, set 'cql.debugLogging.enabled=true' in hapi.properties -->
<logger name="org.opencds.cqf.cql.engine.debug.DebugUtilities" level="DEBUG" />

</configuration>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<hapi.version>5.4.1</hapi.version>
<fhir.core.version>5.4.5</fhir.core.version>
<cqf-tooling.version>1.3.1-SNAPSHOT</cqf-tooling.version>
<cql-engine.version>1.5.1</cql-engine.version>
<cql-engine.version>1.5.2-SNAPSHOT</cql-engine.version>
<cql-evaluator.version>1.2.1-SNAPSHOT</cql-evaluator.version>
<cqframework.version>1.5.3</cqframework.version>
<cds-hooks.version>1.3.1-SNAPSHOT</cds-hooks.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.commons.lang3.tuple.Triple;
import org.cqframework.cql.elm.execution.Library;
import org.hl7.fhir.r4.model.Measure;
import org.opencds.cqf.common.config.HapiProperties;
import org.opencds.cqf.common.evaluation.EvaluationProviderFactory;
import org.opencds.cqf.common.helpers.DateHelper;
import org.opencds.cqf.common.helpers.UsingHelper;
Expand Down Expand Up @@ -105,7 +106,7 @@ public void setup(Measure measure, String periodStart, String periodEnd, String
context.setExpressionCaching(true);

DebugMap debugMap = new DebugMap();
debugMap.setIsLoggingEnabled(true);
debugMap.setIsLoggingEnabled(HapiProperties.getCQLDebugLoggingEnabled());
context.setDebugMap(debugMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
Context context = new Context(library);

DebugMap debugMap = new DebugMap();
debugMap.setIsLoggingEnabled(true);
debugMap.setIsLoggingEnabled(HapiProperties.getCQLDebugLoggingEnabled());
context.setDebugMap(debugMap);

context.registerDataProvider("http://hl7.org/fhir", provider); // TODO make sure tooling handles remote
Expand Down
5 changes: 5 additions & 0 deletions r4/src/main/resources/hapi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,8 @@ cds_hooks.fhirServer.maxCodesPerQuery=
cds_hooks.fhirServer.expandValueSets=
cds_hooks.fhirServer.searchStyle=
cds_hooks.prefetch.maxUriLength=

##################################################
# CQL Settings
##################################################
cql.debugLogging.enabled=false
4 changes: 4 additions & 0 deletions r4/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@
<!-- <appender-ref ref="htmlAppender" /> -->
</root>

<!-- added DebugUtilities logger to facilitate CQL debug logging without turning on debug logging for everything -->
<!-- to enable CQL debug logging, set 'cql.debugLogging.enabled=true' in hapi.properties -->
<logger name="org.opencds.cqf.cql.engine.debug.DebugUtilities" level="DEBUG" />

</configuration>