Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Custom Logger(org.eclipse.scout.commons.logger.CustomLogManager not found.)
Custom Logger [message #1221752] Wed, 18 December 2013 11:08 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Hi,

I try to get the ScoutLogger redirected to Slf4j.

I have seen the Logging wiki page. I think my solution could be to use a Custom Logger. Here is what I have done so far:
* I have commented the entries in my config ini, corresponding to the "Eclipse Log Framework" approach.
* I have added a new Class:
org.eclipse.scout.commons.logger.CustomLogManager located in <my app>.shared/src/org/eclipse/scout/commons/logger/CustomLogManager.java

package org.eclipse.scout.commons.logger;

//..

public class CustomLogManager implements IScoutLogManager {

    //..

    @Override
    public IScoutLogger getLogger(String name) {
        //here I want to return a LogWrapper extending AbstractScoutLogger and using SLF4j.
    }

    //..
}


The approach is similar to this how to: Create a CustomLogManager for log4j, but using SLF4j instead of Log4j.


The problem is that my CustomLogManager seems to be ignored. When I debug:
org.eclipse.scout.commons.logger.ScoutLogManager#createScoutLogManager()
    // no logging strategy set. Try to find class 'org.eclipse.scout.commons.logger.CustomLogManager' for custom logging
    if (Activator.getDefault() != null) {
      try {
        Class clazz = Activator.getDefault().getBundle().loadClass("org.eclipse.scout.commons.logger.CustomLogManager");
        if (clazz != null && IScoutLogManager.class.isAssignableFrom(clazz)) {
          return (IScoutLogManager) clazz.newInstance();
        }
      }
      catch (ClassNotFoundException e) {
        // nop (custom logger is not installed)
      }
      catch (Exception e) {
        // error cannot be logged by log manager as not installed yet
        e.printStackTrace();
      }
    }


When the class is loaded, it is not found. I go through the ClassNotFoundException catch block.

What do I need to do?

I have tried to add org.eclipse.scout.commons.logger in the Export-Package in
<my app>.shared/META-INF/MANIFEST.MF. No success so far.

Thanks in advance for your help.
Re: Custom Logger [message #1221756 is a reply to message #1221752] Wed, 18 December 2013 11:14 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
Hi

Your CustomLogManager Class must be in a Fragment to org.eclipse.scout.commons.

See https://wiki.eclipse.org/Scout/HowTo/Create_a_CustomLogManager_for_log4j#Creating_the_new_fragment.

Greetings
Stephan
Re: Custom Logger [message #1221772 is a reply to message #1221756] Wed, 18 December 2013 11:58 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Sorry, I missed that part... It is written on both wiki pages.

Thank you.
Previous Topic:AbstractDoubleColumn: rounding decimal values
Next Topic:How to change theme on RAP client
Goto Forum:
  


Current Time: Tue Mar 19 03:44:39 GMT 2024

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

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

Back to the top