Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Papyrus/Papyrus Developer Guide/Papyrus Log

< Papyrus‎ | Papyrus Developer Guide
Revision as of 04:08, 7 December 2009 by Thibault.landre.atosorigin.com (Talk | contribs) (New page: Papyrus Log is using the log from Eclipse (see [https://bugs.eclipse.org/bugs/show_bug.cgi?id=292256]). The log are displayed in the "Error Log" view. == Activating Log == To benefit f...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Papyrus Log is using the log from Eclipse (see [1]). The log are displayed in the "Error Log" view.

Activating Log

To benefit from the Papyrus log mechanism, you must add onto your bundle :

A public static variable on your bundle activator :

       public class Activator extends AbstractUIPlugin {
          
          public static LogHelper log;
          
          public void start(BundleContext context) throws Exception {
               super.start(context);
               plugin = this;
               log = new LogHelper(plugin);
          }
          
       ...
       }

A static import of this variable on your class :

       import static org.eclipse.papyrus.navigator.internal.Activator.log;
       
       public class CreateDiagramAction extends Action {
       
         public void run() {
              log.info("log");
         }
       }

Writing Log

There are three levels of log in Papyrus : info, debug, error

info

  log.info("..."); //$NON-NLS-1$

debug

A debug log is used for development and/or debug purposes only. It MUST be encapsulated with the condition log.isDebugEnabled().

  if (log.isDebugEnabled()) {
      log.debug("Start - CreateDiagramAction#run"); //$NON-NLS-1$
  }

error

 try {
   ...
 } catch (IOException io) {
      log.error("");
      ...
 }

Displaying Log

Back to the top