Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » A logger directly in *.eiq possible?
A logger directly in *.eiq possible? [message #1316976] Sat, 26 April 2014 21:25 Go to next message
Emre T is currently offline Emre TFriend
Messages: 119
Registered: April 2013
Senior Member

is it possible to use a logger (e.g. log4j) directly within the eiq-file, where I define the patterns?

I remember that I had used log4j in my previous projects, where I was using the IncQuery API with Java. It worked as expected.

But now I only need to use the pattern definitions and nothing more at the moment. And what would be great is, that every time a pattern is called (e.g. in the runtime Eclipse with Query Explorer or by the derived references of an EMF model where the connections are built by IncQuery) that a logger logs the name of the pattern, its result etc. in a file or even in the console of development Eclipse instance. The reason for that is that I have a very long list of main queries which are also built on a lot of helper queries, and I sometimes loose control over them.

I have looked into the EMF-IncQuery code a little, and what I could find was some logging facilities for EVM and also some places where the log4j was used with the IncQuery API.

Best regards,
Re: A logger directly in *.eiq possible? [message #1317052 is a reply to message #1316976] Sat, 26 April 2014 22:25 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan RathFriend
Messages: 59
Registered: July 2009
Yes, inside the check expressions you can use any Java code that is visible on the classpath of your incquery project.
Re: A logger directly in *.eiq possible? [message #1317737 is a reply to message #1317052] Sun, 27 April 2014 07:53 Go to previous message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
You could use Logger calls in check expressions, but please don't! While it is true that it would be called every time the given check expression is evaluated, you would have to clutter your pattern definitions with accessing the attributes needed for logging (e.g. name feature of your parameters), which would in turn modify the meaning of your pattern as well.

Additionally, your patterns are never _called_ during runtime. A Rete network of nodes are built which propagate updates based on model changes. The check expression would be just another node that is called at some point when something related to the check expression changes.

The API (both generic and generated) was designed in order to provide such functionality from code, instead of messing with your declarative pattern definitions.

There are several possibilities:

  1. If you want to see which patterns are initialized by the engine, you can set the logging level of the IncQueryEngine to TRACE and look for the pattern builder logging events. See for details on how to turn on global logging.
  2. If you want to get notifications on match set changes on each matcher in an engine, you can attach a life-cycle listener to the engine (which will notify you of matcher initialization) and match update listeners on each matcher in the engine. See
  3. If you need this functionality in the Query Explorer, you can contribute to the menu (similarly to the Show location and (Re)Initialize Viewers Sandbox items).

Finally, you could create a Bugzilla for the following:

  • add logger level setting preferences option for Query Explorer
  • add trace level log events for match set changes using a well-defined Logger (e.g. IncQueryLoggingUtil.getLogger(BaseMatcher.class))
Previous Topic:Inherited derived references
Next Topic:Another "Ambiguous variable type defintions" problem
Goto Forum:

Current Time: Thu May 23 22:05:30 GMT 2024

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

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

Back to the top