Skip to content

Python Logger#

You can use NeptuneHandler to track logs from the Python Logger.


A handler that sends the records created by the logger to Neptune.

Logs will be stored as a StringSeries field.


Name Type Default       Description
run Run, optional None An existing run reference, as returned by neptune.init_run().
level int, optional logging.NOTSET Log level of the logs to be captured by the handler. Defaults to logging.NOTSET, which captures all logs that match the logger level.
path str, optional None Path to the StringSeries field used for captured logs. If None, tracked metadata will be stored under the monitoring namespace.


# Create a logger
import logging
logger = logging.getLogger("root_experiment")

# Create a run
import as neptune
run = neptune.init_run()

# 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")