Package ganeti :: Module utils :: Class LogFileHandler
[hide private]
[frames] | no frames]

Class LogFileHandler

source code


Log handler that doesn't fallback to stderr.

When an error occurs while writing on the logfile, logging.FileHandler tries to log on stderr. This doesn't work in ganeti since stderr is redirected to the logfile. This class avoids failures reporting errors to /dev/console.

Instance Methods [hide private]
 
__init__(self, filename, mode="a", encoding=None)
Open the specified file and use it as the stream for logging.
source code
 
handleError(self, record)
Handle errors which occur during an emit() call.
source code

Inherited from logging.FileHandler: close, emit

Inherited from logging.FileHandler (private): _open

Inherited from logging.StreamHandler: flush

Inherited from logging.Handler: acquire, createLock, format, handle, release, setFormatter, setLevel

Inherited from logging.Filterer: addFilter, filter, removeFilter

Method Details [hide private]

__init__(self, filename, mode="a", encoding=None)
(Constructor)

source code 

Open the specified file and use it as the stream for logging.

Also open /dev/console to report errors while logging.

Overrides: logging.Filterer.__init__

handleError(self, record)

source code 

Handle errors which occur during an emit() call.

Try to handle errors with FileHandler method, if it fails write to /dev/console.

Overrides: logging.Handler.handleError