문제

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