pyworkflow.utils.log module

Module to handle default logging configuration and custom one. Default logging configuration is defined here but optionally, it can be configured with an external json file containing a standard python logging configuration content as documented here: To specify a custom logging config file use SCIPION_LOG_CONFIG variable to a json logging configuration file If you just want to change the logger devel use SCIPION_LOG_LEVEL variable (defaults to INFO) See for available levels. Use the literal! not de value.

class pyworkflow.utils.log.LevelFilter(level)[source]

Bases: object

Logging handler filter to filter some levels. e.g.: ERROR


level – Level integer value,from which include messages. Value is compared to record.levelno.

class pyworkflow.utils.log.LoggingConfigurator[source]

Bases: object

Class to configure logging scenarios:

1.- GUI logging

2.- Protocol run logging

3.- Other loggings: tests, sync data

customLoggingActive = False
classmethod loadCustomLoggingConfig()[source]

Loads the custom logging configuration file

classmethod setUpGUILogging(logFile=None)[source]

Sets up the logging library for the GUI processes: By default all goes to SCIPION_LOG file and console.

classmethod setUpProtocolRunLogging(stdoutLogFile, stderrLogFile)[source]

Sets up the logging library for the protocols run processes, loads the custom configuration plus 2 FileHandlers for stdout and stderr

classmethod setUpProtocolSchedulingLog(scheduleLogFile)[source]

Sets up the logging for the scheduling process

static setupDefaultLogging(logFile=None, console=True)[source]

Configures logging in a default way that is to file (rotating) and console

  • logFile – Optional, path to the log file. Defaults to SCIPION_LOG variable value. If folder does not exists it will be created.

  • console – Optional, defaults to True, so log messages are sent to the terminal as well

classmethod setupLogging(logFile=None, console=True)[source]
class pyworkflow.utils.log.STATUS[source]

Bases: object

pyworkflow.utils.log.getExtraLogInfo(measurement, status, project_name=None, prot_id=None, prot_name=None, step_id=None, duration=None, dbfilename=None)[source]
pyworkflow.utils.log.setDefaultLoggingContext(protId, projId)[source]