paulswithers / openlogjava Goto Github PK
View Code? Open in Web Editor NEWStatic Java Class for OpenLog from Java. PhaseListener to automatically generate OpenLog error for any SSJS errors.
License: Apache License 2.0
Static Java Class for OpenLog from Java. PhaseListener to automatically generate OpenLog error for any SSJS errors.
License: Apache License 2.0
Actually, I think I'll add another property, xsp.openlog.genericErrorMessage, so you can leave it switched on and just log a generic message
Currently for properties you have to use this and for events this.getParent() to pass component. Ideally, it would use just this.
We're using it now but, as you know, logs can get quite big. For those of us using standard server archiving it would be nice to have something that would populate the ExpireDate field. It could be based on a couple of additional xsp property values that would enable/disable archiving and set the number of days to keep in the log before archiving. Default would be disabled.
Fixed in OpenNTF Domino API
try {
msg = "Unexpected error class: " + fe.getCause().getClass().getName() + "\n Message recorded is: "
+ fe.getCause().getLocalizedMessage();
} catch (Throwable ee) {
msg = fe.getLocalizedMessage();
}
From Steven Rieger. Approach taken is to use xsp.openlog.createOnFail=true
Added xsp.openlog.email property. If used, creates log doc in mail.box (Domino automatically handles if multiple mailboxes are in use on the server, automatically re-routing mail.box to mail1.box etc).
Using the OSGi plugin (M5), I have the XSP property set to correctly point at my OpenLog NSF and things work as expected with the exception of:
my NSFs that inherit from the same design template all seem to, when they throw a run-time error, pile them all under whichever NSF first logged an item for that day.
@paulswithers, I figured we could capture this here since we talked about it on Skype previously; let me know if I can help test anything on this.
I'm having some difficulties with the OpenLog, it looks like an exception could not be caught…
see screenshot & stack trace:
Stack Trace
java.lang.ClassCastException: com.ibm.jscript.parser.ParseException incompatible with com.ibm.jscript.InterpretException
at com.paulwithers.openLog.OpenLogPhaseListener.processUncaughtException(OpenLogPhaseListener.java:181)
at com.paulwithers.openLog.OpenLogPhaseListener.afterPhase(OpenLogPhaseListener.java:89)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:218)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
at com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270)
at com.ibm.xsp.webapp.FacesServlet.renderFacesPage(FacesServlet.java:606)
at com.ibm.xsp.webapp.FacesServlet.renderErrorPage(FacesServlet.java:501)
at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:183)
at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Some uncaught exceptions use different Java classes to those caught. The symptom is an error in OpenLogPhaseListener.
In class OpenLogItem, I've added the two lines :
After "rtitem.addNewLine();" :
logDoc.replaceItemValue("LogMessage", "Message, greater than 32k, is stored inside.");
Before "logDoc.replaceItemValue("LogMessage", getMessage());" :
logDoc.replaceItemValue("LogErrorMessage", errMsg + " - " + getMessage());
Seams like they are happening above the phaselistener, but I don't know where?
What class is causing it ?
Any ideas how to catch them ?
java.lang.NullPointerException
at com.qnova.core.openLog.OpenLogPhaseListener.processUncaughtException(OpenLogPhaseListener.java:187)
at com.qnova.core.openLog.OpenLogPhaseListener.afterPhase(OpenLogPhaseListener.java:83)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:218)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
at com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:264)
at com.ibm.xsp.webapp.FacesServlet.renderFacesPage(FacesServlet.java:572)
at com.ibm.xsp.webapp.FacesServlet.renderErrorPage(FacesServlet.java:466)
at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:183)
at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:583)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1281)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:860)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:803)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:572)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1265)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:658)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:481)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Similar to functionality in ODA
It seams like the Phaselistener needs to check for more types of exceptions because I'm getting this
java.lang.ClassCastException: lotus.domino.NotesException incompatible with com.ibm.xsp.exception.EvaluationExceptionEx
at com.paulwithers.openLog.OpenLogPhaseListener.processUncaughtException(OpenLogPhaseListener.java:214)
at com.paulwithers.openLog.OpenLogPhaseListener.afterPhase(OpenLogPhaseListener.java:83)
Also seen the same type of error but something with Serializable
java.lang.ClassCastException: java.io.NotSerializableException incompatible with com.ibm.xsp.exception.EvaluationExceptionEx
Happens if the error is in a large SSJS library
Thrown if error hits during beforePageLoad?? This was encountered with Controller class. The following if statement works round it (in setThisAgent(currPage), but fromPage is still outputted as blank.
if (StringUtil.isEmpty(historyUrls)) {
fromPage = ExtLibUtil.getXspContext().getUrl().toSiteRelativeString(ExtLibUtil.getXspContext());
} else {
if (currPage) {
fromPage = historyUrls[0];
} else {
if (historyUrls.length > 1) {
fromPage = historyUrls[1];
} else {
fromPage = historyUrls[0];
}
}
}
If used from a database that has anonymous access and logs are emailed, it tries to access the mail.box as Anonymous, which fails.
Hi paul,
I've added these exceptions to the catch section to get some more errors I've found
import lotus.domino.NotesException;
import java.io.IOException;
}else if("lotus.domino.NotesException".equals(error.getClass().getName())) {
NotesException e = (NotesException) error;
String msg = "Notes Exception:";
msg = error.toString();
OpenLogItem.logErrorEx(e.getCause(), msg, null, null);
}else if("java.io.IOException".equals(error.getClass().getName())) {
IOException e = (IOException) error;
String msg = "Java IO:";
msg = error.toString();
OpenLogItem.logErrorEx(e.getCause(), msg, null, null);
Throws an NPE line 555 in OpenLogErrorHolder.addFacesMessageForError()
If the code does a context.reloadPage() or context.redirectToPage() requestScope is cleared, so the error doesn't get logged.
Use param.get("$$xspsubmitid") to get eventHandler triggering the process that causes the error. Use getParent() from eventHandler to get component triggering the process.
Need to handle if the component does not have id.
Maybe have a separate method that, if there's an error, just returns a blank string??
Can use ValueBindingUtil.isValueBindingExpression(String paramString) to check if it's a value binding.
Will this need amending to handle EL?
For OpenNTF API version, use Formula Helper, to allow users to enter an @formula
For the Two Errors, Error on Load and Error on Click I just get the message..
com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression
The Error on Property and Error on Method give the detailed message though
Feature Request
Using the OSGi plugin (M5) implementation, I've noticed I receive only the root XPage name for any run-time errors. I would like to grab the full URL with query parameters (I know, call me greedy).
Again, if I can help test anything, please let me know.
In addFacesMessagedd variable to requestScope map and check for its presence
See TODO notes for what needs doing
Should be able to amend code to use:
error instanceof com.ibm.xsp.exception.EvaluationExceptionEx
instead of:
"com.ibm.xsp.exception.EvaluationExceptionEx".equals(error.getClass().getName())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.