Home » Eclipse Projects » Rich Client Platform (RCP) » logger starting
logger starting [message #463441] |
Mon, 12 February 2007 08:03  |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Hello everybody!
I am using log4j for logging. Quite nice. the problem is that I cannot
figure out where to initialize the logger. I am thinking of putting it into:
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
but not sure. It seems that logger should start as soon as possible, but
when start method is called, I can see that some threads are already
working which means that if something goes wrong before I initialize the
log4j library, those errors will not be logged.
Thanks very much in advance for your support, folks!
|
|
| | | |
Re: logger starting [message #463457 is a reply to message #463451] |
Mon, 12 February 2007 09:15   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Tom!<br>
Well, I did read it. So, what are you saying? I just did not understand
all the bits in your reply to my post:<br>
<pre wrap=""><i>first 2nd thing</i></pre>
How should I understand that one? <span class="moz-smiley-s7"><span>
:-\ </span></span><br>
Tom Schindl wrote:
<blockquote cite="mideqpr7n$n4t$1@utils.eclipse.org" type="cite">
<pre wrap="">Hi,
start is the first 2nd thing called (after the constructor) when you
have set the LazyStart-bit in MANIFEST. Even getDefault() will fail in
other cases see my thread about BundleActivation from today ;-)
Tom
Peter Osipov schrieb:
</pre>
<blockquote type="cite">
<pre wrap="">Hello Stefan.
It seems that ILog might be an alternative. Do you know any articles
(pros and cons) for eclipse logging system?
Stefan Zugal wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I think the start() method should be the first method called when your
plugin is loaded (although I'm not quite sure ...).
Alternatively, you could use the logging system provided by Eclipse:
MyPlugin.getDefault().getLog()
HTH,
Stefan
Peter Osipov schrieb:
</pre>
<blockquote type="cite">
<pre wrap="">Hello everybody!
I am using log4j for logging. Quite nice. the problem is that I
cannot figure out where to initialize the logger. I am thinking of
putting it into:
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
but not sure. It seems that logger should start as soon as possible,
but when start method is called, I can see that some threads are
already working which means that if something goes wrong before I
initialize the log4j library, those errors will not be logged.
Thanks very much in advance for your support, folks!
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>
|
|
|
Re: logger starting [message #463459 is a reply to message #463457] |
Mon, 12 February 2007 09:22   |
Eclipse User |
|
|
|
Peter Osipov schrieb:
> Hi Tom!
> Well, I did read it. So, what are you saying? I just did not understand all the
> bits in your reply to my post:
>
> /first 2nd thing/
>
Sorry the process is the following:
1. Constructor is called of Activator defined in MANIFEST is called
2. Start is called of this Activator
3. Class loaded, instantiated, method called
4. ...
The key is that start() is the first method in your plugin which is
called before any other code runs (under the assumption that your
MANIFEST holds "Eclipse-LazyStart: true").
Tom
> How should I understand that one? :-\
> Tom Schindl wrote:
>> Hi,
>>
>> start is the first 2nd thing called (after the constructor) when you
>> have set the LazyStart-bit in MANIFEST. Even getDefault() will fail in
>> other cases see my thread about BundleActivation from today ;-)
>>
>> Tom
>>
>> Peter Osipov schrieb:
>>
>>> Hello Stefan.
>>> It seems that ILog might be an alternative. Do you know any articles
>>> (pros and cons) for eclipse logging system?
>>> Stefan Zugal wrote:
>>>
>>>> Hi,
>>>>
>>>> I think the start() method should be the first method called when your
>>>> plugin is loaded (although I'm not quite sure ...).
>>>>
>>>> Alternatively, you could use the logging system provided by Eclipse:
>>>> MyPlugin.getDefault().getLog()
>>>>
>>>> HTH,
>>>> Stefan
>>>>
>>>> Peter Osipov schrieb:
>>>>
>>>>> Hello everybody!
>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>> cannot figure out where to initialize the logger. I am thinking of
>>>>> putting it into:
>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>
>>>>> but not sure. It seems that logger should start as soon as possible,
>>>>> but when start method is called, I can see that some threads are
>>>>> already working which means that if something goes wrong before I
>>>>> initialize the log4j library, those errors will not be logged.
>>>>> Thanks very much in advance for your support, folks!
>>>>>
>
|
|
|
Re: logger starting [message #463461 is a reply to message #463459] |
Mon, 12 February 2007 09:27   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Okay, now it is clear. Thanks Tom! 8-)
Well, so I should put that logger initialization in start method, eh?
In that case I am not logging the situation when the application does
not start(more precisely - the "initializing" bundle is not started) for
some reason, which I want to log, as well, actually. If that is
possible, of course.
Tom Schindl wrote:
> Peter Osipov schrieb:
>> Hi Tom!
>> Well, I did read it. So, what are you saying? I just did not
>> understand all the bits in your reply to my post:
>>
>> /first 2nd thing/
>>
>
> Sorry the process is the following:
> 1. Constructor is called of Activator defined in MANIFEST is called
> 2. Start is called of this Activator
> 3. Class loaded, instantiated, method called
> 4. ...
>
> The key is that start() is the first method in your plugin which is
> called before any other code runs (under the assumption that your
> MANIFEST holds "Eclipse-LazyStart: true").
>
> Tom
>
>> How should I understand that one? :-\
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> start is the first 2nd thing called (after the constructor) when you
>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will fail in
>>> other cases see my thread about BundleActivation from today ;-)
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>
>>>> Hello Stefan.
>>>> It seems that ILog might be an alternative. Do you know any articles
>>>> (pros and cons) for eclipse logging system?
>>>> Stefan Zugal wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I think the start() method should be the first method called when
>>>>> your
>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>
>>>>> Alternatively, you could use the logging system provided by Eclipse:
>>>>> MyPlugin.getDefault().getLog()
>>>>>
>>>>> HTH,
>>>>> Stefan
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>
>>>>>> Hello everybody!
>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>> cannot figure out where to initialize the logger. I am thinking of
>>>>>> putting it into:
>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>
>>>>>>
>>>>>> but not sure. It seems that logger should start as soon as possible,
>>>>>> but when start method is called, I can see that some threads are
>>>>>> already working which means that if something goes wrong before I
>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>> Thanks very much in advance for your support, folks!
>>>>>>
>>
|
|
|
Re: logger starting [message #463465 is a reply to message #463461] |
Mon, 12 February 2007 09:41   |
Eclipse User |
|
|
|
Hi,
Well that's nothing you could do in your own plugin. I don't have a clue
if this could be done but I think you'll always have to same problem
that if you want to inject custom code if the loading of it fails you
can't intercept this (the platform of course logs into the log-file).
If the chicken is behead before it could lay the egg, the egg is out of
luck ;-) Sorry for the rude analogy.
Tom
Peter Osipov schrieb:
> Okay, now it is clear. Thanks Tom! 8-)
> Well, so I should put that logger initialization in start method, eh?
> In that case I am not logging the situation when the application does
> not start(more precisely - the "initializing" bundle is not started) for
> some reason, which I want to log, as well, actually. If that is
> possible, of course.
> Tom Schindl wrote:
>> Peter Osipov schrieb:
>>> Hi Tom!
>>> Well, I did read it. So, what are you saying? I just did not
>>> understand all the bits in your reply to my post:
>>>
>>> /first 2nd thing/
>>>
>>
>> Sorry the process is the following:
>> 1. Constructor is called of Activator defined in MANIFEST is called
>> 2. Start is called of this Activator
>> 3. Class loaded, instantiated, method called
>> 4. ...
>>
>> The key is that start() is the first method in your plugin which is
>> called before any other code runs (under the assumption that your
>> MANIFEST holds "Eclipse-LazyStart: true").
>>
>> Tom
>>
>>> How should I understand that one? :-\
>>> Tom Schindl wrote:
>>>> Hi,
>>>>
>>>> start is the first 2nd thing called (after the constructor) when you
>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will fail in
>>>> other cases see my thread about BundleActivation from today ;-)
>>>>
>>>> Tom
>>>>
>>>> Peter Osipov schrieb:
>>>>
>>>>> Hello Stefan.
>>>>> It seems that ILog might be an alternative. Do you know any articles
>>>>> (pros and cons) for eclipse logging system?
>>>>> Stefan Zugal wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I think the start() method should be the first method called when
>>>>>> your
>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>
>>>>>> Alternatively, you could use the logging system provided by Eclipse:
>>>>>> MyPlugin.getDefault().getLog()
>>>>>>
>>>>>> HTH,
>>>>>> Stefan
>>>>>>
>>>>>> Peter Osipov schrieb:
>>>>>>
>>>>>>> Hello everybody!
>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>> cannot figure out where to initialize the logger. I am thinking of
>>>>>>> putting it into:
>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>
>>>>>>>
>>>>>>> but not sure. It seems that logger should start as soon as possible,
>>>>>>> but when start method is called, I can see that some threads are
>>>>>>> already working which means that if something goes wrong before I
>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>
>>>
|
|
|
Re: logger starting [message #463467 is a reply to message #463465] |
Mon, 12 February 2007 10:00   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Thanks, Tom. :-) Yep, there will always be a problem when integrating.
Well, if platform logs that into the log-file, where can I find the one
in the situation, when log4j was not able to intercept the error event?
Tom Schindl wrote:
> Hi,
>
> Well that's nothing you could do in your own plugin. I don't have a
> clue if this could be done but I think you'll always have to same
> problem that if you want to inject custom code if the loading of it
> fails you can't intercept this (the platform of course logs into the
> log-file).
>
> If the chicken is behead before it could lay the egg, the egg is out
> of luck ;-) Sorry for the rude analogy.
>
> Tom
>
> Peter Osipov schrieb:
>> Okay, now it is clear. Thanks Tom! 8-)
>> Well, so I should put that logger initialization in start method, eh?
>> In that case I am not logging the situation when the application does
>> not start(more precisely - the "initializing" bundle is not started)
>> for some reason, which I want to log, as well, actually. If that is
>> possible, of course.
>> Tom Schindl wrote:
>>> Peter Osipov schrieb:
>>>> Hi Tom!
>>>> Well, I did read it. So, what are you saying? I just did not
>>>> understand all the bits in your reply to my post:
>>>>
>>>> /first 2nd thing/
>>>>
>>>
>>> Sorry the process is the following:
>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>> 2. Start is called of this Activator
>>> 3. Class loaded, instantiated, method called
>>> 4. ...
>>>
>>> The key is that start() is the first method in your plugin which is
>>> called before any other code runs (under the assumption that your
>>> MANIFEST holds "Eclipse-LazyStart: true").
>>>
>>> Tom
>>>
>>>> How should I understand that one? :-\
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> start is the first 2nd thing called (after the constructor) when you
>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>> fail in
>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>
>>>>>> Hello Stefan.
>>>>>> It seems that ILog might be an alternative. Do you know any articles
>>>>>> (pros and cons) for eclipse logging system?
>>>>>> Stefan Zugal wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I think the start() method should be the first method called
>>>>>>> when your
>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>
>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>> Eclipse:
>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>
>>>>>>> HTH,
>>>>>>> Stefan
>>>>>>>
>>>>>>> Peter Osipov schrieb:
>>>>>>>
>>>>>>>> Hello everybody!
>>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>>> cannot figure out where to initialize the logger. I am thinking of
>>>>>>>> putting it into:
>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>
>>>>>>>>
>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>> possible,
>>>>>>>> but when start method is called, I can see that some threads are
>>>>>>>> already working which means that if something goes wrong before I
>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>
>>>>
|
|
|
Re: logger starting [message #463469 is a reply to message #463467] |
Mon, 12 February 2007 10:03   |
Eclipse User |
|
|
|
Platform always logs into workspace/.metadata/.log
by the what you really want to to have a generic logger services. Make
sure you read this article at eclipsezone.
http://www.eclipsezone.com/articles/extensions-vs-services/
Tom
Peter Osipov schrieb:
> Thanks, Tom. :-) Yep, there will always be a problem when integrating.
> Well, if platform logs that into the log-file, where can I find the one
> in the situation, when log4j was not able to intercept the error event?
>
> Tom Schindl wrote:
>> Hi,
>>
>> Well that's nothing you could do in your own plugin. I don't have a
>> clue if this could be done but I think you'll always have to same
>> problem that if you want to inject custom code if the loading of it
>> fails you can't intercept this (the platform of course logs into the
>> log-file).
>>
>> If the chicken is behead before it could lay the egg, the egg is out
>> of luck ;-) Sorry for the rude analogy.
>>
>> Tom
>>
>> Peter Osipov schrieb:
>>> Okay, now it is clear. Thanks Tom! 8-)
>>> Well, so I should put that logger initialization in start method, eh?
>>> In that case I am not logging the situation when the application does
>>> not start(more precisely - the "initializing" bundle is not started)
>>> for some reason, which I want to log, as well, actually. If that is
>>> possible, of course.
>>> Tom Schindl wrote:
>>>> Peter Osipov schrieb:
>>>>> Hi Tom!
>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>> understand all the bits in your reply to my post:
>>>>>
>>>>> /first 2nd thing/
>>>>>
>>>>
>>>> Sorry the process is the following:
>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>> 2. Start is called of this Activator
>>>> 3. Class loaded, instantiated, method called
>>>> 4. ...
>>>>
>>>> The key is that start() is the first method in your plugin which is
>>>> called before any other code runs (under the assumption that your
>>>> MANIFEST holds "Eclipse-LazyStart: true").
>>>>
>>>> Tom
>>>>
>>>>> How should I understand that one? :-\
>>>>> Tom Schindl wrote:
>>>>>> Hi,
>>>>>>
>>>>>> start is the first 2nd thing called (after the constructor) when you
>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>> fail in
>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>> Peter Osipov schrieb:
>>>>>>
>>>>>>> Hello Stefan.
>>>>>>> It seems that ILog might be an alternative. Do you know any articles
>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>> Stefan Zugal wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I think the start() method should be the first method called
>>>>>>>> when your
>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>
>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>> Eclipse:
>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>
>>>>>>>> HTH,
>>>>>>>> Stefan
>>>>>>>>
>>>>>>>> Peter Osipov schrieb:
>>>>>>>>
>>>>>>>>> Hello everybody!
>>>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>>>> cannot figure out where to initialize the logger. I am thinking of
>>>>>>>>> putting it into:
>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>> possible,
>>>>>>>>> but when start method is called, I can see that some threads are
>>>>>>>>> already working which means that if something goes wrong before I
>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>
>>>>>
|
|
|
Re: logger starting [message #463471 is a reply to message #463469] |
Mon, 12 February 2007 10:03   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Okay, Tom. Let me go and read that article. Thanks so much for your
help! 8-)
Tom Schindl wrote:
> Platform always logs into workspace/.metadata/.log
>
> by the what you really want to to have a generic logger services. Make
> sure you read this article at eclipsezone.
>
> http://www.eclipsezone.com/articles/extensions-vs-services/
>
> Tom
>
> Peter Osipov schrieb:
>> Thanks, Tom. :-) Yep, there will always be a problem when integrating.
>> Well, if platform logs that into the log-file, where can I find the
>> one in the situation, when log4j was not able to intercept the error
>> event?
>>
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> Well that's nothing you could do in your own plugin. I don't have a
>>> clue if this could be done but I think you'll always have to same
>>> problem that if you want to inject custom code if the loading of it
>>> fails you can't intercept this (the platform of course logs into the
>>> log-file).
>>>
>>> If the chicken is behead before it could lay the egg, the egg is out
>>> of luck ;-) Sorry for the rude analogy.
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>> Well, so I should put that logger initialization in start method, eh?
>>>> In that case I am not logging the situation when the application
>>>> does not start(more precisely - the "initializing" bundle is not
>>>> started) for some reason, which I want to log, as well, actually.
>>>> If that is possible, of course.
>>>> Tom Schindl wrote:
>>>>> Peter Osipov schrieb:
>>>>>> Hi Tom!
>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>> understand all the bits in your reply to my post:
>>>>>>
>>>>>> /first 2nd thing/
>>>>>>
>>>>>
>>>>> Sorry the process is the following:
>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>> 2. Start is called of this Activator
>>>>> 3. Class loaded, instantiated, method called
>>>>> 4. ...
>>>>>
>>>>> The key is that start() is the first method in your plugin which
>>>>> is called before any other code runs (under the assumption that
>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>
>>>>> Tom
>>>>>
>>>>>> How should I understand that one? :-\
>>>>>> Tom Schindl wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> start is the first 2nd thing called (after the constructor) when
>>>>>>> you
>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>> fail in
>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> Peter Osipov schrieb:
>>>>>>>
>>>>>>>> Hello Stefan.
>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>> articles
>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>> Stefan Zugal wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>> when your
>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>
>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>> Eclipse:
>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>
>>>>>>>>> HTH,
>>>>>>>>> Stefan
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>
>>>>>>>>>> Hello everybody!
>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>> thinking of
>>>>>>>>>> putting it into:
>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>> possible,
>>>>>>>>>> but when start method is called, I can see that some threads are
>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>> before I
>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>
>>>>>>
|
|
|
Re: logger starting [message #463473 is a reply to message #463469] |
Mon, 12 February 2007 10:11   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
I am reading the article right now. It is just that it does not have
anything about logger services, eh?
Tom Schindl wrote:
> Platform always logs into workspace/.metadata/.log
>
> by the what you really want to to have a generic logger services. Make
> sure you read this article at eclipsezone.
>
> http://www.eclipsezone.com/articles/extensions-vs-services/
>
> Tom
>
> Peter Osipov schrieb:
>> Thanks, Tom. :-) Yep, there will always be a problem when integrating.
>> Well, if platform logs that into the log-file, where can I find the
>> one in the situation, when log4j was not able to intercept the error
>> event?
>>
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> Well that's nothing you could do in your own plugin. I don't have a
>>> clue if this could be done but I think you'll always have to same
>>> problem that if you want to inject custom code if the loading of it
>>> fails you can't intercept this (the platform of course logs into the
>>> log-file).
>>>
>>> If the chicken is behead before it could lay the egg, the egg is out
>>> of luck ;-) Sorry for the rude analogy.
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>> Well, so I should put that logger initialization in start method, eh?
>>>> In that case I am not logging the situation when the application
>>>> does not start(more precisely - the "initializing" bundle is not
>>>> started) for some reason, which I want to log, as well, actually.
>>>> If that is possible, of course.
>>>> Tom Schindl wrote:
>>>>> Peter Osipov schrieb:
>>>>>> Hi Tom!
>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>> understand all the bits in your reply to my post:
>>>>>>
>>>>>> /first 2nd thing/
>>>>>>
>>>>>
>>>>> Sorry the process is the following:
>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>> 2. Start is called of this Activator
>>>>> 3. Class loaded, instantiated, method called
>>>>> 4. ...
>>>>>
>>>>> The key is that start() is the first method in your plugin which
>>>>> is called before any other code runs (under the assumption that
>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>
>>>>> Tom
>>>>>
>>>>>> How should I understand that one? :-\
>>>>>> Tom Schindl wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> start is the first 2nd thing called (after the constructor) when
>>>>>>> you
>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>> fail in
>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> Peter Osipov schrieb:
>>>>>>>
>>>>>>>> Hello Stefan.
>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>> articles
>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>> Stefan Zugal wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>> when your
>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>
>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>> Eclipse:
>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>
>>>>>>>>> HTH,
>>>>>>>>> Stefan
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>
>>>>>>>>>> Hello everybody!
>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>> thinking of
>>>>>>>>>> putting it into:
>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>> possible,
>>>>>>>>>> but when start method is called, I can see that some threads are
>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>> before I
>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>
>>>>>>
|
|
|
Re: logger starting [message #463474 is a reply to message #463473] |
Mon, 12 February 2007 10:38   |
Eclipse User |
|
|
|
Hi,
well but that's exactly what you need you need a central plugin started
up very early which configures log4j and provides possibilities to other
plugins to log. Not every plugin configures its own logger but they are
all loging through one central Log-Service. I only wanted to point you
to this article to get familiar how you could create your log-service.
Which looks similar to the ILog-Service provided by eclipse. I think you
can inject your own log-service into eclipse maybe this article provides
pointers how to that:
http://eclipsezone.com/articles/franey-logging/?source=archi ves
Tom
Peter Osipov schrieb:
> I am reading the article right now. It is just that it does not have
> anything about logger services, eh?
>
> Tom Schindl wrote:
>> Platform always logs into workspace/.metadata/.log
>>
>> by the what you really want to to have a generic logger services. Make
>> sure you read this article at eclipsezone.
>>
>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>
>> Tom
>>
>> Peter Osipov schrieb:
>>> Thanks, Tom. :-) Yep, there will always be a problem when integrating.
>>> Well, if platform logs that into the log-file, where can I find the
>>> one in the situation, when log4j was not able to intercept the error
>>> event?
>>>
>>> Tom Schindl wrote:
>>>> Hi,
>>>>
>>>> Well that's nothing you could do in your own plugin. I don't have a
>>>> clue if this could be done but I think you'll always have to same
>>>> problem that if you want to inject custom code if the loading of it
>>>> fails you can't intercept this (the platform of course logs into the
>>>> log-file).
>>>>
>>>> If the chicken is behead before it could lay the egg, the egg is out
>>>> of luck ;-) Sorry for the rude analogy.
>>>>
>>>> Tom
>>>>
>>>> Peter Osipov schrieb:
>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>> Well, so I should put that logger initialization in start method, eh?
>>>>> In that case I am not logging the situation when the application
>>>>> does not start(more precisely - the "initializing" bundle is not
>>>>> started) for some reason, which I want to log, as well, actually.
>>>>> If that is possible, of course.
>>>>> Tom Schindl wrote:
>>>>>> Peter Osipov schrieb:
>>>>>>> Hi Tom!
>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>> understand all the bits in your reply to my post:
>>>>>>>
>>>>>>> /first 2nd thing/
>>>>>>>
>>>>>>
>>>>>> Sorry the process is the following:
>>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>>> 2. Start is called of this Activator
>>>>>> 3. Class loaded, instantiated, method called
>>>>>> 4. ...
>>>>>>
>>>>>> The key is that start() is the first method in your plugin which
>>>>>> is called before any other code runs (under the assumption that
>>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>>> How should I understand that one? :-\
>>>>>>> Tom Schindl wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> start is the first 2nd thing called (after the constructor) when
>>>>>>>> you
>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>>> fail in
>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>
>>>>>>>> Tom
>>>>>>>>
>>>>>>>> Peter Osipov schrieb:
>>>>>>>>
>>>>>>>>> Hello Stefan.
>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>> articles
>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>>> when your
>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>
>>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>>> Eclipse:
>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>
>>>>>>>>>> HTH,
>>>>>>>>>> Stefan
>>>>>>>>>>
>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>
>>>>>>>>>>> Hello everybody!
>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is that I
>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>> thinking of
>>>>>>>>>>> putting it into:
>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>>> possible,
>>>>>>>>>>> but when start method is called, I can see that some threads are
>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>> before I
>>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>
>>>>>>>
|
|
|
Re: logger starting [message #463476 is a reply to message #463474] |
Mon, 12 February 2007 10:39   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Huh, Tom. It seems like you are splitting the hair. But, nevertheless, I
am with you. Thanks so much for it! You are star. I am telling you. 8-)
Tom Schindl wrote:
> Hi,
>
> well but that's exactly what you need you need a central plugin
> started up very early which configures log4j and provides
> possibilities to other plugins to log. Not every plugin configures its
> own logger but they are all loging through one central Log-Service. I
> only wanted to point you to this article to get familiar how you could
> create your log-service. Which looks similar to the ILog-Service
> provided by eclipse. I think you can inject your own log-service into
> eclipse maybe this article provides pointers how to that:
>
> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>
> Tom
>
> Peter Osipov schrieb:
>> I am reading the article right now. It is just that it does not have
>> anything about logger services, eh?
>>
>> Tom Schindl wrote:
>>> Platform always logs into workspace/.metadata/.log
>>>
>>> by the what you really want to to have a generic logger services.
>>> Make sure you read this article at eclipsezone.
>>>
>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>> integrating.
>>>> Well, if platform logs that into the log-file, where can I find the
>>>> one in the situation, when log4j was not able to intercept the
>>>> error event?
>>>>
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> Well that's nothing you could do in your own plugin. I don't have
>>>>> a clue if this could be done but I think you'll always have to
>>>>> same problem that if you want to inject custom code if the loading
>>>>> of it fails you can't intercept this (the platform of course logs
>>>>> into the log-file).
>>>>>
>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>> Well, so I should put that logger initialization in start method,
>>>>>> eh?
>>>>>> In that case I am not logging the situation when the application
>>>>>> does not start(more precisely - the "initializing" bundle is not
>>>>>> started) for some reason, which I want to log, as well, actually.
>>>>>> If that is possible, of course.
>>>>>> Tom Schindl wrote:
>>>>>>> Peter Osipov schrieb:
>>>>>>>> Hi Tom!
>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>
>>>>>>>> /first 2nd thing/
>>>>>>>>
>>>>>>>
>>>>>>> Sorry the process is the following:
>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>>>> 2. Start is called of this Activator
>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>> 4. ...
>>>>>>>
>>>>>>> The key is that start() is the first method in your plugin which
>>>>>>> is called before any other code runs (under the assumption that
>>>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>>> How should I understand that one? :-\
>>>>>>>> Tom Schindl wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>> when you
>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>>>> fail in
>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>
>>>>>>>>> Tom
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>
>>>>>>>>>> Hello Stefan.
>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>> articles
>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>>>> when your
>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>
>>>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>>>> Eclipse:
>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>
>>>>>>>>>>> HTH,
>>>>>>>>>>> Stefan
>>>>>>>>>>>
>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>
>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>> that I
>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>> thinking of
>>>>>>>>>>>> putting it into:
>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>>>> possible,
>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>> threads are
>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>> before I
>>>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>
>>>>>>>>
|
|
|
Re: logger starting [message #463525 is a reply to message #463474] |
Tue, 13 February 2007 05:59   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Hello Tom. I read the articles yesterday.
They are really useful. But it does not give full details on hot to
inject my own log-service. Do you have any other articles to read? :-)
Tom Schindl wrote:
> Hi,
>
> well but that's exactly what you need you need a central plugin
> started up very early which configures log4j and provides
> possibilities to other plugins to log. Not every plugin configures its
> own logger but they are all loging through one central Log-Service. I
> only wanted to point you to this article to get familiar how you could
> create your log-service. Which looks similar to the ILog-Service
> provided by eclipse. I think you can inject your own log-service into
> eclipse maybe this article provides pointers how to that:
>
> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>
> Tom
>
> Peter Osipov schrieb:
>> I am reading the article right now. It is just that it does not have
>> anything about logger services, eh?
>>
>> Tom Schindl wrote:
>>> Platform always logs into workspace/.metadata/.log
>>>
>>> by the what you really want to to have a generic logger services.
>>> Make sure you read this article at eclipsezone.
>>>
>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>> integrating.
>>>> Well, if platform logs that into the log-file, where can I find the
>>>> one in the situation, when log4j was not able to intercept the
>>>> error event?
>>>>
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> Well that's nothing you could do in your own plugin. I don't have
>>>>> a clue if this could be done but I think you'll always have to
>>>>> same problem that if you want to inject custom code if the loading
>>>>> of it fails you can't intercept this (the platform of course logs
>>>>> into the log-file).
>>>>>
>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>> Well, so I should put that logger initialization in start method,
>>>>>> eh?
>>>>>> In that case I am not logging the situation when the application
>>>>>> does not start(more precisely - the "initializing" bundle is not
>>>>>> started) for some reason, which I want to log, as well, actually.
>>>>>> If that is possible, of course.
>>>>>> Tom Schindl wrote:
>>>>>>> Peter Osipov schrieb:
>>>>>>>> Hi Tom!
>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>
>>>>>>>> /first 2nd thing/
>>>>>>>>
>>>>>>>
>>>>>>> Sorry the process is the following:
>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>>>> 2. Start is called of this Activator
>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>> 4. ...
>>>>>>>
>>>>>>> The key is that start() is the first method in your plugin which
>>>>>>> is called before any other code runs (under the assumption that
>>>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>>> How should I understand that one? :-\
>>>>>>>> Tom Schindl wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>> when you
>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>>>> fail in
>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>
>>>>>>>>> Tom
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>
>>>>>>>>>> Hello Stefan.
>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>> articles
>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>>>> when your
>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>
>>>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>>>> Eclipse:
>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>
>>>>>>>>>>> HTH,
>>>>>>>>>>> Stefan
>>>>>>>>>>>
>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>
>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>> that I
>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>> thinking of
>>>>>>>>>>>> putting it into:
>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>>>> possible,
>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>> threads are
>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>> before I
>>>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>
>>>>>>>>
|
|
|
Re: logger starting [message #463528 is a reply to message #463525] |
Tue, 13 February 2007 06:29   |
Eclipse User |
|
|
|
Well if you ask me I'd do the following:
I'd write dedicated plugin which does the logging via Log4J for me which
i can require in any of my plugins and e.g. inject configuration using
extension points. As you have discovered this doesn't resolve the
problem when the Platform internally catches errors, ... => so to also
log those informations via log4j you simply register yourself as a
Platform.addLogListener() and log those informations via log4j.
The only question which remains is whether the Log4J-Plugin should allow
logging directly or only over the ILog-API. Another thing I'm not sure
whether it can be used is this new ErrorHandler-API introduce in 3.3
( https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced&short_desc_type=allwordssubstr&short_desc=%5BErr orHandling%5D&classification=Eclipse&product=Platfor m&target_milestone=3.3&target_milestone=3.3+M1&t arget_milestone=3.3+M2&target_milestone=3.3+M3&targe t_milestone=3.3+M4&target_milestone=3.3+M5&target_mi lestone=3.3+M6&long_desc_type=allwordssubstr&long_de sc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&a mp;status_whiteboard_type=allwordssubstr&status_whiteboa rd=&keywords_type=allwords&keywords=&emailtype1= substring&email1=&emailtype2=substring&email2=&a mp;bugidtype=include&bug_id=&votes=&chfieldfrom= &chfieldto=Now&chfieldvalue=&cmdtype=doit&or der=Reuse+same+sort+as+last+time&field0-0-0=noop&typ e0-0-0=noop&value0-0-0=)
The only thing you need to make sure is that Log4J plugin starts at the
very beginning so that you receive all errors in the early stages. I
think this can be done using the org.ui.startup-Extension point. But I'd
certainly take a look at this status-handler API maybe it provides new
possibilities to you e.g. (log to file, display error to user, ...).
Tom
Peter Osipov schrieb:
> Hello Tom. I read the articles yesterday.
> They are really useful. But it does not give full details on hot to
> inject my own log-service. Do you have any other articles to read? :-)
> Tom Schindl wrote:
>> Hi,
>>
>> well but that's exactly what you need you need a central plugin
>> started up very early which configures log4j and provides
>> possibilities to other plugins to log. Not every plugin configures its
>> own logger but they are all loging through one central Log-Service. I
>> only wanted to point you to this article to get familiar how you could
>> create your log-service. Which looks similar to the ILog-Service
>> provided by eclipse. I think you can inject your own log-service into
>> eclipse maybe this article provides pointers how to that:
>>
>> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>>
>> Tom
>>
>> Peter Osipov schrieb:
>>> I am reading the article right now. It is just that it does not have
>>> anything about logger services, eh?
>>>
>>> Tom Schindl wrote:
>>>> Platform always logs into workspace/.metadata/.log
>>>>
>>>> by the what you really want to to have a generic logger services.
>>>> Make sure you read this article at eclipsezone.
>>>>
>>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>>
>>>> Tom
>>>>
>>>> Peter Osipov schrieb:
>>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>>> integrating.
>>>>> Well, if platform logs that into the log-file, where can I find the
>>>>> one in the situation, when log4j was not able to intercept the
>>>>> error event?
>>>>>
>>>>> Tom Schindl wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Well that's nothing you could do in your own plugin. I don't have
>>>>>> a clue if this could be done but I think you'll always have to
>>>>>> same problem that if you want to inject custom code if the loading
>>>>>> of it fails you can't intercept this (the platform of course logs
>>>>>> into the log-file).
>>>>>>
>>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>> Peter Osipov schrieb:
>>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>>> Well, so I should put that logger initialization in start method,
>>>>>>> eh?
>>>>>>> In that case I am not logging the situation when the application
>>>>>>> does not start(more precisely - the "initializing" bundle is not
>>>>>>> started) for some reason, which I want to log, as well, actually.
>>>>>>> If that is possible, of course.
>>>>>>> Tom Schindl wrote:
>>>>>>>> Peter Osipov schrieb:
>>>>>>>>> Hi Tom!
>>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>>
>>>>>>>>> /first 2nd thing/
>>>>>>>>>
>>>>>>>>
>>>>>>>> Sorry the process is the following:
>>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>>>>> 2. Start is called of this Activator
>>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>>> 4. ...
>>>>>>>>
>>>>>>>> The key is that start() is the first method in your plugin which
>>>>>>>> is called before any other code runs (under the assumption that
>>>>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>>
>>>>>>>> Tom
>>>>>>>>
>>>>>>>>> How should I understand that one? :-\
>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>>> when you
>>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>>>>> fail in
>>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>>
>>>>>>>>>> Tom
>>>>>>>>>>
>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>
>>>>>>>>>>> Hello Stefan.
>>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>>> articles
>>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>>>>> when your
>>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>>
>>>>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>>>>> Eclipse:
>>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>>
>>>>>>>>>>>> HTH,
>>>>>>>>>>>> Stefan
>>>>>>>>>>>>
>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>>> that I
>>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>>> thinking of
>>>>>>>>>>>>> putting it into:
>>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>>>>> possible,
>>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>>> threads are
>>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>>> before I
>>>>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>>
>>>>>>>>>
|
|
|
Re: logger starting [message #463530 is a reply to message #463528] |
Tue, 13 February 2007 07:08   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Thanks Tom very much for your answer.
Well, org.ui.startup-Extension point is of no use.
IStartup#earlyStartup() method is called according to this comment:
"Will be called in a separate thread after the workbench initializes".
So, it is a bit late to initialize the log4j there I think, because
there might me errors during the workbench initialization process which
I will not be able to catch. So, I still cannot figure out how to early
start the log4j plug-in.
Should I download eclipse 3.3 to explore all the new features added?
Tom Schindl wrote:
> Well if you ask me I'd do the following:
>
> I'd write dedicated plugin which does the logging via Log4J for me
> which i can require in any of my plugins and e.g. inject configuration
> using extension points. As you have discovered this doesn't resolve
> the problem when the Platform internally catches errors, ... => so to
> also log those informations via log4j you simply register yourself as
> a Platform.addLogListener() and log those informations via log4j.
>
> The only question which remains is whether the Log4J-Plugin should
> allow logging directly or only over the ILog-API. Another thing I'm
> not sure whether it can be used is this new ErrorHandler-API introduce
> in 3.3
> ( https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced&short_desc_type=allwordssubstr&short_desc=%5BErr orHandling%5D&classification=Eclipse&product=Platfor m&target_milestone=3.3&target_milestone=3.3+M1&t arget_milestone=3.3+M2&target_milestone=3.3+M3&targe t_milestone=3.3+M4&target_milestone=3.3+M5&target_mi lestone=3.3+M6&long_desc_type=allwordssubstr&long_de sc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&a mp;status_whiteboard_type=allwordssubstr&status_whiteboa rd=&keywords_type=allwords&keywords=&emailtype1= substring&email1=&emailtype2=substring&email2=&a mp;bugidtype=include&bug_id=&votes=&chfieldfrom= &chfieldto=Now&chfieldvalue=&cmdtype=doit&or der=Reuse+same+sort+as+last+time&field0-0-0=noop&typ e0-0-0=noop&value0-0-0=)
>
>
> The only thing you need to make sure is that Log4J plugin starts at
> the very beginning so that you receive all errors in the early stages.
> I think this can be done using the org.ui.startup-Extension point. But
> I'd certainly take a look at this status-handler API maybe it provides
> new possibilities to you e.g. (log to file, display error to user, ...).
>
> Tom
>
> Peter Osipov schrieb:
>> Hello Tom. I read the articles yesterday.
>> They are really useful. But it does not give full details on hot to
>> inject my own log-service. Do you have any other articles to read? :-)
>> Tom Schindl wrote:
>>> Hi,
>>>
>>> well but that's exactly what you need you need a central plugin
>>> started up very early which configures log4j and provides
>>> possibilities to other plugins to log. Not every plugin configures
>>> its own logger but they are all loging through one central
>>> Log-Service. I only wanted to point you to this article to get
>>> familiar how you could create your log-service. Which looks similar
>>> to the ILog-Service provided by eclipse. I think you can inject your
>>> own log-service into eclipse maybe this article provides pointers
>>> how to that:
>>>
>>> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> I am reading the article right now. It is just that it does not
>>>> have anything about logger services, eh?
>>>>
>>>> Tom Schindl wrote:
>>>>> Platform always logs into workspace/.metadata/.log
>>>>>
>>>>> by the what you really want to to have a generic logger services.
>>>>> Make sure you read this article at eclipsezone.
>>>>>
>>>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>>>> integrating.
>>>>>> Well, if platform logs that into the log-file, where can I find
>>>>>> the one in the situation, when log4j was not able to intercept
>>>>>> the error event?
>>>>>>
>>>>>> Tom Schindl wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Well that's nothing you could do in your own plugin. I don't
>>>>>>> have a clue if this could be done but I think you'll always have
>>>>>>> to same problem that if you want to inject custom code if the
>>>>>>> loading of it fails you can't intercept this (the platform of
>>>>>>> course logs into the log-file).
>>>>>>>
>>>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> Peter Osipov schrieb:
>>>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>>>> Well, so I should put that logger initialization in start
>>>>>>>> method, eh?
>>>>>>>> In that case I am not logging the situation when the
>>>>>>>> application does not start(more precisely - the "initializing"
>>>>>>>> bundle is not started) for some reason, which I want to log, as
>>>>>>>> well, actually. If that is possible, of course.
>>>>>>>> Tom Schindl wrote:
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>> Hi Tom!
>>>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>>>
>>>>>>>>>> /first 2nd thing/
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Sorry the process is the following:
>>>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is
>>>>>>>>> called
>>>>>>>>> 2. Start is called of this Activator
>>>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>>>> 4. ...
>>>>>>>>>
>>>>>>>>> The key is that start() is the first method in your plugin
>>>>>>>>> which is called before any other code runs (under the
>>>>>>>>> assumption that your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>>>
>>>>>>>>> Tom
>>>>>>>>>
>>>>>>>>>> How should I understand that one? :-\
>>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>>>> when you
>>>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault()
>>>>>>>>>>> will fail in
>>>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>>>
>>>>>>>>>>> Tom
>>>>>>>>>>>
>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>
>>>>>>>>>>>> Hello Stefan.
>>>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>>>> articles
>>>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think the start() method should be the first method
>>>>>>>>>>>>> called when your
>>>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>>>
>>>>>>>>>>>>> Alternatively, you could use the logging system provided
>>>>>>>>>>>>> by Eclipse:
>>>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>>>
>>>>>>>>>>>>> HTH,
>>>>>>>>>>>>> Stefan
>>>>>>>>>>>>>
>>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>>>> that I
>>>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>>>> thinking of
>>>>>>>>>>>>>> putting it into:
>>>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> but not sure. It seems that logger should start as soon
>>>>>>>>>>>>>> as possible,
>>>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>>>> threads are
>>>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>>>> before I
>>>>>>>>>>>>>> initialize the log4j library, those errors will not be
>>>>>>>>>>>>>> logged.
>>>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>>>
>>>>>>>>>>
|
|
|
Re: logger starting [message #463531 is a reply to message #463474] |
Tue, 13 February 2007 07:09   |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
It just seems that there is not much documentation on services for now.
:-(
Tom Schindl wrote:
> Hi,
>
> well but that's exactly what you need you need a central plugin
> started up very early which configures log4j and provides
> possibilities to other plugins to log. Not every plugin configures its
> own logger but they are all loging through one central Log-Service. I
> only wanted to point you to this article to get familiar how you could
> create your log-service. Which looks similar to the ILog-Service
> provided by eclipse. I think you can inject your own log-service into
> eclipse maybe this article provides pointers how to that:
>
> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>
> Tom
>
> Peter Osipov schrieb:
>> I am reading the article right now. It is just that it does not have
>> anything about logger services, eh?
>>
>> Tom Schindl wrote:
>>> Platform always logs into workspace/.metadata/.log
>>>
>>> by the what you really want to to have a generic logger services.
>>> Make sure you read this article at eclipsezone.
>>>
>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>> integrating.
>>>> Well, if platform logs that into the log-file, where can I find the
>>>> one in the situation, when log4j was not able to intercept the
>>>> error event?
>>>>
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> Well that's nothing you could do in your own plugin. I don't have
>>>>> a clue if this could be done but I think you'll always have to
>>>>> same problem that if you want to inject custom code if the loading
>>>>> of it fails you can't intercept this (the platform of course logs
>>>>> into the log-file).
>>>>>
>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>> Well, so I should put that logger initialization in start method,
>>>>>> eh?
>>>>>> In that case I am not logging the situation when the application
>>>>>> does not start(more precisely - the "initializing" bundle is not
>>>>>> started) for some reason, which I want to log, as well, actually.
>>>>>> If that is possible, of course.
>>>>>> Tom Schindl wrote:
>>>>>>> Peter Osipov schrieb:
>>>>>>>> Hi Tom!
>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>
>>>>>>>> /first 2nd thing/
>>>>>>>>
>>>>>>>
>>>>>>> Sorry the process is the following:
>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is called
>>>>>>> 2. Start is called of this Activator
>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>> 4. ...
>>>>>>>
>>>>>>> The key is that start() is the first method in your plugin which
>>>>>>> is called before any other code runs (under the assumption that
>>>>>>> your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>>> How should I understand that one? :-\
>>>>>>>> Tom Schindl wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>> when you
>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault() will
>>>>>>>>> fail in
>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>
>>>>>>>>> Tom
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>
>>>>>>>>>> Hello Stefan.
>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>> articles
>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I think the start() method should be the first method called
>>>>>>>>>>> when your
>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>
>>>>>>>>>>> Alternatively, you could use the logging system provided by
>>>>>>>>>>> Eclipse:
>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>
>>>>>>>>>>> HTH,
>>>>>>>>>>> Stefan
>>>>>>>>>>>
>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>
>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>> that I
>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>> thinking of
>>>>>>>>>>>> putting it into:
>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> but not sure. It seems that logger should start as soon as
>>>>>>>>>>>> possible,
>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>> threads are
>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>> before I
>>>>>>>>>>>> initialize the log4j library, those errors will not be logged.
>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>
>>>>>>>>
|
|
|
Re: logger starting [message #463532 is a reply to message #463530] |
Tue, 13 February 2007 07:22   |
Eclipse User |
|
|
|
Hi,
Well then you need to dig into Equinox and find out how you specify that
your plugin is enabled as the first one after Equinox and Platform
(which you need to be started because you want to call
Platform#addLogListener()) ;-). The best idea is to ask at their
mailling list/newsgroup. I could swear this can be done, maybe through a
setting an option in the config.ini, ... .
Tom
Peter Osipov schrieb:
> Thanks Tom very much for your answer.
> Well, org.ui.startup-Extension point is of no use.
> IStartup#earlyStartup() method is called according to this comment:
> "Will be called in a separate thread after the workbench initializes".
> So, it is a bit late to initialize the log4j there I think, because
> there might me errors during the workbench initialization process which
> I will not be able to catch. So, I still cannot figure out how to early
> start the log4j plug-in.
> Should I download eclipse 3.3 to explore all the new features added?
>
> Tom Schindl wrote:
>> Well if you ask me I'd do the following:
>>
>> I'd write dedicated plugin which does the logging via Log4J for me
>> which i can require in any of my plugins and e.g. inject configuration
>> using extension points. As you have discovered this doesn't resolve
>> the problem when the Platform internally catches errors, ... => so to
>> also log those informations via log4j you simply register yourself as
>> a Platform.addLogListener() and log those informations via log4j.
>>
>> The only question which remains is whether the Log4J-Plugin should
>> allow logging directly or only over the ILog-API. Another thing I'm
>> not sure whether it can be used is this new ErrorHandler-API introduce
>> in 3.3
>> ( https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced&short_desc_type=allwordssubstr&short_desc=%5BErr orHandling%5D&classification=Eclipse&product=Platfor m&target_milestone=3.3&target_milestone=3.3+M1&t arget_milestone=3.3+M2&target_milestone=3.3+M3&targe t_milestone=3.3+M4&target_milestone=3.3+M5&target_mi lestone=3.3+M6&long_desc_type=allwordssubstr&long_de sc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&a mp;status_whiteboard_type=allwordssubstr&status_whiteboa rd=&keywords_type=allwords&keywords=&emailtype1= substring&email1=&emailtype2=substring&email2=&a mp;bugidtype=include&bug_id=&votes=&chfieldfrom= &chfieldto=Now&chfieldvalue=&cmdtype=doit&or der=Reuse+same+sort+as+last+time&field0-0-0=noop&typ e0-0-0=noop&value0-0-0=)
>>
>>
>> The only thing you need to make sure is that Log4J plugin starts at
>> the very beginning so that you receive all errors in the early stages.
>> I think this can be done using the org.ui.startup-Extension point. But
>> I'd certainly take a look at this status-handler API maybe it provides
>> new possibilities to you e.g. (log to file, display error to user, ...).
>>
>> Tom
>>
>> Peter Osipov schrieb:
>>> Hello Tom. I read the articles yesterday.
>>> They are really useful. But it does not give full details on hot to
>>> inject my own log-service. Do you have any other articles to read? :-)
>>> Tom Schindl wrote:
>>>> Hi,
>>>>
>>>> well but that's exactly what you need you need a central plugin
>>>> started up very early which configures log4j and provides
>>>> possibilities to other plugins to log. Not every plugin configures
>>>> its own logger but they are all loging through one central
>>>> Log-Service. I only wanted to point you to this article to get
>>>> familiar how you could create your log-service. Which looks similar
>>>> to the ILog-Service provided by eclipse. I think you can inject your
>>>> own log-service into eclipse maybe this article provides pointers
>>>> how to that:
>>>>
>>>> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>>>>
>>>> Tom
>>>>
>>>> Peter Osipov schrieb:
>>>>> I am reading the article right now. It is just that it does not
>>>>> have anything about logger services, eh?
>>>>>
>>>>> Tom Schindl wrote:
>>>>>> Platform always logs into workspace/.metadata/.log
>>>>>>
>>>>>> by the what you really want to to have a generic logger services.
>>>>>> Make sure you read this article at eclipsezone.
>>>>>>
>>>>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>> Peter Osipov schrieb:
>>>>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>>>>> integrating.
>>>>>>> Well, if platform logs that into the log-file, where can I find
>>>>>>> the one in the situation, when log4j was not able to intercept
>>>>>>> the error event?
>>>>>>>
>>>>>>> Tom Schindl wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Well that's nothing you could do in your own plugin. I don't
>>>>>>>> have a clue if this could be done but I think you'll always have
>>>>>>>> to same problem that if you want to inject custom code if the
>>>>>>>> loading of it fails you can't intercept this (the platform of
>>>>>>>> course logs into the log-file).
>>>>>>>>
>>>>>>>> If the chicken is behead before it could lay the egg, the egg is
>>>>>>>> out of luck ;-) Sorry for the rude analogy.
>>>>>>>>
>>>>>>>> Tom
>>>>>>>>
>>>>>>>> Peter Osipov schrieb:
>>>>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>>>>> Well, so I should put that logger initialization in start
>>>>>>>>> method, eh?
>>>>>>>>> In that case I am not logging the situation when the
>>>>>>>>> application does not start(more precisely - the "initializing"
>>>>>>>>> bundle is not started) for some reason, which I want to log, as
>>>>>>>>> well, actually. If that is possible, of course.
>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>> Hi Tom!
>>>>>>>>>>> Well, I did read it. So, what are you saying? I just did not
>>>>>>>>>>> understand all the bits in your reply to my post:
>>>>>>>>>>>
>>>>>>>>>>> /first 2nd thing/
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Sorry the process is the following:
>>>>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is
>>>>>>>>>> called
>>>>>>>>>> 2. Start is called of this Activator
>>>>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>>>>> 4. ...
>>>>>>>>>>
>>>>>>>>>> The key is that start() is the first method in your plugin
>>>>>>>>>> which is called before any other code runs (under the
>>>>>>>>>> assumption that your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>>>>
>>>>>>>>>> Tom
>>>>>>>>>>
>>>>>>>>>>> How should I understand that one? :-\
>>>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> start is the first 2nd thing called (after the constructor)
>>>>>>>>>>>> when you
>>>>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault()
>>>>>>>>>>>> will fail in
>>>>>>>>>>>> other cases see my thread about BundleActivation from today ;-)
>>>>>>>>>>>>
>>>>>>>>>>>> Tom
>>>>>>>>>>>>
>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello Stefan.
>>>>>>>>>>>>> It seems that ILog might be an alternative. Do you know any
>>>>>>>>>>>>> articles
>>>>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I think the start() method should be the first method
>>>>>>>>>>>>>> called when your
>>>>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Alternatively, you could use the logging system provided
>>>>>>>>>>>>>> by Eclipse:
>>>>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> HTH,
>>>>>>>>>>>>>> Stefan
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem is
>>>>>>>>>>>>>>> that I
>>>>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>>>>> thinking of
>>>>>>>>>>>>>>> putting it into:
>>>>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> but not sure. It seems that logger should start as soon
>>>>>>>>>>>>>>> as possible,
>>>>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>>>>> threads are
>>>>>>>>>>>>>>> already working which means that if something goes wrong
>>>>>>>>>>>>>>> before I
>>>>>>>>>>>>>>> initialize the log4j library, those errors will not be
>>>>>>>>>>>>>>> logged.
>>>>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>>>>
>>>>>>>>>>>
|
|
|
Re: logger starting [message #463533 is a reply to message #463532] |
Tue, 13 February 2007 07:26  |
Eclipse User |
|
|
|
Originally posted by: peter_ossipov.mail.ru
Thanks Tom a million!
Let me go on there mailing list and ask them
Tom Schindl wrote:
> Hi,
>
> Well then you need to dig into Equinox and find out how you specify
> that your plugin is enabled as the first one after Equinox and
> Platform (which you need to be started because you want to call
> Platform#addLogListener()) ;-). The best idea is to ask at their
> mailling list/newsgroup. I could swear this can be done, maybe through
> a setting an option in the config.ini, ... .
>
> Tom
>
> Peter Osipov schrieb:
>> Thanks Tom very much for your answer.
>> Well, org.ui.startup-Extension point is of no use.
>> IStartup#earlyStartup() method is called according to this comment:
>> "Will be called in a separate thread after the workbench
>> initializes". So, it is a bit late to initialize the log4j there I
>> think, because there might me errors during the workbench
>> initialization process which I will not be able to catch. So, I still
>> cannot figure out how to early start the log4j plug-in.
>> Should I download eclipse 3.3 to explore all the new features added?
>>
>> Tom Schindl wrote:
>>> Well if you ask me I'd do the following:
>>>
>>> I'd write dedicated plugin which does the logging via Log4J for me
>>> which i can require in any of my plugins and e.g. inject
>>> configuration using extension points. As you have discovered this
>>> doesn't resolve the problem when the Platform internally catches
>>> errors, ... => so to also log those informations via log4j you
>>> simply register yourself as a Platform.addLogListener() and log
>>> those informations via log4j.
>>>
>>> The only question which remains is whether the Log4J-Plugin should
>>> allow logging directly or only over the ILog-API. Another thing I'm
>>> not sure whether it can be used is this new ErrorHandler-API
>>> introduce in 3.3
>>> ( https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced&short_desc_type=allwordssubstr&short_desc=%5BErr orHandling%5D&classification=Eclipse&product=Platfor m&target_milestone=3.3&target_milestone=3.3+M1&t arget_milestone=3.3+M2&target_milestone=3.3+M3&targe t_milestone=3.3+M4&target_milestone=3.3+M5&target_mi lestone=3.3+M6&long_desc_type=allwordssubstr&long_de sc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&a mp;status_whiteboard_type=allwordssubstr&status_whiteboa rd=&keywords_type=allwords&keywords=&emailtype1= substring&email1=&emailtype2=substring&email2=&a mp;bugidtype=include&bug_id=&votes=&chfieldfrom= &chfieldto=Now&chfieldvalue=&cmdtype=doit&or der=Reuse+same+sort+as+last+time&field0-0-0=noop&typ e0-0-0=noop&value0-0-0=)
>>>
>>>
>>> The only thing you need to make sure is that Log4J plugin starts at
>>> the very beginning so that you receive all errors in the early
>>> stages. I think this can be done using the org.ui.startup-Extension
>>> point. But I'd certainly take a look at this status-handler API
>>> maybe it provides new possibilities to you e.g. (log to file,
>>> display error to user, ...).
>>>
>>> Tom
>>>
>>> Peter Osipov schrieb:
>>>> Hello Tom. I read the articles yesterday.
>>>> They are really useful. But it does not give full details on hot to
>>>> inject my own log-service. Do you have any other articles to read? :-)
>>>> Tom Schindl wrote:
>>>>> Hi,
>>>>>
>>>>> well but that's exactly what you need you need a central plugin
>>>>> started up very early which configures log4j and provides
>>>>> possibilities to other plugins to log. Not every plugin configures
>>>>> its own logger but they are all loging through one central
>>>>> Log-Service. I only wanted to point you to this article to get
>>>>> familiar how you could create your log-service. Which looks
>>>>> similar to the ILog-Service provided by eclipse. I think you can
>>>>> inject your own log-service into eclipse maybe this article
>>>>> provides pointers how to that:
>>>>>
>>>>> http://eclipsezone.com/articles/franey-logging/?source=archi ves
>>>>>
>>>>> Tom
>>>>>
>>>>> Peter Osipov schrieb:
>>>>>> I am reading the article right now. It is just that it does not
>>>>>> have anything about logger services, eh?
>>>>>>
>>>>>> Tom Schindl wrote:
>>>>>>> Platform always logs into workspace/.metadata/.log
>>>>>>>
>>>>>>> by the what you really want to to have a generic logger
>>>>>>> services. Make sure you read this article at eclipsezone.
>>>>>>>
>>>>>>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> Peter Osipov schrieb:
>>>>>>>> Thanks, Tom. :-) Yep, there will always be a problem when
>>>>>>>> integrating.
>>>>>>>> Well, if platform logs that into the log-file, where can I find
>>>>>>>> the one in the situation, when log4j was not able to intercept
>>>>>>>> the error event?
>>>>>>>>
>>>>>>>> Tom Schindl wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Well that's nothing you could do in your own plugin. I don't
>>>>>>>>> have a clue if this could be done but I think you'll always
>>>>>>>>> have to same problem that if you want to inject custom code if
>>>>>>>>> the loading of it fails you can't intercept this (the platform
>>>>>>>>> of course logs into the log-file).
>>>>>>>>>
>>>>>>>>> If the chicken is behead before it could lay the egg, the egg
>>>>>>>>> is out of luck ;-) Sorry for the rude analogy.
>>>>>>>>>
>>>>>>>>> Tom
>>>>>>>>>
>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>> Okay, now it is clear. Thanks Tom! 8-)
>>>>>>>>>> Well, so I should put that logger initialization in start
>>>>>>>>>> method, eh?
>>>>>>>>>> In that case I am not logging the situation when the
>>>>>>>>>> application does not start(more precisely - the
>>>>>>>>>> "initializing" bundle is not started) for some reason, which
>>>>>>>>>> I want to log, as well, actually. If that is possible, of
>>>>>>>>>> course.
>>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>> Hi Tom!
>>>>>>>>>>>> Well, I did read it. So, what are you saying? I just did
>>>>>>>>>>>> not understand all the bits in your reply to my post:
>>>>>>>>>>>>
>>>>>>>>>>>> /first 2nd thing/
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Sorry the process is the following:
>>>>>>>>>>> 1. Constructor is called of Activator defined in MANIFEST is
>>>>>>>>>>> called
>>>>>>>>>>> 2. Start is called of this Activator
>>>>>>>>>>> 3. Class loaded, instantiated, method called
>>>>>>>>>>> 4. ...
>>>>>>>>>>>
>>>>>>>>>>> The key is that start() is the first method in your plugin
>>>>>>>>>>> which is called before any other code runs (under the
>>>>>>>>>>> assumption that your MANIFEST holds "Eclipse-LazyStart: true").
>>>>>>>>>>>
>>>>>>>>>>> Tom
>>>>>>>>>>>
>>>>>>>>>>>> How should I understand that one? :-\
>>>>>>>>>>>> Tom Schindl wrote:
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> start is the first 2nd thing called (after the
>>>>>>>>>>>>> constructor) when you
>>>>>>>>>>>>> have set the LazyStart-bit in MANIFEST. Even getDefault()
>>>>>>>>>>>>> will fail in
>>>>>>>>>>>>> other cases see my thread about BundleActivation from
>>>>>>>>>>>>> today ;-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tom
>>>>>>>>>>>>>
>>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hello Stefan.
>>>>>>>>>>>>>> It seems that ILog might be an alternative. Do you know
>>>>>>>>>>>>>> any articles
>>>>>>>>>>>>>> (pros and cons) for eclipse logging system?
>>>>>>>>>>>>>> Stefan Zugal wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I think the start() method should be the first method
>>>>>>>>>>>>>>> called when your
>>>>>>>>>>>>>>> plugin is loaded (although I'm not quite sure ...).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Alternatively, you could use the logging system provided
>>>>>>>>>>>>>>> by Eclipse:
>>>>>>>>>>>>>>> MyPlugin.getDefault().getLog()
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> HTH,
>>>>>>>>>>>>>>> Stefan
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Peter Osipov schrieb:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hello everybody!
>>>>>>>>>>>>>>>> I am using log4j for logging. Quite nice. the problem
>>>>>>>>>>>>>>>> is that I
>>>>>>>>>>>>>>>> cannot figure out where to initialize the logger. I am
>>>>>>>>>>>>>>>> thinking of
>>>>>>>>>>>>>>>> putting it into:
>>>>>>>>>>>>>>>> org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framew ork.BundleContext)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> but not sure. It seems that logger should start as soon
>>>>>>>>>>>>>>>> as possible,
>>>>>>>>>>>>>>>> but when start method is called, I can see that some
>>>>>>>>>>>>>>>> threads are
>>>>>>>>>>>>>>>> already working which means that if something goes
>>>>>>>>>>>>>>>> wrong before I
>>>>>>>>>>>>>>>> initialize the log4j library, those errors will not be
>>>>>>>>>>>>>>>> logged.
>>>>>>>>>>>>>>>> Thanks very much in advance for your support, folks!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>
|
|
|
Goto Forum:
Current Time: Tue Apr 15 02:42:37 EDT 2025
Powered by FUDForum. Page generated in 0.05430 seconds
|