mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 16:56:08 +02:00
improve cgi logging
This commit is contained in:
@@ -99,14 +99,17 @@ public class CGIRunner
|
||||
* @param pathInfo
|
||||
* @param req
|
||||
* @param res
|
||||
* @param serverPort
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void exec(EnvList environment, File command, String pathInfo,
|
||||
HttpServletRequest req, HttpServletResponse res, int serverPort)
|
||||
HttpServletRequest req, HttpServletResponse res,
|
||||
int serverPort)
|
||||
throws IOException
|
||||
{
|
||||
exec(environment, defaultCmdPrefix, command, pathInfo, req, res, serverPort);
|
||||
exec(environment, defaultCmdPrefix, command, pathInfo, req, res,
|
||||
serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,6 +123,7 @@ public class CGIRunner
|
||||
* @param pathInfo
|
||||
* @param req
|
||||
* @param res
|
||||
* @param serverPort
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@@ -209,6 +213,11 @@ public class CGIRunner
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("execute cgi: ".concat(execCmd));
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(environment.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Process p = (dir == null)
|
||||
@@ -235,7 +244,7 @@ public class CGIRunner
|
||||
if (inLength > 0)
|
||||
{
|
||||
copy(inFromReq, outToCgi, inLength);
|
||||
}
|
||||
}
|
||||
|
||||
outToCgi.close();
|
||||
}
|
||||
@@ -263,10 +272,20 @@ public class CGIRunner
|
||||
String line = null;
|
||||
InputStream inFromCgi = p.getInputStream();
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("CGI-Response Header:");
|
||||
}
|
||||
|
||||
// br=new BufferedReader(new InputStreamReader(inFromCgi));
|
||||
// while ((line=br.readLine())!=null)
|
||||
while ((line = getTextLineFromStream(inFromCgi)).length() > 0)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(" ".concat(line));
|
||||
}
|
||||
|
||||
if (!line.startsWith("HTTP"))
|
||||
{
|
||||
int k = line.indexOf(':');
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.web.cgi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -38,6 +40,7 @@ import sonia.scm.util.Util;
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -91,7 +94,24 @@ public class EnvList
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return envMap.toString();
|
||||
String s = System.getProperty("line.separator");
|
||||
StringBuilder out = new StringBuilder("Enironment:");
|
||||
|
||||
out.append(s);
|
||||
|
||||
Iterator<String> it = envMap.values().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
out.append(" ").append(it.next());
|
||||
|
||||
if (it.hasNext())
|
||||
{
|
||||
out.append(s);
|
||||
}
|
||||
}
|
||||
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user