mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 02:52:07 +00:00
Start logging what would be stdout and stderr if not daemonized
This commit is contained in:
parent
2db5004c54
commit
0cb5b4370b
@ -220,6 +220,20 @@ class Logger(object):
|
||||
termstate = 0
|
||||
return textdata, termstate
|
||||
|
||||
def write(self, data):
|
||||
"""Write plain text to log
|
||||
|
||||
This is intended so that a log object may be used to replace a
|
||||
normal file object with a loss of capability. For example,
|
||||
sys.stdout = logobject
|
||||
|
||||
:param data: data to log
|
||||
"""
|
||||
self.log(data)
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
def log(self, logdata=None, ltype=None, event=0, eventdata=None):
|
||||
if type(logdata) not in (str, unicode, dict):
|
||||
raise Exception("Unsupported logdata")
|
||||
|
@ -28,6 +28,7 @@ import atexit
|
||||
import confluent.consoleserver as consoleserver
|
||||
import confluent.pluginapi as pluginapi
|
||||
import confluent.httpapi as httpapi
|
||||
import confluent.log as log
|
||||
import confluent.sockapi as sockapi
|
||||
import eventlet
|
||||
#import eventlet.backdoor as backdoor
|
||||
@ -53,6 +54,8 @@ def _daemonize():
|
||||
os.open(os.devnull, os.O_RDWR)
|
||||
os.dup2(0, 1)
|
||||
os.dup2(0, 2)
|
||||
sys.stdout = log.logger('stdout')
|
||||
sys.stderr = log.logger('stderr')
|
||||
|
||||
|
||||
def _updatepidfile():
|
||||
|
Loading…
Reference in New Issue
Block a user