2016/02/07 - Apache Onami has been retired.

For more information, please explore the Attic.

Extend Apache Onami Logging

Exigent users that have the need to integrate not already supported logging framework, can easily do it by following the listed steps:

  1. add the core dependency in the pom.xml:
  2. Extend the or.apache.onami.logging.core.AbstractLoggerInjector, that's the class responsibile of creating and injecting the desired Logger, specifying the Logger type:
    import java.lang.reflect.Field;
    import com.acme.MyLogger;
    import com.acme.MyLoggerFactory;
    import org.apache.onami.logging.core.AbstractLoggerInjector;
    public final class AcmeLoggerInjector
        extends AbstractLoggerInjector<MyLogger>
        public AcmeLoggerInjector( Field field )
            super( field );
        protected MyLogger createLogger( Class<?> klass )
            return MyLoggerFactory.getLog( klass );
  3. Extend the org.apache.onami.logging.core.AbstractLoggingModule, specifying the Logger type and the org.apache.onami.logging.core.AbstractLoggerInjector type:
    import com.acme.MyLogger;
    import org.apache.onami.logging.core.AbstractLoggingModule;
    import com.google.inject.TypeLiteral;
    import com.google.inject.matcher.Matcher;
    public final class AcmeLoggingModule
        extends AbstractLoggingModule<MyLogger>
        public ACLLoggingModule( Matcher<? super TypeLiteral<?>> matcher )
            super(matcher, AcmeLoggerInjector.class);
  4. Plug your new logging module and enjoy ;)