my first question at stackoverflow :) I've got a e4 rcp application and log like it is described in this tutorial: Eclipse Logging

@Inject Logger logger; 
logger.error("Error: Closing application");

So for my application I want to show the log in a custom view, but I have no idea how to get the log output. Is there a way to add an listener or something to catch all log information and write it into text field?

So far thanks for your help

有帮助吗?

解决方案

You can write your own class extending Logger to do what you want. You then install that class in to the application context to replace the default. The best place to do this would be in the @PostContextCreate method of a LifeCycle class:

@PostContextCreate
void postContextCreate(IEclipseContext context)
{
  Logger myClass = ContextInjectionFactory.make(MyLoggerClass.class, context);

  context.set(Logger.class, myClass);
}

LifeCycle class is described here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top