Permalink
Browse files

Minor Logging clean up

  • Loading branch information...
atooni committed Dec 6, 2018
1 parent aa741f8 commit 700c477d8855962a796d2bec637623e60ba8cbf3
@@ -43,7 +43,7 @@ class PersistedClassDao(dataSource: DataSource) {
}
def persist(persistedClass: PersistedClass): PersistedClass = {
log.debug(s"About to persist class [${persistedClass.name}:${persistedClass.id}] with ${persistedClass.fields.size} fields")
log.trace(s"About to persist class [${persistedClass.name}:${persistedClass.id}] with ${persistedClass.fields.size} fields")
// persist the holder class
val persistedClassId = {
@@ -272,7 +272,7 @@ class PersistedClassDao(dataSource: DataSource) {
val cols = Seq(PF.HolderId)
val (sql, queryParams) = createByExampleQuery(pClass, cols, fields)
val classIds = jdbcTemplate.queryForList(sql, queryParams, classOf[java.lang.Long]).asScala.toList.distinct
log.debug(s"Found ${classIds.size} class entries to be deleted. Ids: ${classIds}")
log.trace(s"Found ${classIds.size} class entries to be deleted. Ids: ${classIds}")
if (classIds.size > 0) {
val sql = s"delete from ${PC.Table} where ${PC.Id} in (:deleteIds)"
@@ -29,7 +29,7 @@ class PersistenceServiceJdbc(
}
override def deleteByExample(pClass: String, data: ju.Map[String, _ <: Any]): Long = {
log.debug(s"About to delete by example pClass: ${pClass}, data: ${data}")
log.trace(s"About to delete by example pClass: ${pClass}, data: ${data}")
val fields = PersistedField.extractFieldsWithoutDataId(data)
txTemplate.execute { ts =>
dao.deleteByFields(pClass, fields)
@@ -54,14 +54,14 @@ class PersistenceServiceJdbc(
override def persist(pClass: String, data: ju.Map[String, _ <: Any]): ju.Map[String, _ <: Any] = {
// TODO check if data already contains id
log.debug(s"About to persist class [${pClass}] with data [${data}]")
log.trace(s"About to persist class [${pClass}] with data [${data}]")
val unpersisted = PersistedClass(
id = None,
name = pClass,
fields = PersistedField.extractFieldsWithoutDataId(data)
)
log.debug(s"About to persist [${unpersisted}]")
log.trace(s"About to persist [${unpersisted}]")
val persisted = txTemplate.execute { ts =>
dao.persist(unpersisted)
@@ -52,7 +52,9 @@ case class DispatcherFanout(
// if the block does not have a condition, the header block will be used
case None => true
case Some(c) =>
val use = idSvc.resolvePropertyString(c, env.flowMessage.header.mapValues(_.value)).map(_.asInstanceOf[Boolean]).get
val resolve = idSvc.resolvePropertyString(c, env.flowMessage.header.mapValues(_.value))
bs.streamLogger.debug(s"Resolved condition to [$resolve][${resolve.map(_.getClass().getName())}]")
val use = resolve.map(_.asInstanceOf[Boolean]).get
val s = s"using header for [${env.id}]:[outboundMsg] block with expression [$c]"
if (use) {
@@ -35,9 +35,9 @@ object LogEnvelope {
}
val headerString : Map[String, String] = logHeader match {
case Nil => env.flowMessage.header.mapValues(_.value.toString)
case Nil => env.flowMessage.header.mapValues(_.toString)
case l => l.map { h =>
(h -> env.flowMessage.header.get(h).map(_.value.toString()).getOrElse("UNKNOWN"))
(h -> env.flowMessage.header.get(h).map(_.toString()).getOrElse("UNKNOWN"))
}.toMap
}
@@ -28,7 +28,7 @@ class ExpectedMessageCount(count : Int) extends FlowMessageAssertion {
if (l.lengthCompare(count) == 0) {
s"MockActor has [${l.size}] messages."
} else {
throw new Exception(s"MockActor has [${l.size}] messages, but expected [$count] messages")
throw new Exception(s"Collector has [${l.size}] messages, but expected [$count] messages")
}
}
}
@@ -42,7 +42,7 @@ class MinMessageCount(count : Int) extends FlowMessageAssertion {
if (l.size >= count) {
s"MockActor has [${l.size}] messages"
} else {
throw new Exception(s"MockActor has [${l.size}] messages, but expected at least [$count] messages")
throw new Exception(s"Collector has [${l.size}] messages, but expected at least [$count] messages")
}
}
}
@@ -72,7 +72,7 @@ class ExpectedBodies(bodies: Option[Any]*) extends FlowMessageAssertion {
def compareBodies(matchList: Map[Option[Any], FlowMessage]) : Try[String] = Try {
matchList.filter { case (expected, actual) => unmatched(actual)(expected) } match {
case s if s.isEmpty => "MockActor has received the correct bodies"
case s if s.isEmpty => "Collector has received the correct bodies"
case e =>
val msg = e.map { case (b, a) => s"[$b != ${a.body()}]"} mkString (",")
throw new Exception(s"Unexpected Bodies: $msg")
@@ -138,7 +138,7 @@ class ExpectedHeaders(headers : Map[String, Any]*) extends FlowMessageAssertion
def compareHeaders(matchList: Map[FlowEnvelope, Map[String, Any]]) : Try[String] = Try {
matchList.filter { case (m, header) => misMatchedHeaders(m, header).nonEmpty } match {
case e if e.isEmpty => s"MockActor has received the correct headers"
case e if e.isEmpty => s"Collector has received the correct headers"
case mismatch =>
val msg = mismatch.map { case (m, h) =>
val headerMsg = misMatchedHeaders(m, h).mkString(",")
@@ -155,7 +155,7 @@ final class JmsAckSourceStage(
}
} catch {
case e: JMSException =>
log.error(e)(s"Error receiving message : [${e.getMessage()}]")
log.warn(s"Error receiving message : [${e.getMessage()}]")
closeSession(session)
}
@@ -4,6 +4,7 @@ publishLocal() {
cd "${TRAVIS_BUILD_DIR}"
local REPO="https://github.com/woq-blended/$1.git"
local REPODIR="${TRAVIS_BUILD_DIR}/$1"
rm -Rf ${REPODIR}
echo "Cloning ${REPO}..."
git clone --branch master --depth 1 \
"$REPO" "$REPODIR"

0 comments on commit 700c477

Please sign in to comment.