1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

Activate full calddav debug trace if wire DEBUG selected

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@258 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2008-12-26 12:35:08 +00:00
parent cb9ed86e1d
commit 723bb01c29
2 changed files with 10 additions and 4 deletions

View File

@ -89,8 +89,6 @@ public class AbstractConnection extends Thread {
public void sendClient(byte[] messageBytes) throws IOException {
StringBuffer logBuffer = new StringBuffer("> ");
logBuffer.append(new String(messageBytes));
// TODO : create a wire debug level
// DavGatewayTray.debug(logBuffer.toString());
os.write(messageBytes);
os.flush();
}

View File

@ -8,6 +8,7 @@ import davmail.tray.DavGatewayTray;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.auth.AuthenticationException;
import org.apache.log4j.Logger;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
@ -26,11 +27,14 @@ import java.util.*;
* Handle a caldav connection.
*/
public class CaldavConnection extends AbstractConnection {
protected Logger wireLogger = Logger.getLogger(this.getClass());
protected boolean closed = false;
// Initialize the streams and start the thread
public CaldavConnection(Socket clientSocket) {
super("CaldavConnection", clientSocket, "UTF-8");
wireLogger.setLevel(Settings.getLoggingLevel("httpclient.wire"));
}
protected Map<String, String> parseHeaders() throws IOException {
@ -158,7 +162,9 @@ public class CaldavConnection extends AbstractConnection {
public void handleRequest(String command, String path, Map<String, String> headers, String body) throws IOException {
int depth = getDepth(headers);
// full debug trace
// DavGatewayTray.debug("command: " + command + " " + path + " Depth: " + depth + "\n" + body);
if (wireLogger.isDebugEnabled()) {
wireLogger.debug("Caldav command: " + command + " " + path + " depth: " + depth + "\n" + body);
}
if ("OPTIONS".equals(command)) {
sendOptions();
@ -488,7 +494,9 @@ public class CaldavConnection extends AbstractConnection {
sendClient("");
if (content != null && content.length() > 0) {
// full debug trace
// DavGatewayTray.debug("> " + content);
if (wireLogger.isDebugEnabled()) {
wireLogger.debug("> " + content);
}
sendClient(content.getBytes("UTF-8"));
}
}