eclipselabs/passerelle

Suggestion: new Actor method logInfo

Closed this issue · 3 comments

Hi,

As I mentioned briefly in the Passerelle meeting in Gent recently I have added 
in the DAWN Passerelle repositories a new method to Actor.java:

   * Generic log method for all actors. The idea is to harmonize the log
   * message, if in 'info' level add the actor name and if in 'trace' or 'debug'
   * level add the full name.
   * 
   */
  public void logInfo(String logMessage) {
    if (LOGGER.isInfoEnabled())
        LOGGER.info( logMessage + " (actor '" + this.getName() + "')");
    else if (LOGGER.isTraceEnabled() || LOGGER.isDebugEnabled())
        LOGGER.info( logMessage + " (actor '" + this.getFullName() + "')");
  }

There are two aims with this method:

- The info log output of actors are harmonized, i.e. they look similar

- In debug mode more info is added (i.e. full name)

The idea is also to use this method with Jmx, possibly via the 
ExecutionTracerService.

Would it be possible for you to add this method into Actor.java in the main SVN 
Psserelle repository? Please let me know if you have other suggestions.

Regards,

Olof



Original issue reported on code.google.com by s.olof.svensson@gmail.com on 30 Nov 2012 at 8:38

Hi Olof,

We prefer to have the actor's name in front of the logged message.

Also, in your code I have the impression that it would never reach the 
trace/debug part as the isInfoEnabledd will also trigger then?

So I would do something like :

public void logInfo(String logMessage) {
    if (LOGGER.isTraceEnabled() || LOGGER.isDebugEnabled())
        LOGGER.debug( this.getFullName() + " - " + logMessage);
    else if (LOGGER.isInfoEnabled())
        LOGGER.info( this.getName() + " - " + logMessage);
  }

Original comment by erwin...@gmail.com on 5 Dec 2012 at 8:05

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
Hi Erwin,

I agree with your changes. Thanks in advance for adding this code to the 
Passerelle repository!

Olof

Original comment by s.olof.svensson@gmail.com on 5 Dec 2012 at 12:34

done.

Original comment by erwin...@gmail.com on 9 Dec 2012 at 2:55

  • Changed state: Fixed