ILog has been around for a very long time, before OSGi as a runtime in Eclipse I think. So its access is a bit static. If you have motivation to access it in an 'OSGi way' then I recommend you enhance the eclipse platform to register a ServiceFactory<ILog> that bundles can use. The ServiceFactory<ILog> would essentially return the same thing Platform.getLog(Bundle) does. That way you can get injected with your bundle's ILog with things like DS.
Tom From: Konstantin Komissarchik <[email protected]> To: Neil Bartlett <[email protected]>, Equinox development mailing list <[email protected]> Date: 10/07/2015 11:01 AM Subject: Re: [equinox-dev] Accessing the log without Activator (extendsPlugin) Sent by: [email protected] Here is the invocation that I use to get ILog without an Activator: Platform.getLog( Platform.getBundle( "..." ) ) Thanks, - Konstantin From: Neil Bartlett Sent: Wednesday, October 7, 2015 8:50 AM To: Equinox development mailing list Subject: Re: [equinox-dev] Accessing the log without Activator (extendsPlugin) Looking at the source code, ILog is not an OSGi service but is constructed as a wrapper object around the OSGi LogService. The relevant code is in org.eclipse.core.internal.runtime.InternalPlatform. Do you need the full functionality of an ILog, or is standard OSGi LogService sufficient? If the latter, then you can use a DS component and just inject a reference to the LogService. If you really need ILog then I think you have to go through InternalPlatform.getDefault().getLog(). Neil > On 7 Oct 2015, at 09:38, Lars Vogel <[email protected]> wrote: > > Hi, > > in my Activator based on Plugin, I have this nice method: > > MyActivator.getDefault().getLog() which is basically Plugin.getLog(). > > What is the correct way to access the ILog in OSGi without an Activator? > > Best regards, Lars > > -- > Eclipse Platform UI and e4 project co-lead > CEO vogella GmbH > > Haindaalwisch 17a, 22395 Hamburg > Amtsgericht Hamburg: HRB 127058 > Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel > USt-IdNr.: DE284122352 > Fax (032) 221739404, Email: [email protected], Web: http://www.vogella.com > _______________________________________________ > equinox-dev mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from this list, visit > https://dev.eclipse.org/mailman/listinfo/equinox-dev _______________________________________________ equinox-dev mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/equinox-dev _______________________________________________ equinox-dev mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________ equinox-dev mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/equinox-dev
