improve logging

This commit is contained in:
Sebastian Sdorra
2011-09-30 08:37:48 +02:00
parent a092d6b79f
commit 47f0272f56

View File

@@ -174,6 +174,7 @@ public class HgUtil
output = p.getOutputStream();
IOUtil.copy(resource, output);
output.close();
handleErrorStream(p.getErrorStream());
input = p.getInputStream();
result = (T) context.createUnmarshaller().unmarshal(input);
input.close();
@@ -266,4 +267,39 @@ public class HgUtil
? REVISION_TIP
: revision;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param errorStream
*/
private static void handleErrorStream(final InputStream errorStream)
{
if (errorStream != null)
{
new Thread(new Runnable()
{
@Override
public void run()
{
try
{
String content = IOUtil.getContent(errorStream);
if (Util.isNotEmpty(content))
{
logger.error(content.trim());
}
}
catch (IOException ex)
{
logger.error("error during logging", ex);
}
}
}).start();
}
}
}