Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created May 13, 2021 03:48
Show Gist options
  • Save Abhayparashar31/85a31fbcfa877fef6bac559e40d003b8 to your computer and use it in GitHub Desktop.
Save Abhayparashar31/85a31fbcfa877fef6bac559e40d003b8 to your computer and use it in GitHub Desktop.
import logging
import logging.config
## Loads The Config File
logging.config.fileConfig('logging.conf')
# create a logger with the name from the config file.
# This logger now has StreamHandler with DEBUG Level and the specified format in the logging.conf file
logger = logging.getLogger('simpleExample')
## Log Messages
logger.debug('debug message')
logger.info('info message')
---------------------------CONSOLE OUTPUT----------------------------
2021-05-13 09:16:23,263 - simpleExample - DEBUG - debug message
2021-05-13 09:16:23,263 - simpleExample - INFO - info message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment