Logging to a Console in an application [message #536384] |
Thu, 27 May 2010 18:15  |
Eclipse User |
|
|
|
I am writing an RCP app using 3.5SR2 and I need to provide a Console to view logging in the app itself. Additionally, my client would like to have a Console window for each editor.
From what I've read this seems quite possible using the existing framework, however, they'd like to add one more thing.
They want to use a logging framework. Currently I am using Pax logging (which is working nicely for logging to the Eclipse console when running the app from eclipse). They want to be able to view the log output in this console (IOConsole? is that right?) My questions are as follows:
1. To satisfy the requirement of being able to view the log in the app via the console or a console-like view, leaving out the logging framework question, is there a simple strategy for writing logging messages to the console?
2. Is it possible to write an Appender for Log4j that can write to a console window? I am relatively new to RCP and this seems possible, but if it were, I'd think someone would have done it and posted a blog or something about it.
Thanks in advance!
Jon
|
|
|
|
|
|
Re: Logging to a Console in an application [message #537438 is a reply to message #537267] |
Wed, 02 June 2010 09:01  |
Eclipse User |
|
|
|
showing up the console, is not quite enough, you actually need to provide a consoleFactory and a consolePageParticipant. they both are extension points from org.eclipse.ui.console.
there is a good example of that in org.eclipse.team.cvs.ui which contribute a page to the console view.
Once you have your own page, you can write whatever you want in there.
Writing the log4j appender is rather easy since you can just extendWriterAppender to write to your console.
Another option is to just steal System.out/err and redirect that to your console. but you might get more than what you asked for.
p.
|
|
|
Powered by
FUDForum. Page generated in 0.05548 seconds