Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » [Fwd: Capturing the platform logs]
[Fwd: Capturing the platform logs] [message #75384] Wed, 28 June 2006 07:43 Go to next message
Robert Enyedi is currently offline Robert EnyediFriend
Messages: 68
Registered: July 2009
Member
Hi,

I'm developing an Eclipse plug-in which uses Log4j for its logging.

Is there a mechanism to capture the platform's messages that go into
..metadata/.log so that I can also include them into my log file (for
traceability reasons)? I'm interested the most in errors that include
stack traces (e.g. the NullPointerException).

I tried and extreme solution by attaching a log listener to the
org.eclipse.internal.UIPlugin but this does not do the trick. Did anyone
encounter a similar problem or know the solution to this problem?

I initially asked about this on the eclipse.platform newsgroup and Curt
(curtispd@ca.ibm.com) redirected me to this group knowing that this
project has a logging subcomponent that might do what I want. Does it? :-)

Thanks,
Robert
Re: [Fwd: Capturing the platform logs] [message #75435 is a reply to message #75384] Wed, 28 June 2006 14:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nmehrega.ca.ibm.com

--=_mixed 005107538525719B_=
Content-Type: multipart/alternative; boundary="=_alternative 005107538525719B_="


--=_alternative 005107538525719B_=
Content-Type: text/plain; charset="US-ASCII"

Do you want to *always* trace the errors logged in Eclipse's log file or
just in some scenarios? One way you can do this is by using Probekit in
TPTP, which allows you to do static/dynamic byte code instrumentation.
Please see "Probing Java application behavior with Probekit" in here
http://www.eclipse.org/tptp/home/documents/conferences/eclip seCon2006/index.html
and check out the Demo.zip file posted. Also see the help content of TPTP
for more information.

With Probekit, you can write probes that target the class which logs error
messages in Eclipse. You can then take the error message and retarget it
to your logging file. The Demo.zip file contains a couple of sample
probes, see the readme file included in this zip file for more info. I'm
also attaching a simple probe that logs messages to a file for each method
entry/exit and any exceptions that occur.

Now the question is whether you want to always monitor Eclipse's error
messages or just in some scenarios. If it's just in some scenarios you
can easily do this using dyanmic probekit. If you want to always capture
these error messages, you can statically instrument the JAR file that
contains the class respsonsible for logging to Eclipse's log file and use
the modified JAR file to always capture Eclipse's error messages.



--=_alternative 005107538525719B_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Do you want to *always* trace the errors
logged in Eclipse's log file or just in some scenarios? One way you can
do this is &nbsp;by using Probekit in TPTP, which allows you to do static/dynamic
byte code instrumentation. &nbsp;Please see &quot;Probing Java application
behavior with Probekit&quot; in here http://www.eclipse.org/tptp/home/documents/conferences/eclip seCon2006/index.html
and check out the Demo.zip file posted. &nbsp;Also see the help content
of TPTP for more information.</font>
<br>
<br><font size=2 face="sans-serif">With Probekit, you can write probes
that target the class which logs error messages in Eclipse. &nbsp;You can
then take the error message and retarget it to your logging file. &nbsp;The
Demo.zip file contains a couple of sample probes, see the readme file included
in this zip file for more info. &nbsp;I'm also attaching a simple probe
that logs messages to a file for each method entry/exit and any exceptions
that occur.</font>
<br>
<br><font size=2 face="sans-serif">Now the question is whether you want
to always monitor Eclipse's error messages or just in some scenarios. &nbsp;If
it's just in some scenarios you can easily do this using dyanmic probekit.
&nbsp;If you want to always capture these error messages, you can statically
instrument the JAR file that contains the class respsonsible for logging
to Eclipse's log file and use the modified JAR file to always capture Eclipse's
error messages.</font>
<br>
<br>
<br>
--=_alternative 005107538525719B_=--
--=_mixed 005107538525719B_=
Content-Type: application/octet-stream; name="EntryExitToFile.probe"
Content-Disposition: attachment; filename="EntryExitToFile.probe"
Content-Transfer-Encoding: base64

PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxwcm9i ZWtpdD4NCiAgPGxh
YmVsIGRlc2NyaXB0aW9uPSJMb2dzIG1ldGhvZCBlbnRyeSBleGl0cyB0byBv bmUgZmlsZSBhbmQg
bG9ncyBleGNlcHRpb25zIHRvIGFub3RoZXIgZmlsZS4gIFNwZWNpZnkgbG9j YXRpb24gb2YgZmls
ZXMgaW4gZnJhZ21lbnRBdENsYXNzU2NvcGUuIiB4bWw6bGFuZz0iZW4tQ0Ei IG5hbWU9IkVudHJ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dtZW50Pg0KICA8 L3Byb2JlPg0KPC9w
cm9iZWtpdD4=

--=_mixed 005107538525719B_=--
Re: Capturing the platform logs] [message #75453 is a reply to message #75384] Wed, 28 June 2006 15:09 Go to previous messageGo to next message
Paul Slauenwhite is currently offline Paul SlauenwhiteFriend
Messages: 975
Registered: July 2009
Senior Member
Hi Robert,
Unfortunately, TPTP does not integrate with the Eclipse Logging
facility. A consuming product does provide this integration which we are
trying to contribute to Eclipse (see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=83550).

That said, it appears that you want to register your custom LogListener
implmentation with the Platform's logger to capture all of the logged
records for processing. For example:

org.eclipse.core.runtime.ILogListener iLogListener = new
org.eclipse.core.runtime.ILogListener(){


public void logging(org.eclipse.core.runtime.IStatus status, String
plugin){

System.out.println(status);

System.out.println(plugin);

}

};

org.eclipse.core.runtime.Platform.addLogListener(iLogListene r);

You may also want to register your plugin early to catch all of the
logged records by implementing the org.eclipse.ui.startup extension point.

Paul
"Robert Enyedi" <renyedi@yahoo.com> wrote in message
news:e7tbu8$5rm$1@utils.eclipse.org...
> Hi,
>
> I'm developing an Eclipse plug-in which uses Log4j for its logging.
>
> Is there a mechanism to capture the platform's messages that go into
> .metadata/.log so that I can also include them into my log file (for
> traceability reasons)? I'm interested the most in errors that include
> stack traces (e.g. the NullPointerException).
>
> I tried and extreme solution by attaching a log listener to the
> org.eclipse.internal.UIPlugin but this does not do the trick. Did anyone
> encounter a similar problem or know the solution to this problem?
>
> I initially asked about this on the eclipse.platform newsgroup and Curt
> (curtispd@ca.ibm.com) redirected me to this group knowing that this
> project has a logging subcomponent that might do what I want. Does it? :-)
>
> Thanks,
> Robert
Re: Capturing the platform logs] [message #75470 is a reply to message #75453] Wed, 28 June 2006 18:17 Go to previous messageGo to next message
Robert Enyedi is currently offline Robert EnyediFriend
Messages: 68
Registered: July 2009
Member
Hi Paul,

Registering my custom LogListener with the platform's logger is exactly
what I wanted to achieve. I previously tried registering to various
platform plugin loggers, but your solution is the one I was looking for.
Thanks!

Regards,
Robert

Paul Slauenwhite wrote:
> Hi Robert,
> Unfortunately, TPTP does not integrate with the Eclipse Logging
> facility. A consuming product does provide this integration which we are
> trying to contribute to Eclipse (see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=83550).
>
> That said, it appears that you want to register your custom LogListener
> implmentation with the Platform's logger to capture all of the logged
> records for processing. For example:
>
> org.eclipse.core.runtime.ILogListener iLogListener = new
> org.eclipse.core.runtime.ILogListener(){
>
>
> public void logging(org.eclipse.core.runtime.IStatus status, String
> plugin){
>
> System.out.println(status);
>
> System.out.println(plugin);
>
> }
>
> };
>
> org.eclipse.core.runtime.Platform.addLogListener(iLogListene r);
>
> You may also want to register your plugin early to catch all of the
> logged records by implementing the org.eclipse.ui.startup extension point.
>
> Paul
> "Robert Enyedi" <renyedi@yahoo.com> wrote in message
> news:e7tbu8$5rm$1@utils.eclipse.org...
>> Hi,
>>
>> I'm developing an Eclipse plug-in which uses Log4j for its logging.
>>
>> Is there a mechanism to capture the platform's messages that go into
>> .metadata/.log so that I can also include them into my log file (for
>> traceability reasons)? I'm interested the most in errors that include
>> stack traces (e.g. the NullPointerException).
>>
>> I tried and extreme solution by attaching a log listener to the
>> org.eclipse.internal.UIPlugin but this does not do the trick. Did anyone
>> encounter a similar problem or know the solution to this problem?
>>
>> I initially asked about this on the eclipse.platform newsgroup and Curt
>> (curtispd@ca.ibm.com) redirected me to this group knowing that this
>> project has a logging subcomponent that might do what I want. Does it? :-)
>>
>> Thanks,
>> Robert
>
>
Re: [Fwd: Capturing the platform logs] [message #75487 is a reply to message #75435] Wed, 28 June 2006 18:20 Go to previous message
Robert Enyedi is currently offline Robert EnyediFriend
Messages: 68
Registered: July 2009
Member
I wanted to trace all the platform level errors that my plugin might
generate. Paul was kind to provide me a simpler way to do this. In any
case, thank you very much for you reply.

Regards,
Robert

Navid_Mehregani wrote:
>
> Do you want to *always* trace the errors logged in Eclipse's log file or
> just in some scenarios? One way you can do this is by using Probekit in
> TPTP, which allows you to do static/dynamic byte code instrumentation.
> Please see "Probing Java application behavior with Probekit" in here
> http://www.eclipse.org/tptp/home/documents/conferences/eclip seCon2006/index.html
> and check out the Demo.zip file posted. Also see the help content of
> TPTP for more information.
>
> With Probekit, you can write probes that target the class which logs
> error messages in Eclipse. You can then take the error message and
> retarget it to your logging file. The Demo.zip file contains a couple
> of sample probes, see the readme file included in this zip file for more
> info. I'm also attaching a simple probe that logs messages to a file
> for each method entry/exit and any exceptions that occur.
>
> Now the question is whether you want to always monitor Eclipse's error
> messages or just in some scenarios. If it's just in some scenarios you
> can easily do this using dyanmic probekit. If you want to always
> capture these error messages, you can statically instrument the JAR file
> that contains the class respsonsible for logging to Eclipse's log file
> and use the modified JAR file to always capture Eclipse's error messages.
>
>
Previous Topic:AGR: Specifying workspace location when executing test
Next Topic:Do we need to use tptp junit plugin test?
Goto Forum:
  


Current Time: Sat May 11 06:24:25 GMT 2024

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

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

Back to the top