mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
improve logging
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user