Custom Logger [message #1221752] |
Wed, 18 December 2013 06:08  |
Eclipse User |
|
|
|
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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03993 seconds