diff --git a/pandacommon/pandalogger/PandaLogger.py b/pandacommon/pandalogger/PandaLogger.py index 17edf1d..d9b19bf 100755 --- a/pandacommon/pandalogger/PandaLogger.py +++ b/pandacommon/pandalogger/PandaLogger.py @@ -62,8 +62,8 @@ def run(self): h.putrequest(self.method, url) if self.method == "POST": h.putheader("Content-length", str(len(self.data))) - h.putheader ("Content-type", "application/json; charset=UTF-8") - h.endheaders() + h.endheaders() + if self.method == "POST": h.send(self.data) response = h.getresponse() # can't do anything with the result #for s in self.getData(response, 1024): @@ -115,7 +115,7 @@ def mapLogRecord(self, record): """ Default implementation of mapping the log record into a dict that is sent as the CGI data. Overwrite in your class. - Contributed by Franz Glasner. + Contributed by Franz Glasner. """ newrec = record.__dict__ for p in self.params: @@ -143,10 +143,9 @@ def emit(self, record): # The new logger needs to be json encoded and use POST method if self.encoding == JSON: - arr=[{ "headers":{"timestamp" : int(time.time())*1000, "host" : "%s:%s"%(self.url, self.port)}, - "body": "{0}".format(json.dumps(self.mapLogRecord(record))) + "body": "%s"%self.mapLogRecord(record) }] data = json.dumps(arr) else: diff --git a/setup.py b/setup.py index fb81c7d..096b320 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ def run (self): # remove build/*/dump for bdist patt = re.sub('build/[^/]+/dumb','',patt) # remove /var/tmp/*-buildroot for bdist_rpm - patt = re.sub('/var/tmp/.*-buildroot','',patt) + patt = re.sub('/var/tmp/.*-buildroot','',patt) # replace filedata = filedata.replace('@@%s@@' % item, patt) # write to dest @@ -99,7 +99,6 @@ def run (self): 'pandacommon.liveconfigparser', 'pandacommon.pandalogger', 'pandacommon.pandautils', - 'pandacommon.test', ], data_files=[ ('/etc/panda',