Monday Apr 06, 2009

Fuji Milestone 4 has Logger configuration support. Runtime loggers and component loggers can be configured using Fuji admin CLI. Logger Configuration Support in Fuji leverages OSGi ConfigurationAdmin service.

Play with it !!

Download and setup FujiFelix distribution:

    (i)Download the M4 release from Fuji maven repository.
    (ii)Extract it in <FujiHome>
    (iii)cd <FujiHome>; java -jar bin/felix.jar

Listing Runtime Loggers:

    -> fuji list-loggers
    Fuji Runtime Loggers
    -----------------------------------
    com.sun.jbi = INFO
    com.sun.jbi.fuji = INFO
    com.sun.jbi.framework = INFO
    com.sun.jbi.messaging = INFO
    com.sun.jbi.interceptors = INFO
    com.sun.jbi.logging = INFO
    Command list-loggers executed successfully.

Listing Component Loggers:

    Now start a component, example, sun-file-binding
    -> start 20
    -> fuji list-loggers --component sun-file-binding
    Loggers For Component sun-file-binding
    -------------------------------------------------------------
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.OutboundMessageProcessor = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.InboundMessageProcessor = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.management.FileBCManagement = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.FileBindingDeployer = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.bootstrap.FileBindingBootstrap = INFO
    com.sun.jbi.sun-file-binding = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.FileBindingLifeCycle = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.bootstrap.InstallerExt = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.common.qos.messaging.MessagingChannel = INFO
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.RuntimeConfiguration = INFO
    Command list-loggers executed successfully.

Configuring a Runtime Logger:

    -> fuji set-logger com.sun.jbi.messaging=FINEST
    Command set-logger executed successfully.
    -> fuji list-loggers
    Fuji Runtime Loggers
    ----------------------------------
    com.sun.jbi = INFO
    com.sun.jbi.fuji = INFO
    com.sun.jbi.framework = INFO
    com.sun.jbi.messaging = FINEST
    com.sun.jbi.interceptors = INFO
    com.sun.jbi.logging = INFO
    Command list-loggers executed successfully.

Configuring a Component Logger:

    -> fuji set-logger --component sun-file-binding com.sun.jbi.sun-file-binding=FINE
    Command set-logger executed successfully.
    -> fuji list-loggers --component sun-file-binding
    Loggers For Component sun-file-binding
    --------------------------------------
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.OutboundMessageProcessor = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.InboundMessageProcessor = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.management.FileBCManagement = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.FileBindingDeployer = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.bootstrap.FileBindingBootstrap = FINE
    com.sun.jbi.sun-file-binding = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.FileBindingLifeCycle = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.bootstrap.InstallerExt = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.common.qos.messaging.MessagingChannel = FINE
    com.sun.jbi.sun-file-binding.com.sun.jbi.filebc.RuntimeConfiguration = FINE
    Command list-loggers executed successfully.

Component Root logger:

When a JBI component is installed, the framework creates a component root logger with the name "com.sun.jbi.<component-name>". By configuring this component root logger, all other component logger could be configured.

System root logger:

When Fuji framework starts up, it creates a system a root logger with the name "com.sun.jbi". This is the parent logger for all other runtime loggers and component loggers. By changing this logger's level, all other Fuji loggers (that were created with the default level - inherits from parent) can be configured automatically.

More to come:

    (i)Logger configuration support from Netbeans - issue 1599
    (ii)Logger configuration support in Equinox - issue 1600
    (iii)Interceptor logger configuration - issue 1487

Thursday Nov 20, 2008

1. Framework Startlevel

The documentation says
org.osgi.framework.startlevel - The initial start level of the framework once it starts execution; the default value is 1.

This means, if you have a bundle installed at a start level that is higher than the framework start level, you won't be able to start it.
Want an example?

felix.auto.install.2= \
     file:bundle/test-bundle.jar

org.osgi.framework.startlevel=1

Now, if you do
"start   <test-bundle-id>"

it is a no-op. After checking your bundle activator again and again, you googled your way here and now you know what happened.

2. Install/Startup ordering

If you have bundles in different levels, like this

felix.auto.start.1= \
     file:bundle/bundle-1.jar
     file:bundle/bundle-2.jar

felix.auto.install.2=\
     file:bundle/bundle-3.jar

and you are betting on the fact that bundle-2 will be stared before bundle-3 is installed, you are in trouble.
Because you see, all bundles are installed first and then bundles in different levels are started up in order.