Python Logger

You can use NeptuneHandler to store logs from Python's Logger as a Runs metadata.


Python Logger integration is part of the Neptune Client Library and requires no additional installation. Simply import the NeptuneHandler from the integrations module in your script.

from import NeptuneHandler


A Handler object that sends the log records created by the logger to which it's attached to Neptune. Logs will be stored as a StringSeries field.


Initializes a NeptuneHandler object.



(Run) - An existing run reference (as returned by neptune.init()).


(int, optional, default is logging.NOTSET) - Log level of the logs to be captured by the handler. Defaults to logging.NOTSET, which captures all logs that match logger's level.


(str, optional, default is None) - Path to the StringSeries field used for captured logs. If None, tracked metadata will be stored inside monitoring_namespace.


# Create a Python's Logger
import logging
logger = logging.getLogger("root_experiment")
# Instantiate a Run object
import as neptune
run = neptune.init(project="neptune/sandbox")
# Create a NeptuneHandler object to capture the logs
from import NeptuneHandler
npt_handler = NeptuneHandler(run=run)
# Log something to the logger
logger.debug("Starting data preparation")
logger.debug("Data preparation done")