added logging via log4j
This commit is contained in:
@ -268,5 +268,9 @@
|
||||
<artifactId>shared-util</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -2,6 +2,7 @@ package de.muehlencord.shared.sharepoint.api;
|
||||
|
||||
import javax.xml.bind.ValidationEvent;
|
||||
import javax.xml.bind.ValidationEventHandler;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -9,6 +10,8 @@ import javax.xml.bind.ValidationEventHandler;
|
||||
*/
|
||||
public class SPValidationEventHandler implements ValidationEventHandler {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(SPValidationEventHandler.class);
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(ValidationEvent event) {
|
||||
|
||||
@ -16,17 +19,16 @@ public class SPValidationEventHandler implements ValidationEventHandler {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
System.out.println("\nEVENT");
|
||||
System.out.println("SEVERITY: " + event.getSeverity());
|
||||
System.out.println("MESSAGE: " + event.getMessage());
|
||||
// System.out.println("LINKED EXCEPTION: " + event.getLinkedException());
|
||||
System.out.println("LOCATOR");
|
||||
System.out.println(" LINE NUMBER: " + event.getLocator().getLineNumber());
|
||||
System.out.println(" COLUMN NUMBER: " + event.getLocator().getColumnNumber());
|
||||
System.out.println(" OFFSET: " + event.getLocator().getOffset());
|
||||
System.out.println(" OBJECT: " + event.getLocator().getObject());
|
||||
System.out.println(" NODE: " + event.getLocator().getNode());
|
||||
System.out.println(" URL: " + event.getLocator().getURL());
|
||||
LOGGER.error("\nEVENT");
|
||||
LOGGER.error("SEVERITY: " + event.getSeverity());
|
||||
LOGGER.error("MESSAGE: " + event.getMessage());
|
||||
LOGGER.error("LOCATOR");
|
||||
LOGGER.error(" LINE NUMBER: " + event.getLocator().getLineNumber());
|
||||
LOGGER.error(" COLUMN NUMBER: " + event.getLocator().getColumnNumber());
|
||||
LOGGER.error(" OFFSET: " + event.getLocator().getOffset());
|
||||
LOGGER.error(" OBJECT: " + event.getLocator().getObject());
|
||||
LOGGER.error(" NODE: " + event.getLocator().getNode());
|
||||
LOGGER.error(" URL: " + event.getLocator().getURL());
|
||||
|
||||
switch (event.getSeverity()) {
|
||||
case ValidationEvent.WARNING:
|
||||
@ -41,10 +43,3 @@ public class SPValidationEventHandler implements ValidationEventHandler {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* History:
|
||||
*
|
||||
* $$Log$$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package de.muehlencord.shared.sharepoint.api;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import javax.xml.namespace.QName;
|
||||
@ -8,6 +9,7 @@ import javax.xml.soap.SOAPMessage;
|
||||
import javax.xml.ws.handler.MessageContext;
|
||||
import javax.xml.ws.handler.soap.SOAPHandler;
|
||||
import javax.xml.ws.handler.soap.SOAPMessageContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -15,6 +17,8 @@ import javax.xml.ws.handler.soap.SOAPMessageContext;
|
||||
*/
|
||||
public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(ServiceLogHandler.class);
|
||||
|
||||
@Override
|
||||
public Set<QName> getHeaders() {
|
||||
// TODO Auto-generated method stub
|
||||
@ -40,29 +44,24 @@ public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(SOAPMessageContext arg0) {
|
||||
/* // TODO make configrable via logger
|
||||
LOGGER.info ("Test");
|
||||
SOAPMessage message = arg0.getMessage();
|
||||
boolean isOutboundMessage = (Boolean) arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
|
||||
if (isOutboundMessage) {
|
||||
System.out.println("OUTBOUND MESSAGE\n");
|
||||
LOGGER.debug("OUTBOUND MESSAGE");
|
||||
} else {
|
||||
System.out.println("INBOUND MESSAGE\n");
|
||||
LOGGER.debug("INBOUND MESSAGE");
|
||||
}
|
||||
try {
|
||||
message.writeTo(System.out);
|
||||
System.out.println();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
message.writeTo(os);
|
||||
LOGGER.debug (os.toString("UTF-8"));
|
||||
os.close();
|
||||
} catch (SOAPException | IOException e) {
|
||||
// TODO add error handling
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* History:
|
||||
*
|
||||
* $$Log$$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -306,10 +306,3 @@ public class SPList extends SPJaxbObject<List> {
|
||||
|
||||
/* *** unsorted *** */
|
||||
}
|
||||
|
||||
/**
|
||||
* History:
|
||||
*
|
||||
* $$Log$$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -25,7 +25,6 @@ public class SPSite extends SPObject {
|
||||
public void getRootWeb() throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException {
|
||||
String rootWebUrl = StringUtils.removeEndIgnoreCase(getContext().getSiteURL().toString(), "/");
|
||||
GetWebResponse.GetWebResult result = getWebsPort(getContext().getSiteURL()).getWeb(rootWebUrl);
|
||||
// System.out.println (result);
|
||||
}
|
||||
|
||||
private WebsSoap getWebsPort(URL webUrl) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException {
|
||||
|
||||
Reference in New Issue
Block a user