Debugging Spring Cloud Dataflow apps - intellij-idea

I am fairly new to Spring so this might be a bit of a remedial question, but how does one attach a debugger to a custom SCDF stream app? I have found plenty of resources on how to do a remote debugging session for standard Spring apps using IntelliJ, but that doesn't help when its the local dataflow server that spins up the stream app (which has to be done if you are working with processors or sinks). I have found how to do essentially println statements so I can write debug statements to a console window but that is...sub optimal. I really need to be able to attach a debugger and see who's doing what to whom.
I'm sure there is something basic I am missing. Can someone just give me a gentle nudge on how to debug a source, processor and/or sink app, please?

We have attempted to add support to debug SCDF orchestrated apps via spring-cloud/spring-cloud-dataflow#502. We are revisiting the support for it, though. If you've any ideas around this, please feel free to submit a PR - we would happy to collaborate with you on that.
In the meantime, you could use --local.inheritLogging=true property to pipe all the application logs that belong in a stream to the server console. Once you've enabled DEBUG logs for the desired packages at each app level, you will be able to see the composite logs all in one console.

Related

How to understand the ternjs framework

I am going to create a language specific tool to support hight-lighting, code completion etc and found ternjs is a good framework to use. I read the document from http://ternjs.net/doc/ but not quite understand how it works. Based on that document ternjs needs a server to be launched to support the client side. I inspected the on line demo from http://ternjs.net/doc/demo/#simple. When I type command in this demo, I didn't see any http communication happens between my browser and the ternjs server. I am confused about how ternjs server work in this case. Is there a way for me to setup one locally?

Worklight Analytics, Native Java API, no messages in dashboard

Worklight 6.2.0
Native Worklight App on Samsung Galaxy S4, Android 4.4.2
WLAnalytics.enable();
WLAnalytics.log("some text", new org.json.JSONOBject() );
WLAnalytics.send();
// and also go on to successfully call an adapter
Analytics Dasboard shows the app version and adapter activity. Log Search does not show any application log messages and the dropdown for selecting applications shows "All Applications" only, no sign of my app.
Have I missed some initialisation step? Any other ideas?
** edited to add **
It has been suggested that we should use the method:
WLAnalytics.log("some text");
In our 6.2.0.00 CLI environment there is no such Java method.
The answer is that there a further initialisation requirement that seems to be necessary when working with a pure Native application, these are typically build using the Worklight CLI tooling.
This is the initialisation, note the call to Logger.setContext()
WLAnalytics.enable();
Logger.setContext(this);
Then this works
WLAnalytics.log("My test message2", new org.json.JSONObject());
It's worth noting that the call to WLAnalytics.send() is not necessary in normal running as typically the analytic data is buffered and sent as a piggy-back on adapter calls. However while testing a call to send() does help.
Further, if running in an environment where the Analytics WAR is on a separate machine from the Worklight Server WAR there are additional latencies. Hence testing all of this needs care.
For now, I suggest that you just use the WLAnalytics.log(String) method. There are some clear inconsistencies that need to be dealt with whether it be through documentation or code fixes.
The WL.Logger APIs were originally created to send log data to a custom adapter, which is why they take a dictionary/object for extra metadata. The data sent to the custom adapter could be read as a valid JSON object to run operations on the adapter.
The WL.Analytics APIs mimicked the WL.Logger APIs for the same purpose: parsing the JSON on a worklight adapter. The Operational analytics server came as a convenience to intercept and display some of these logs, but not all of them are being captured as you have learned.
Your questions are all valid though, as none of this is described in the documentation. In future releases, we may make use of the extra JSON object passed into the API in the Operational analytics console, but for right now they only serve their original purpose of sending the analytics to a custom adapter.

ASP.MVC 4, Azure Caching: Error on both local and remote - "role discovery data is unavailable"

Whew...ok, been wrestling with this for a while and I can't figure out what is going on.
I am new to Azure caching, but at this point I have read a good bit and I think I have it setup right, but something is obviously wrong so what do I know?
Ok, so first I setup a dedicated caching web worker role using this fine tutorial: http://berniecook.wordpress.com/2013/01/27/distributed-caching-in-azure-cache-worker-role/
I have an ASP.net MVC 4 website that is supposed to be using it.
I have my solution set to multiple starting projects with my cloud caching project set to start first, but no matter what I do, I get the "role discovery data is unavailable".
Sometimes in my output log I get that the Role Environment failed to initialize, but not very often. Most of the time the output log says that is succeeds. Regardless of that, I still get the error above.
I was thinking that maybe the issue was because I was running on local azure storage and compute emulators, so I reconfigured and published the Cloud Service to Azure to see if that helped.
It didn't...
The fun part is that there have been exactly 2 times when it suddenly worked (both when I was working locally). 2 times about of about 100. I didn't do anything different...just ran the debugger and poof, it all worked. This at least lends a bit of credit that it is actually setup correctly.
Needless to say, this is putting a huge damper on my productivity so any advice would be appreciated.
Update
Ok, I have figured out a workaround of sorts...I have learned that the reason that it consistently failed was because the development web server was holding onto a file which prevented the caching server to launch correctly.
The workaround is to stop the web server each and every time I want to recompile and run the code. This is obviously not ideal, so any ways to make this more reliable would be appreciated.
Thanks,
David
I don't know if this helps but I find that if I don't shut down the both the storage and compute emulator, I get weird errors, so after doing an F5 and closing the browser down, I manually shut down both emulators

Is a scripting application allowed in the Windows Store?

So I have this bit of a project planned for Windows Store and Android. Basically, a networking multi-tool coupled with a scripting engine to implement protocols and behavior. Ideal uses being things like "my embedded device uses this simplistic network protocol. I'd like to quickly prototype a way to control it from my tablet".
It's my understanding that the Android market should have no problem with this. However, the Windows Store policy includes a vague clause concerning remote code execution
3.9 All app logic must originate from, and reside in, your app package Your app must not attempt to change or extend the packaged content
through any form of dynamic inclusion of code or data that changes how
the application interacts with the Windows Runtime, or behaves with
regard to Store policy. It is not permissible, for example, to
download a remote script and subsequently execute that script in the
local context of your app package.
Of course, the scripting engine will be sandboxed and such and should be "safe"(completely intepreted, no reflection), but does it violate this policy?
If you build in your scripting engine, and only run local scripts, you will be good. However, if you were thinking to have a repository of scripts that could be downloaded and subsequently run, that would be in violation of the policy as we understand it.
Unfortunately I don't think anyone but someone on that team can answer that (or someone with direct experience in that) because of the closeness to the legal language. Have you tried the Windows Store Appl Publishing forum at: http://social.msdn.microsoft.com/Forums/en-US/windowsstore/threads
In the context of scripting engine example given, unless the app modifies the scripting engine after deployment on user's system such that the representation of protocol/behavior (the script artifact's format) is made to change then it'll be policy violation. Its as if you submit Python interpreter, and at some point in time it abruptly moves onto interpreting ecmascript.

System.out.println() messages in JBoss AS

Is there a straight forward approach for JBoss AS to print messages to the console in eclipse? I intend to use them only for debugging purposes and nothing more (I swear).
I'm new to JBoss and I don't know where to start and what to do to get my System.out.println()-messages appear in the console.
Unfortunately I have been struggling too long for today to achieve this rather natural requirement. I'm using JBoss AS 7.1.
edit:
Ok, looks like this time the problem is sitting in front of the screen. I couldn't find my logging even in the server.log. The reason is that the code which I was executing throwed an error which prevented the sysouts from being printed to the console. I'm sorry. Thank you for your help.
If you make a Sysout in your application, you can find it at the server.log, inside the folder $JBOSS_HOME/standalone/log
That, however, is not the best practice, since there's a lot of configuration and possibility at the log. You can check more information about that here
But, if you just say System.out.println('hello world') it will be out at server.log
All logging after the boot is made there so there you can check your System.out.println() stuff
With a default install a console handler and a file handler are configured. If you want to log to either you just need to use a logger. Printing to System.out or System.err it will work as well, but I would suggest using a logging facade like JBoss Logging, SLF4J or even just J.U.L.
If you're wanting to run JBoss AS inside eclipse the easiest way is to use JBoss Tools. You can start, stop and deploy your application from within eclipse locally for testing.
In my project I had 2 log4j.proprties files one is provided by jboss other is in my workspace. I removed one log4j.properties file now I am able to see sysout on the console.