On this page
logging.error
Prev: logging.disable | Up: logging | Next: logging.exception
Rel: logging.addLevelName, logging.basicConfig, logging.BufferingFormatter, logging.captureWarnings
Ref: docs.python.org — logging.error
Tags: #public #python3 #stdlib #logging
Import
import logging
from logging import error
Signature & Overview
logging.error(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with a pre-defined format.
Usage
import logging
# Logs an ERROR (level 40) message on the root logger
assert logging.ERROR == 40 and callable(logging.error)
Gotchas
- Use
logger.exception(...)insideexcept:blocks: Plainerror()omits the traceback unless you passexc_info=True.
REPL Inspect
from logging import error
help(error)
Linked from
Related notes
- tuts/python3/stdlib_module/logging/disable Linked here; links to this page; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/exception Linked here; links to this page; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/logging/addLevelName Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/basicConfig Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/BufferingFormatter Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/captureWarnings Linked here; shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/critical shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/debug shared tags: #logging, #stdlib
- tuts/python3/stdlib_module/logging/fatal shared tags: #logging, #stdlib