FHIR Chat · Question about logging in HAPI · implementers

Stream: implementers

Topic: Question about logging in HAPI


view this post on Zulip John Gresh (Jan 26 2017 at 17:00):

Hi Everybody,

I'm using the HAPI jar files to translate between xml and java. I'm getting a lot of loging output (see below). Does anyone know how I can turn this logging off? I'm using Eclipse and log4j in my project and even if I see all of the logging levels to OFF in the log4j.properties file in my classes directory this output comes through.

Thanks,
John

Jan 26, 2017 11:49:57 AM ca.uhn.fhir.util.VersionUtil initialize
INFO: HAPI FHIR version is: 2.2
Jan 26, 2017 11:49:57 AM ca.uhn.fhir.context.FhirContext <init>
INFO: Creating new FHIR context for FHIR version [DSTU2]
Jan 26, 2017 11:49:57 AM ca.uhn.fhir.util.jar.DependencyLogImpl logStaxImplementation
INFO: FHIR XML procesing will use StAX implementation 'Woodstox XML-processor' version '4.4.1'
Jan 26, 2017 11:49:59 AM ca.uhn.fhir.context.FhirContext <init>
INFO: Creating new FHIR context for FHIR version [DSTU2]
Jan 26, 2017 11:49:59 AM ca.uhn.fhir.parser.LenientErrorHandler unknownElement
WARNING: Unknown element 'code' found while parsing
Jan 26, 2017 11:49:59 AM ca.uhn.fhir.parser.LenientErrorHandler unknownElement
WARNING: Unknown element 'attestedDate' found while parsing

view this post on Zulip James Agnew (Jan 26 2017 at 17:02):

Hi John, there are some details about how HAPI does logging here: http://hapifhir.io/doc_logging.html

In short, it uses SLF4j, so if you want HAPI's logs to go through log4j and be subject to your l4j config, you need to include the slf4j-log4j12 jar on your classpath.

view this post on Zulip John Gresh (Jan 27 2017 at 15:35):

Thanks James,

I added this to my maven dependencies (upstream from the log4j dependency) and I am now able to control the logging output with a logback.xml file in my classes folder.

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.9</version>
</dependency>

Thank you!
John


Last updated: Apr 12 2022 at 19:14 UTC