Subversion Repositories SmartDukaan

Rev

Rev 20125 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20125 Rev 20130
Line 23... Line 23...
23
		self.stdin = stdin
23
		self.stdin = stdin
24
		self.stdout = stdout
24
		self.stdout = stdout
25
		self.stderr = stderr
25
		self.stderr = stderr
26
		self.pidfile = pidfile
26
		self.pidfile = pidfile
27
		if stdout!='/dev/null':
27
		if stdout!='/dev/null':
28
			thriftLogger = logging.getLogger("thrift")
-
 
29
			ch = logging.StreamHandler(sys.stdout)
-
 
30
			thriftLogger.setLevel(logging.ERROR)
28
			configure_logging()
31
			thriftLogger.addHandler(ch)
-
 
32
 
-
 
33
	
29
	
34
	def daemonize(self):
30
	def daemonize(self):
35
		"""
31
		"""
36
		do the UNIX double-fork magic, see Stevens' "Advanced 
32
		do the UNIX double-fork magic, see Stevens' "Advanced 
37
		Programming in the UNIX Environment" for details (ISBN 0201563177)
33
		Programming in the UNIX Environment" for details (ISBN 0201563177)
Line 143... Line 139...
143
		You should override this method when you subclass Daemon. It will be called after the process has been
139
		You should override this method when you subclass Daemon. It will be called after the process has been
144
		daemonized by start() or restart().
140
		daemonized by start() or restart().
145
		"""
141
		"""
146
		pass
142
		pass
147
 
143
 
148
def configure_logging(logfile):
-
 
149
	fh = logging.FileHandler(logfile)
-
 
150
	formatter = logging.Formatter(logging.BASIC_FORMAT)
-
 
151
	fh.setFormatter(formatter)
-
 
152
	root = logging.getLogger()
-
 
153
	root.setLevel(logging.ERROR)
-
 
154
	root.addHandler(fh)
-
 
155
144
def configure_logging():
-
 
145
	thriftLogger = logging.getLogger("thrift")
-
 
146
	ch = logging.StreamHandler(sys.stdout)
-
 
147
	thriftLogger.setLevel(logging.ERROR)
-
 
148
	thriftLogger.addHandler(ch)
-
 
149