Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to log warnings and infos in eclipse 3.7 ?(How to log warnings and infos to the eclipse ".log"-File using eclipse 3.7 and OSGi LogService.)
How to log warnings and infos in eclipse 3.7 ? [message #713361] Mon, 08 August 2011 11:47 Go to next message
Christian Schwarz is currently offline Christian Schwarz
Messages: 31
Registered: July 2009
Member
Hello everybody !

We are migrating our rcp project from eclipse 3.4 to 3.7. Instead of the eclipse ILog we now use the OSGi-LogService, but now only errors are written to the ".log"-File. Warnings and infos are ignored.
What must be done that messages with any log-level will be written to the log-File ?

We figured out that EclipseLogWriter#isLoggable(Bundle,String,int) returns only true for log level: LogService.LOG_ERROR.

Thanks
Chris
(no subject) [message #714134 is a reply to message #713361] Tue, 09 August 2011 21:08 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Chris,

Did you try to specify -Declipse.log.level=(ERROR|WARNING|INFO|ALL)

I am not sure what that does to the log though. It could be that you will see
more then you like.

Best regards,

Wim

> Hello everybody !
>
> We are migrating our rcp project from eclipse 3.4 to 3.7. Instead of the
eclipse ILog we now use the OSGi-LogService, but now only errors are written
to the ".log"-File. Warnings and infos are ignored.
> What must be done that messages with any log-level will be written to the
log-File ?
>
> We figured out that EclipseLogWriter#isLoggable(Bundle,String,int) returns
only true for log level: LogService.LOG_ERROR.
>
> Thanks
> Chris
Re: (no subject) [message #714735 is a reply to message #714134] Thu, 11 August 2011 12:08 Go to previous messageGo to next message
Christian Schwarz is currently offline Christian Schwarz
Messages: 31
Registered: July 2009
Member
Hi Wim,

thanks for your answer! We tried your idea, -Declipse.log.level only works if one use the eclipse log, it has no effect when we use the OSGi-Logging Service. The key is in the method #isLoggable(..) in class org.eclipse.core.runtime.internal.adaptor.EclipseLogWriter. Its last line decides that only errors go to the log file if no other case match (that is our case).

org.eclipse.osgi_3.7.0.v20110613.jar
org.eclipse.core.runtime.internal.adaptor.EclipseLogWriter

public boolean isLoggable(Bundle bundle, String loggableName, int loggableLevel) {
  if (!enabled)
    return false;
  
  if (loggerName.equals(loggableName))
    return isLoggable(convertSeverity(loggableLevel));
  
  if (EclipseLogHook.PERF_LOGGER_NAME.equals(loggableName))
    // we don't want to do anything with performance logger unless  
    // this is the performance logger (check done above).
    return false;

  if (!EclipseLogHook.EQUINOX_LOGGER_NAME.equals(loggerName))
    // only the equinox log writer should pay attention to other logs
    return false;
		
  // for now only log errors; probably need this to be configurable
  return loggableLevel == LogService.LOG_ERROR;
}


I think the quick solution is to create a fork of bundle org.eclipse.osgi and change :

return loggableLevel == LogService.LOG_ERROR;

to :

return true;

The slow solution is to open a ticket at bugzilla, to motivate the eclipse developers to make it configurable, as there comment already says.
(no subject) [message #715332 is a reply to message #714735] Sat, 13 August 2011 11:37 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Chris,

Yes. I see.

The best option would be to not return true but

return system.getproperty("osgi.loglevel.or.something").equals(
Re: (no subject) [message #716084 is a reply to message #715332] Tue, 16 August 2011 12:34 Go to previous message
Christian Schwarz is currently offline Christian Schwarz
Messages: 31
Registered: July 2009
Member
Jup, you are right ! Your idea is much better !
Previous Topic:eclipse product export wizard
Next Topic:problem with JMS in RCP
Goto Forum:
  


Current Time: Thu Oct 23 17:18:48 GMT 2014

Powered by FUDForum. Page generated in 0.02098 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software