Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Logging
Logging [message #247326] Tue, 04 September 2007 15:10 Go to next message
Eclipse UserFriend
Originally posted by: Rudolf.Ziegaus.gmx.de

Hello,

I hope this question is not too general and OT: what is the preferred way
to log information in plugins? I thought about using log4j, but I am also
open to different solutions if it's standard for Eclipse.

WOuld be great if you could point me to some documents, how to do the
logging.


TIA,

Rudi
Re: Logging [message #247482 is a reply to message #247326] Wed, 05 September 2007 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jacek.pospychala.pl.ibm.com

Rudolf,
the common way is to use statushandlers. There is a document about this
on Wiki: http://wiki.eclipse.org/Platform_UI_Error_Handling
It's generally about traveling of statuses. You can get a status (eg. if
you catch CoreException, then coreException.getStatus) or eventually
throw your own, in any crisis or success situation.
To handle a status you call StatusManager.getDefault.handle(...);
So it looks easy and is easy. The way, how statuses are handled (error
dialog, only log, etc.) can either be suggested directly with a style in
handle(status, style) method or customized by creating your own status
handler and registering under org.eclipse.ui.statusHandlers extension point.
Status contains a name of originating plugin, message, status code and a
Throwable if it applies. Statuses can also be grouped eg. if they are
all related to one issue.
There is also a service at lower lever - in Equinox -
(org.eclipse.equinox.log) to which you can register to catch up and
eventually process any errors, but this plugin has to be downloaded
separately from Equinox.

Of course you can still use log4j in your plugins, and afaik some people
do this, but it offers something quite different, so I guess which one
you choose will mainly depend on what you really need.

Rudolf Ziegaus wrote:
> Hello,
>
> I hope this question is not too general and OT: what is the preferred way
> to log information in plugins? I thought about using log4j, but I am also
> open to different solutions if it's standard for Eclipse.
>
> WOuld be great if you could point me to some documents, how to do the
> logging.
>
>
> TIA,
>
> Rudi
>
Re: Logging [message #247552 is a reply to message #247482] Thu, 06 September 2007 17:38 Go to previous message
Eclipse UserFriend
Originally posted by: Rudolf.Ziegaus.gmx.de

Am Wed, 05 Sep 2007 21:03:41 +0200 schrieb Jacek Pospychala:

> Rudolf,
> the common way is to use statushandlers. There is a document about this
> on Wiki: http://wiki.eclipse.org/Platform_UI_Error_Handling
> It's generally about traveling of statuses. You can get a status (eg. if
> you catch CoreException, then coreException.getStatus) or eventually
> throw your own, in any crisis or success situation.
> To handle a status you call StatusManager.getDefault.handle(...);
> So it looks easy and is easy. The way, how statuses are handled (error
> dialog, only log, etc.) can either be suggested directly with a style in
> handle(status, style) method or customized by creating your own status
> handler and registering under org.eclipse.ui.statusHandlers extension point.
> Status contains a name of originating plugin, message, status code and a
> Throwable if it applies. Statuses can also be grouped eg. if they are
> all related to one issue.
> There is also a service at lower lever - in Equinox -
> (org.eclipse.equinox.log) to which you can register to catch up and
> eventually process any errors, but this plugin has to be downloaded
> separately from Equinox.
>
> Of course you can still use log4j in your plugins, and afaik some people
> do this, but it offers something quite different, so I guess which one
> you choose will mainly depend on what you really need.
>
> Rudolf Ziegaus wrote:

Thanks for the extensive info. I think I'll stick to the statushandler
concept.


Rudi
Previous Topic:Programmatically switching to a view
Next Topic:Running eclipse with -data for setting the workspace
Goto Forum:
  


Current Time: Sat Jul 26 03:06:00 EDT 2025

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

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

Back to the top