PlatformLogUtil.logAsError(Activator.getDefault(), new Status(IStatus.ERROR, "com.sample.example",enter code here "ERROR"));
I am using above code for Logging in eclipse problems log.
But it is not visible in problems log but able to see in console.
Can any one suggest is it right what i am performing in above code or do i need to do some thing else to view in Problem Log in eclipse.
If you take a look at the PlatformLogUtil implementation, you will see, that it does not create any problems, it just logs the error, which is shown in the "Error Log" view.
In order to show a problem in the problem view, you need to create a marker for your problem. Please read "Mark My Words" article to get more information on how to do it.
void reportError(IResource resource, int line, String msg) {
IMarker m = resource.createMarker(IMarker.PROBLEM);
m.setAttribute(IMarker.LINE_NUMBER, line);
m.setAttribute(IMarker.MESSAGE, msg);
m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
}
This will log the error in the .log file in the workspace .metadata directory. The Error Log view should also show the error.
If the plugin you pass to PlatformLogUtil is null (from Activator.getDefault()) then the error is sent to the console.
Related
I am trying to learn Eclipse editor annonations from this site:
http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-plugin-guide
It seems a preety good tutorial, but any code that I copied to my eclipse workspace, it shows always error "multiple marker in one line"
For example, when I copy the following code:
public static IMarker createMarker(IResource res)
throws CoreException {
IMarker marker = null;
//note: you use the id that is defined in your plugin.xml
marker = res.createMarker("com.ibm.mymarkers.mymarker");
marker.setAttribute("description," "this is one of my markers");
//note: you can also use attributes from your supertype
marker.setAttribute(IMarker.MESSAGE, "My Marker");
return marker;
}
I will get the error that multiple markers in one line. Can you please help me regards this? I am really frustrated with it and already spent 2 hours after it.
Multiple markers means that there is more than one thing wrong with the line specified.
I will be assuming the error is in this line:
marker.setAttribute("description," "this is one of my markers");
Note the misplaced comma (,) corrected version should be:
marker.setAttribute("description", "this is one of my markers");
Try it out and do a clean build. I am sure it will work this time.
Hover over the error marker on the left or open the "Problems View" to see the individual errors.
I' creating application that reads/writes to/from com port using RXTXComm library. When I'm trying to read one byte from stream everything goes fine.
while ( ( data = in.read() ) > -1 )
Then I tried to read []byte and put breakpoint to this line:
int g = in.read(buffer,off,len);
When debug reaches this place and I do resume debug - new window with message described bellow appears:
Class File Editor
Source not found
----------------------
The JAR file c:\pro\RXTXcom.jar has no source attachment.
You can attach the source by clicking Attach Source below:
What is the problem? This is not exception, because I can't catch it in try-except block. What is this? I didn't asked for "trace in" and I don't need source.
It appears that your IDE (which you do not name) is telling you it is trying to display a line from the RXTXcom library, but it has no source code to use to do so. I would expect this if I were using eclipse, had a binary-only copy of the library, exception checking turned on in the debugger, and the library threw an exception.
I don't recognize "resume debug - new window", so I don't know what effect that might have.
Eclipse has a "step out" function in its debugger, allowing you to step through the next return statement; that might help you get to a level for which you do have source.
I doubt this message has much to do with your actual 1 byte vs. byte array reading problem.
I am trying to run the sample openNI Skeleton Tracking application (UserTracker.java application) on a pre-recorded .oni file. I have edited the SamplesConfig.xml file to direct the input from the ONI file and not a Kinect (I don't actually have one). However, I get the following Exception. Can anybody help me here?
org.OpenNI.StatusException: Function was not implemented!
at org.OpenNI.WrapperUtils.throwOnError(WrapperUtils.java:30)
at org.OpenNI.Context.initFromXmlEx(Context.java:371)
at org.OpenNI.Context.createFromXmlFile(Context.java:36)
at UserTracker.<init>(UserTracker.java:149)
at UserTrackerApplication.main(UserTrackerApplication.java:67)
Any help will be appreciated. Thanks!
EDIT: I found a solution here, this has removed the earlier exception that I was getting, but now I get the following!
org.OpenNI.StatusException: This operation is invalid!
Anybody knows why this is happening?
I had a similar problem, I wanted to read data from a .oni file that I generated and I was getting the same issue. Now the problem is solved and maybe you solved it too, but I think it's important to share information to others that might come to this post. I found some clues in others posts by the way.
So here is the solution. The NiUserTracker sample can be used with an .oni file so I checked the code and they do the following:
xn::Player g_Player; //Global variable
// This goes in the main or another function
if (argc > 1)
{
nRetVal = g_Context.Init();
CHECK_RC(nRetVal, "Init");
nRetVal = g_Context.OpenFileRecording(argv[1], g_Player);
if (nRetVal != XN_STATUS_OK)
{
printf("Can't open recording %s: %s\n", argv[1], xnGetStatusString(nRetVal));
return 1;
}
}
This is C++ code, I work with c++. So as you can see they don't init the kinect via XML file if they want to open a recorded .oni file, they just init it via Init() method and then open a file with openFileRecording method.
If you want to open a .oni file there's no need to modify your XML, this way you can do an application that allows you to chose if you want to use a .oni or the kinect.
I hope this helps someone.
cheers.
I downloaded google calendar api sample from http://code.google.com/p/google-api-java-client/source/browse/calendar-cmdline-sample/?repo=samples and created a project in eclipse.
Now when i try to run the project am getting java.lang.IllegalArgumentException: no JSON input found at this line
FileCredentialStore credentialStore = new FileCredentialStore(
new File(System.getProperty("user.home"), ".credentials/calendar.json"), JSON_FACTORY);
Have any of you tried this example? what is wrong here?
This error can be resolved by providing input to the .credentials/calendar.json file. If you manually provided the following entry in the calendar.json , it will work :
{
"installed": {
"client_id": "client_id",
"client_secret": "client_secret"
}
}
It seems to be the Windows problem which is not allowing to set writable permissions on calendar.json file . The method setWritable(boolean,boolean) is returning false and so is the cause of this problem. Still providing json input manually is not a perfect solutions but your application will work.
That may happen when your application executed before and it created empty .credentials/calendar.json file in you home dir. That may happen if you're running your application in Windows, cause FileCredentialStore tries to do:
file.setReadable(false, false)
and fails.
To solve it just remove calendar.json. Although you might have another error: [unable to set file permissions]
which I don't know how to solve yet.
Is that project having calendar.json resource file. Please share complete exception stack trace.
Seems some required configuration missed from calendar.json file
I'm working on building an Android app and I'm wondering what the best approach is to debugging like that of console.log in javascript
The Log class:
API for sending log output.
Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e()
methods.
The order in terms of verbosity, from least to most is ERROR, WARN,
INFO, DEBUG, VERBOSE. Verbose should never be compiled into an
application except during development. Debug logs are compiled in but
stripped at runtime. Error, warning and info logs are always kept.
Outside of Android, System.out.println(String msg) is used.
Use the Android logging utility.
http://developer.android.com/reference/android/util/Log.html
Log has a bunch of static methods for accessing the different log levels. The common thread is that they always accept at least a tag and a log message.
Tags are a way of filtering output in your log messages. You can use them to wade through the thousands of log messages you'll see and find the ones you're specifically looking for.
You use the Log functions in Android by accessing the Log.x objects (where the x method is the log level). For example:
Log.d("MyTagGoesHere", "This is my log message at the debug level here");
Log.e("MyTagGoesHere", "This is my log message at the error level here");
I usually make it a point to make the tag my class name so I know where the log message was generated too. Saves a lot of time later on in the game.
You can see your log messages using the logcat tool for android:
adb logcat
Or by opening the eclipse Logcat view by going to the menu bar
Window->Show View->Other then select the Android menu and the LogCat view
console.log() in java is System.out.println(); to put text on the next line
And System.out.print(); puts text on the same line.
public class Console {
public static void Log(Object obj){
System.out.println(obj);
}
}
to call and use as JavaScript just do this:
Console.Log (Object)
I think that's what you mean