Commit f2a19ea0 authored by Thomas Bernhart's avatar Thomas Bernhart

Merge branch 'MEMO-899-adapt-logging' into 'master'

MEMO-899: adapt logging

See merge request !12
parents ae559efa 265a3bee
Pipeline #19617 passed with stages
in 4 minutes and 7 seconds
......@@ -18,6 +18,7 @@ jar {
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
......@@ -104,7 +105,6 @@ task integrationTest(type: Test) {
shouldRunAfter test
}
plugins.withType(DistributionPlugin) {
distTar {
archiveFileName = 'app.tar'
......
......@@ -17,6 +17,8 @@
*/
package org.memobase
import ch.memobase.testing.EmbeddedKafkaExtension
import ch.memobase.testing.EmbeddedSftpServer
import com.beust.klaxon.Klaxon
import java.io.File
import java.io.FileInputStream
......@@ -41,8 +43,6 @@ import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import org.memobase.testing.EmbeddedKafkaExtension
import org.memobase.testing.EmbeddedSftpServer
@ExtendWith(EmbeddedKafkaExtension::class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
......
......@@ -20,11 +20,11 @@
<Configuration status="info" name="skeleton-app" packages="">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] [%c{1}] %m%n"/>
<PatternLayout pattern="[%level] [%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<Root level="warn">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
......
......@@ -18,6 +18,9 @@
package org.memobase
import ch.memobase.sftp.SftpClient
import java.io.File
import java.io.StringWriter
import java.net.URI
import org.apache.jena.rdf.model.Model
import org.apache.jena.riot.Lang
import org.apache.jena.riot.RDFDataMgr
......@@ -26,9 +29,6 @@ import org.fcrepo.client.FcrepoOperationFailedException
import org.memobase.fedora.FedoraClient
import org.memobase.fedora.FedoraTransactionClient
import org.memobase.fedora.RdfContentTypes
import java.io.File
import java.io.StringWriter
import java.net.URI
class Ingester(
private val sftpClient: SftpClient,
......@@ -48,8 +48,6 @@ class Ingester(
val data = recordOutput.toString()
fedoraClient.startTransaction().use { transaction ->
log.info("Ingesting record ${recordPair.first}.")
// create placeholders referenced resources:
val nonBinaryResources = rdfHandler.getReferencedNonBinaryResources()
nonBinaryResources.forEach { resource ->
......@@ -59,15 +57,17 @@ class Ingester(
}
// ingest record, instantiations and binaries:
log.info("Ingesting record ${recordPair.first}.")
transaction.createOrUpdateRdfResource(URI(recordPair.first), data, RdfContentTypes.NTRIPLES)
log.info("Ingested record ${recordPair.first}.")
ingestInstantiations(rdfHandler.getInstantiations(), transaction)
val sftpLocators = rdfHandler.getSftpLocators()
if (sftpLocators.isNotEmpty()) {
ingestBinaries(sftpLocators, rdfHandler, transaction)
}
transaction.commit()
log.info("Ingested record ${recordPair.first}.")
}
log.info("End ingest of message with id $id.")
}
private fun ingestInstantiations(instantiations: List<Pair<String, Model>>, transaction: FedoraTransactionClient) {
......
......@@ -3,6 +3,7 @@ package org.memobase
import ch.memobase.rdf.EBUCORE
import ch.memobase.rdf.RDF
import ch.memobase.rdf.RICO
import java.io.ByteArrayInputStream
import org.apache.jena.rdf.model.Model
import org.apache.jena.rdf.model.ModelFactory
import org.apache.jena.rdf.model.Statement
......@@ -12,7 +13,6 @@ import org.apache.jena.riot.Lang
import org.apache.jena.riot.RDFDataMgr
import org.apache.log4j.LogManager
import org.memobase.exceptions.MissingMimeTypeException
import java.io.ByteArrayInputStream
class RdfHandler(data: String, private val externalBaseUrl: String) {
private val log = LogManager.getLogger("IngestRdfHandler")
......
......@@ -22,6 +22,8 @@ import ch.memobase.exceptions.SftpClientException
import ch.memobase.reporting.ReportStatus
import ch.memobase.settings.SettingsLoader
import ch.memobase.sftp.SftpClient
import java.io.Closeable
import java.util.Properties
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
......@@ -29,8 +31,6 @@ import org.fcrepo.client.FcrepoOperationFailedException
import org.memobase.exceptions.MissingMimeTypeException
import org.memobase.fedora.FedoraClient
import org.memobase.fedora.FedoraClientImpl
import java.io.Closeable
import java.util.Properties
class Service(fileName: String = "app.yml") : Closeable {
......
......@@ -20,7 +20,7 @@
<Configuration status="info" name="skeleton-app" packages="">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] [%c{1}] %m%n"/>
<PatternLayout pattern="[%level] [%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
......
......@@ -20,11 +20,11 @@
<Configuration status="info" name="skeleton-app" packages="">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] [%c{1}] %m%n"/>
<PatternLayout pattern="[%level] [%c{1}] %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<Root level="warn">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment