Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Logging not OSGi compliant?
Logging not OSGi compliant? [message #663024] Sat, 02 April 2011 10:12 Go to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
OSGi allows to log messages with or without a Service Reference:
// first way
fLogService.log(LogService.LOG_ERROR, "This is my first log message");
//second way
fLogService.log(serviceReference, LogService.LOG_ERROR, "This is my first log message");

Equinox does not write the Service Reference to the log. I am referring to the equinox release of eclipse 4.1M6 The reference seems to get lost in
EclipseLogWriter.logged()
The Service Reference is stored in the log entry and can be obtained via
entry.getContext()
Nevertheless, it is not passed on in the statement
// OK we are now in a case where someone logged a normal entry to the real LogService
log(new FrameworkLogEntry(getFwkEntryTag(entry), convertSeverity(entry), 0, entry.getMessage(), 0, entry.getException(), null));

I am no OSGi expert, but I don't know about the logging of the Service Reference being optional. So this should be a bug?
Re: Logging not OSGi compliant? [message #663243 is a reply to message #663024] Mon, 04 April 2011 12:50 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
The EclipseLogWriter is not the OSGi LogService. It is simply a LogListener that is responsible for writing the eclipse log to disk. In this case it discards the service reference and does not include information about it in the log file. This is fine. LogListeners can choose to do what ever they want with the content of the LogEntry.

Tom.
Re: Logging not OSGi compliant? [message #664201 is a reply to message #663243] Thu, 07 April 2011 19:52 Go to previous message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Well, yes, I didn't make myself clear enough in the first post -- and I hadn't investigated things thoroughly enough.

What I really had (and still have) in mind was (is) LogReaderService.getLog. I assumed that this method will look into the log file to read past log entries. Since log entries in this file do not have any service reference, the log entries returned by this method should not have a service reference either. This would not have been compliant with the specification.

And now I am stunned: the method LogReaderService.getLog returns nothing:
Enumeration<?> getLog() {
	return EMPTY_ENUMERATION;
}

Although this seems to be compliant with the specification I didn't expect this result. I read in a book about OSGi that equinox saves 100 log entries by default. The maximum number of entries returned by LogReaderService.getLog should be controllable by the property log.size, the threshold by the property log.threshold. One should also be able to set both properties through the Config Admin Service.

Things must have changed by now, since the coding shown above will never return any past log entries. (The book, by the way, is based on equinox version 3.3.2.)

Is this correct? Or can one somehow change this behaviour to obtain past log entries?

The usage of EclipseLogWriter seems to be unchangeable as well, or isn't it?
Previous Topic:IRegistryEventListener added(IExtension[] extensions) gets invoked more than once
Next Topic:OSGi Launcher in Helios
Goto Forum:
  


Current Time: Thu Sep 26 05:06:09 GMT 2024

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

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

Back to the top