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