How do I make Topshelf log exceptions to Elmah - elmah

Topshelf is a great little library for wrapping up a windows service. I'm trying to find out if I can configure it to log out exceptions to elmah. From what I can tell it has an internal handler for unhandled exceptions.
http://docs.topshelf-project.com/en/latest/configuration/logging.html
Would it be a case of writing a new logger and submitting a pull request?

Yes. Take a look at the existing logging implementations in the repository to get started. No one has asked for ELMAH before but I don't see why you'd be the only person interested.
You can also just create a new repository, it will be a new nuget package anyways.

Related

Dynamics 365 javascript validator

My question is about using dynamics 365 JavaScript validator on a Managed solution?
will it work on a Managed solution?
I have used the JavaScript Validator and it only shows a log of all the API calls that will be deprecated along with their web resource name and line the code is on.
With this knowledge you can just run it on the managed solution and check
https://www.xrmtoolbox.com/plugins/XrmToolBox.Dynamics365V9JavascriptValidator/
I hate to say that it probably will not matter as you would not be able to update the Managed Solution if it failed anyway. Since Managed Solutions uninstall cleanly, I would:
1.) Create a test environment at trials.dynamics.com then install the Solution.
2.) Test the Solution to see if it performs appropriately.
3.) Attempt to uninstall the Solution cleanly.
You should have your answer there.
Additionally, check with the Publisher to see if there are any updates. Hope that helps.

Where can I find request and response logs for Spark?

I have just started using Spark framework. And experimenting with a local server on Mac OS
The documentation says that to enable debug logs I simply need to add a dependency.
I've added a dependency and can observe logs in the console.
The question is where the log files are located?
If you are following the Spark example here, you are only enabling slf4j-simple logging. By default, this only logs items to the console. You can change this programmatically (Class information here) or by adding a properties file to the classpath, as seen in this discussion. Beyond this you will likely want to implement a logging framework like log4j or logback, as slf4j is designed to act as a facade over an existing logging implementation.

Google Java API conflicted with ColdFusion CFHTTP?

I tried copying all those JAR's found in the google-api-client-assembly-1.20.0-1.20.01.zip (downloaded from https://developers.google.com/api-client-library/java/google-api-java-client/download) to {cf_root}/lib, restart ColdFusion, and everything loaded up fine. However, when I used <cfhttp>:
org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [CfmServlet] in context with path [/] threw exception [org.apache.http.impl.client.DefaultHttpClient.setRedirectStrategy(Lorg/apache/http/client/RedirectStrategy;)V] with root cause
java.lang.NoSuchMethodError: org.apache.http.impl.client.DefaultHttpClient.setRedirectStrategy(Lorg/apache/http/client/RedirectStrategy;)V
at coldfusion.tagext.net.HttpTag.createConnection(HttpTag.java:1728)
at coldfusion.tagext.net.HttpTag.connHelper(HttpTag.java:928)
at coldfusion.tagext.net.HttpTag.doEndTag(HttpTag.java:1219)
When I remove all of the google jars from {cf_root}/lib, it works as expected again. My workaround would be using the tokeninfo endpoint instead of com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier, but Google recommends against it for production use.
The easiest way to validate an ID token is to use the tokeninfo
endpoint. Calling this endpoint involves an additional network request
that does most of the validation for you, but introduces some latency
and the potential for network errors. For these reasons, it is
suitable only for deployments with fewer than 100 monthly active
users, as well as for debugging and informational purposes.
https://developers.google.com/identity/sign-in/ios/backend-auth
Any better solution to get around org.apache.http.impl.client.DefaultHttpClient being resolved to something else once the Jar's from google are loaded in ColdFusion?
(From comments)
Sounds like the jar that is conflicting is httpclient-4.0.1.jar. Removing it should resolve that specific error. However, it probably will not be the only conflict/error. A lot of the jars are pretty common, and could be used by CF as well, for example commons-logging-1.1.1.jar.
Since you are using CF10, have you tried loading the jars in your Application.cfc using the new feature this.javaSettings? It is basically a rip of Mark Mandel's JavaLoader.cfc. Just specify the paths of the jars you wish to load, or the directories to check for jars, ie
THIS.javaSettings = {LoadPaths = [".\folder\",".\folder\someLib.jar"] };
Obviously when using this feature, do not put the jars in {cf_root}\lib, or anywhere else in the CF class path, as it defeats the purpose of dynamic class loading.

WebService Task in Camunda

In Camunda BPM designer, I couldn't find activity and for invoking a REST or SOAP based webservices. Is it only possible to invoke through wiring code? How do I pass payload to the code if it needs to be written using java code.
Regards,
Phani
You can invoke a Webservice inside a bpmn.
You can create a Task of type Service, and choose in Properties/Details/Implementation: Connector.
Next you configure Connector properties, setting:
Connector Id: http-connector (for rest json webservices) and
Input Parameters:
url (e.g. http://localhost:8080/client?id=12
method GET/POST
headers type MAP: Accept application/json...
You receive the webservice response as Process Variables, configuring the Output parameters as follows :
response, type text, value ${response}
returnCode, type text, value ${statusCode}
Hope this helps you
For start: please note that camundas claim is "developer friendly". It's never been the goal of camunda components to just "click together" a working process. If you are looking for such a solution, you should a) have a look at the zero coding myth and b) maybe choose another tool.
That being said, check out the camunda-connect framework, introduced with 7.2, it should do what you need (though it involves xml coding).
For all but the most simple SOAP / REST calls, you'll need to go through java code. This takes a little getting used to when moving from other BPM platforms with extensive built-in webservice support. But trust me, java code is the way to go - import of transform / WSDL in the process definiton becomes such a holy mess.
I've written two CXF-based examples: soap-cxf-service and soap-cxf-server-start which will get you started.
I recommend creating a maven artifact per webservice and just adding the required services as standard maven dependencies for your process project.

Business Process "Observer" application

My client is requesting to be notified any time one of their business processes fails for any reason. I had the idea of writing a seperate application that will run as an "observer" and check for various parts of the process.
An example would be that a daily file was generated and uploaded to an FTP location. The "Observer" might have the following "tests" :
Connect to the FTP
Go to folder where file should exist
Find file with naming convention
Verify create date of file
Failure of any step will send an alert email and also log to a report (both in case database is down OR email is down).
My question is.... Are there any products out there that do something close to this? I'd rather buy if there is something robust out there. If not, this almost seems like a unit test platform... Anything out there for testing I could potentially repurpose?
As an FYI, we are a Microsoft/Windows based shop.
Thx in advance!
You could even use a Continuous Integration framework for this. They normally monitor source code repositories and build&test things, but could be used for this as well.
For instance, Hudson, Jenkins and CrouseControl.NET are a few open source ones that are good and can easily be set up for something like this. Only change the monitoring of a repository to either filesystem over FTP and write a small script which checks what you need. Everything else comes for free by the framework, i.e. email, web interface for monitoring and running things.
Just an idea.