Node level logging

Hello Everyone,

I wonder if there is a way to maintain structured logging for each node

I sometimes need to know why certain value is missing or why workload behave in a certain way.

I had to add the logging my self by writing a line to a file. I had many write to binary file node branching from different main parts in the workflow, but still I feel it’s not an efficient way.

Hi Ali,

This is likely to come up for other people too. Like you, I started by logging to files but then found LoggerProxy.

For anyone else, set the n8n debug level using the ENV variable N8N_LOG_LEVEL=debug then use logging commands like the following.

import {
LoggerProxy as Logger
} from ‘n8n-workflow’;

// Info-level logging of a trigger function, with workflow name and workflow ID as additional metadata properties

Logger.info(Polling trigger initiated for workflow "${workflow.name}", {workflowName: workflow.name, workflowId: workflow.id});