Skip to content

Commit bac6768

Browse files
Log improvements (#194)
* Update README with more info about filtering logging during replay * Bump log level for invocation start/stop to info
1 parent 623060f commit bac6768

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,17 @@ appender.console.name = consoleLogger
346346
appender.console.layout.type = PatternLayout
347347
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %notEmpty{[%X{restateServiceMethod}]}%notEmpty{[%X{restateInvocationId}]} %c - %m%n
348348
349+
# Filter out logging during replay
350+
appender.console.filter.replay.type = ContextMapFilter
351+
appender.console.filter.replay.onMatch = DENY
352+
appender.console.filter.replay.onMismatch = NEUTRAL
353+
appender.console.filter.replay.0.type = KeyValuePair
354+
appender.console.filter.replay.0.key = restateInvocationStatus
355+
appender.console.filter.replay.0.value = REPLAYING
356+
349357
# Restate logs to debug level
350358
logger.app.name = dev.restate
351-
logger.app.level = debug
359+
logger.app.level = info
352360
logger.app.additivity = false
353361
logger.app.appenderRef.console.ref = consoleLogger
354362

examples/src/main/resources/log4j2.properties

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ status = warn
55
appender.console.type = Console
66
appender.console.name = consoleLogger
77
appender.console.layout.type = PatternLayout
8-
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %notEmpty{[%X{restateServiceMethod}]}%notEmpty{[%X{restateInvocationId}]}%notEmpty{[%X{restateInvocationStatus}]} %c - %m%n
8+
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %notEmpty{[%X{restateServiceMethod}]}%notEmpty{[%X{restateInvocationId}]} %c - %m%n
9+
10+
# Filter out logging during replay
11+
appender.console.filter.replay.type = ContextMapFilter
12+
appender.console.filter.replay.onMatch = DENY
13+
appender.console.filter.replay.onMismatch = NEUTRAL
14+
appender.console.filter.replay.0.type = KeyValuePair
15+
appender.console.filter.replay.0.key = restateInvocationStatus
16+
appender.console.filter.replay.0.value = REPLAYING
917

1018
# Restate logs to debug level
1119
logger.app.name = dev.restate
12-
logger.app.level = debug
20+
logger.app.level = info
1321
logger.app.additivity = false
1422
logger.app.appenderRef.console.ref = consoleLogger
1523

sdk-core/src/main/java/dev/restate/sdk/core/InvocationStateMachine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void onStart(MessageLite msg) {
205205
void close() {
206206
if (this.invocationState != InvocationState.CLOSED) {
207207
this.transitionState(InvocationState.CLOSED);
208-
LOG.debug("Closing state machine");
208+
LOG.info("Stopped processing invocation");
209209

210210
// Cancel inputSubscription and complete outputSubscriber
211211
if (inputSubscription != null) {
@@ -227,7 +227,7 @@ void close() {
227227
void fail(Throwable cause) {
228228
if (this.invocationState != InvocationState.CLOSED) {
229229
this.transitionState(InvocationState.CLOSED);
230-
LOG.debug("Closing state machine with failure", cause);
230+
LOG.warn("Stopped processing invocation with failure", cause);
231231

232232
// Cancel inputSubscription and complete outputSubscriber
233233
if (inputSubscription != null) {

sdk-core/src/main/java/dev/restate/sdk/core/RestateGrpcServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public InvocationFlow.InvocationOutputPublisher output() {
111111

112112
@Override
113113
public void start() {
114-
LOG.debug("Start processing call to {}/{}", serviceName, methodName);
114+
LOG.info("Start processing invocation");
115115
stateMachine.start(
116116
invocationId -> {
117117
// Set invocation id in logging context

0 commit comments

Comments
 (0)