Skip to content

Commit

Permalink
pubsub logging always at debug
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw committed Jan 9, 2025
1 parent 3db9754 commit 3e58285
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -681,26 +681,29 @@ private[projection] object R2dbcProjectionImpl {
}

private def logReplayRejected(logPrefix: String, originalEventEnvelope: EventEnvelope[Any], fromSeqNr: Long): Unit = {
val msg =
"{} Replaying events after rejected sequence number from {}. PersistenceId [{}], replaying from seqNr [{}] to [{}]. Replay count [{}]."
val c =
if (EnvelopeOrigin.fromPubSub(originalEventEnvelope))
replayRejectedCounter.get // don't increment counter for pubsub
else
replayRejectedCounter.incrementAndGet()

val logLevel =
if (c == 1 || c % 1000 == 0) Level.WARN else Level.DEBUG
log
.atLevel(logLevel)
.log(
msg,
if (EnvelopeOrigin.fromPubSub(originalEventEnvelope)) {
log.debug(
"{} Replaying events after rejected sequence number from {}. PersistenceId [{}], replaying from seqNr [{}] to [{}].",
logPrefix,
envelopeSourceName(originalEventEnvelope),
originalEventEnvelope.persistenceId,
fromSeqNr,
originalEventEnvelope.sequenceNr,
c)
originalEventEnvelope.sequenceNr)
} else {
val c = replayRejectedCounter.incrementAndGet()
val logLevel =
if (c == 1 || c % 1000 == 0) Level.WARN else Level.DEBUG
log
.atLevel(logLevel)
.log(
"{} Replaying events after rejected sequence number from {}. PersistenceId [{}], replaying from seqNr [{}] to [{}]. Replay count [{}].",
logPrefix,
envelopeSourceName(originalEventEnvelope),
originalEventEnvelope.persistenceId,
fromSeqNr,
originalEventEnvelope.sequenceNr,
c)
}
}

private def logReplayInvalidCount(
Expand Down

0 comments on commit 3e58285

Please sign in to comment.