views:

145

answers:

1

Hi,

I'm currently developing a RCP Eclipse Application. For logging purposes I use SFL4J over log4j. For my own code this works well since I can specify the correct logger ( LoggerFactory.getLogger ... logger.debug...). But how can I redirect all the plugin logs to the same location, so that I can see all exceptions from other rcp plugins also in my log4j-LogFile. How can I log uncaught exceptions in my log-file?

I heard something about ILog but I'm not aware how to redirect this to my log4j/slf4j implementation.

So what is the best way to log all plugin messages in one log file?

Thanks, Ingo

+1  A: 

To capture log events for the entire platform, create an ILogListener instance and register it using Platform.addLogListener(ILogListener).

As for logging uncaught exceptions, one way to do it is to create a new ThreadGroup and override uncaughtException(Thread t, Throwable e) to log the exception. You then have to start a new thread in that thread group and do everything else inside it. I take care of this in the run method of my implementation of IPlatformRunnable.

Adam Crume