#1343·moleculer

make the log level of fallbackResponse configurable in the broker

Author: cintolasCreated Dec 16, 2025Updated Dec 16, 2025

Is your feature request related to a problem? Please describe.

The log level of fallbackResponse is WARN. This causes excessive logging. By adding in a fallbackResponse you have already proactively caught the exception.

An example is with moleculer-db. If a get returns a 404 (not in database) it is possible this gets logged as a warn.

Describe the solution you'd like

I think the log level for fallbackResponse should be set to debug since it you have explicitly made an effort to have a fallback.

However, from discussion in discord, it was referenced that this log level should be configurable

Describe alternatives you've considered

Making a configurable option would allow the default to be kept at WARN and you can change it to a different one if needed

Additional context

The warn level appears in 2 locations.

moleculer/src/middlewares/fallback.js

function handleContextFallback(ctx, err) { broker.logger.warn( The '${ctx.action.name}' request is failed. Return fallback response.`, { requestID: ctx.requestID, err: err.message } ); broker.metrics.increment(METRIC.MOLECULER_REQUEST_FALLBACK_TOTAL, { action: ctx.action.name }); ctx.fallbackResult = true;

	if (isFunction(ctx.options.fallbackResponse)) return ctx.options.fallbackResponse(ctx, err);
	else return Promise.resolve(ctx.options.fallbackResponse);
}`

In wrapFallbackMiddleware

svc.logger.warn( The '${ctx.action.name}' request is failed. Return fallback response., { requestID: ctx.requestID, err: err.message } );