Commit 16cc6ead authored by Boris Kocherov's avatar Boris Kocherov

logging improve

parent a962f44f
......@@ -118,15 +118,16 @@ class Handler(object):
openoffice.start()
command_list = self._getCommand(*feature_list, **kw)
stdout, stderr = self._subprocess(command_list)
if not stdout and len(re.findall("\w*Exception|\w*Error", stderr)) >= 1:
logger.debug(stderr)
if not stdout and stderr:
first_error = "first run error: " + stderr
logger.error(stderr)
self.document.restoreOriginal()
openoffice.restart()
kw['document_url'] = self.document.getUrl()
command = self._getCommand(*feature_list, **kw)
stdout, stderr = self._subprocess(command)
if stderr != "":
raise Exception(stderr)
raise Exception(first_error + "\nsecond run error: " + stderr)
return stdout, stderr
......
......@@ -271,8 +271,8 @@ class Manager(object):
del response_dict['meta']['Data']
return (200, response_dict, "")
except Exception, e:
import traceback; traceback.print_exc()
logger.error(e)
import traceback;
logger.error(traceback.format_exc())
return (402, {}, e.args[0])
def run_setmetadata(self, filename='', data=None, meta=None,
......@@ -288,7 +288,8 @@ class Manager(object):
response_dict['data'] = self.updateFileMetadata(data, extension, meta)
return (200, response_dict, '')
except Exception, e:
logger.error(e)
import traceback;
logger.error(traceback.format_exc())
return (402, {}, e.args[0])
def run_getmetadata(self, filename='', data=None, meta=None,
......@@ -307,7 +308,8 @@ class Manager(object):
response_dict['meta']['title'] = response_dict['meta']['Title']
return (200, response_dict, '')
except Exception, e:
logger.error(e)
import traceback;
logger.error('run_getmetadata: ' + traceback.format_exc())
return (402, {}, e.args[0])
def run_generate(self, filename='', data=None, meta=None, extension=None,
......@@ -348,7 +350,8 @@ class Manager(object):
mimetypes.types_map.get('.%s' % extension.split('.')[-1]))
return (200, response_dict, "")
except Exception, e:
logger.error(e)
import traceback;
logger.error(traceback.format_exc())
return (402, response_dict, str(e))
def getAllowedTargetItemList(self, content_type):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment