I would like to add logs line in the "Error Log" view without printing those logs in the console, this because I want to manage the console log through log4j.
The idea is to use create a custom logger that:
Print the log in the console using log4j
Print the log in the "Error Log" view using Eclipse RCP features
Eventually show an error dialog to the user
I don't want the Eclipse RCP console log because in this case I'd have doubled logs in the console.
How can I add entries in "Error Log" View without print them in the console?
---UPDATE
With the console output i mean the messages formatted in this manner:
!ENTRY com.plugin.id 4 0 2014-10-15 11:37:04.314
!MESSAGE Error Messge
!STACK 0
---stack trace
I don't want to see these messages in the Console output but i only want to see the entry in the LogView:
Use the Eclipse ILog interface to write to the Eclipse log.
If your plugin has an Activator derived from Plugin (or AbstractUIPlugin) you can get the log using
Plugin.getLog();
You can also use
ILog log = Platform.getLog(bundle);
where bundle is your plugin Bundle - you can get this with:
Bundle bundle = Platform.getBundle("plugin id");
Once you have the ILog use
IStatus status = new Status(IStatus.ERROR, "plugin id", error code, "Message", throwable);
log.log(status);
Status has several constructors of varying complexity, I have show the most general.
For an Eclipse e4 application you can also use StatusReporter.
Related
When developing a simple plugin I have code like this:
import com.intellij.openapi.diagnostic.Logger;
public class MyClass {
private static final Logger LOG = Logger.getInstance(MyClass .class.getName());
public MyClass(){
LOG.warn("Creating class warn");
LOG.info("Creating class info");
}
}
I see in this thread https://intellij-support.jetbrains.com/hc/en-us/community/posts/206779715-Proper-way-to-log-in-Idea-plugins
Using this API is the recommended way of logging...
However, in the Console output, whe I run the plugin in the sandbox IDE, I only see the WARN level output. (I am using GrepConsole, but i checked and am not squelching any INFO levels).
I also manually checked the file in sandbox/system/logs/idea.log and the INFO statements are there.... they are just not getting to my IDE console.
Is there a way I can configure my project to allow INFO level output using this logging class?
also manually checked the file in sandbox/system/logs/idea.log and the INFO statements are there.... they are just not getting to my IDE console.
This is expected. The console prints the standard error/output stream. And the logger writes logs into the idea.log file.
I have been researching on the topic for a couple of days and wrote a simple UNO component to work with the Spreadsheet. The main challenge I faced during the process is whenever the LO cannot find a class (i.e. some required jar is not included in the oxt package), the thread dies absolutely silently without throwing any exception. The only way to find out is to step trace all the suspecious code which is both frustrating and very time consuming. Only then can I see the exception message text and exception itself being created. Unfortunately, this exception is never really thrown in the environment I have or is silenced in some way.
Is there any way to enable LO to throw exceptions/see stack trace for debug purposes? Is there any location where LP puts java console output?
Any help is very much appreciated!
If you have not done so yet, I recommend getting the BookmarkInsertion example to work. Be sure that the application can find the main 4 jars in the classpath: juh.jar, jurt,jar, ridl,jar, unoil.jar.
Are you running the component from the Java IDE, for example, NetBeans?
Normally, build errors and exceptions are reported in the appropriate output window at the bottom of the IDE, and this is where java console output appears as well.
Otherwise, if you have already installed the OXT file in LibreOffice and are running it without a Java IDE, then there is no console output displayed. In that case, you may want to log to a file with something like log4j. However, error messages may still be able to pop up in a message box, depending on the error.
EDIT:
For an example in Eclipse, I followed the instructions at https://github.com/LibreOffice/loeclipse. To show messages:
Window -> Show View -> Console
Window -> Show View -> Error Log
When I renamed jurt.jar to jurt0.jar so that it cannot be found, then the following was shown in the Console pane.
Exception in thread "Thread-8" java.lang.ClassNotFoundException:
com.sun.star.comp.loader.JavaLoader
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
System.err.println also writes to the Console pane. I modified ActionOneDialog.java as follows.
public void show() {
System.err.println("show() BEGIN");
dialog.execute();
System.err.println("show() END");
}
I wonder if there is a way to see System.out.println Messages in Idea when I´m using Glassfish to handle Websocketconnections. I cant find an Output Window where my messages are displayed. So if this doesnt work: How do you log with this setup ?
My glassfish log is located in the glassfish window under debug when I run debug. System out messages will show up here in the log messages. You can also find them by navigating to your glassfish log file. My file is located at:
C:\glassfish4\glassfish\domains\domain1\logs\server.txt
And here is a pic of that same log in the debug screen. This screen pops up automatically for me when I start the debug server.
I use netbeans to develop a gae java app.
When i try to debug by
dev_appserver.cmd -p 8962 D:\Documents\NetBeansProjects\Reader\build\web
I got Error 500 null on http://localhost:8962.
I think there is something wrong with my program, I want to get the error log, but dev_appserver only show me INFO log, how to get error log?
In Google App Engine Launcher click on "Logs".
I am using SLF4J + Logback to output messages to the eclipse IDE console.
Logger LOG = LoggerFactory.getLogger(MyClass.class);
LOG.debug("test");
But sometimes the whole console output gets cleared and i cannot see older messages. Is that enough information so that you can help me out?
It sounds like you might be hitting the default console output limit in Eclipse. You can edit it under Window > Preferences > Run/Debug > Console. Either increase the console buffer size (default is 80000 characters) or uncheck the "limit console output" box.