Python logger module

Code examples

8
0

logging.logger

import logging

logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
  
logger.debug("some debugging...")
logger.error("some error...")
4
0

create log in python

logging.basicConfig(filename="logfilename.log", level=logging.INFO)
# Log Creation

logging.info('your text goes here')
logging.error('your text goes here')
logging.debug('your text goes here')
1
0

python fme logger

logger = fmeobjects.FMELogFile()
logger.logMessageString("{}".format('Error'), fmeobjects.FME_ERROR)
1
0

python log file

import logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
logging.error('And non-ASCII stuff, too, like Øresund and Malmö')
0
0

logging python

logging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG)
-2
0

python logging

!python -m unittest test_volume_cuboid.py

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................