[logback-user] How to ensure initialization (StaticLoggerBinder.init())?

Daniel Guggi daniel.guggi at gmail.com
Mon Oct 3 10:34:56 CEST 2011

hi guys,

I try to configure logback for our application in glassfish (3.1) as

[*] I start gf with -Dlogback.configurationFile=/path/to/file

[*] logback.xml is:
  <insertFromJNDI env-entry-name="java:app/AppName" as="appName" />
  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
      <pattern>%date %-5p [%thread] [%contextName] [%logger{20}]
  <root level="debug">
    <appender-ref ref="FILE" />
So far everything works fine. However I encountered a problem in the
following situation.

[*] A simple message driven bean, which is invoked if there are new messages
in a given "jms-queue" like this:*
@MessageDriven( mappedName="myQueue", activationConfig =  {
    @ActivationConfigProperty(propertyName = "acknowledgeMode",
                              propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "destinationType",
                              propertyValue = "javax.jms.Queue")
public class MyMdb implements MessageListener {

    private static Logger logger = LoggerFactory.getLogger(MyMdb.class);

    public void onMessage(Message msg) {
        logger.info("got message...");

[*] Glassfish is not running, AND there ARE messages in the queue
[*] Now when I start glassfish the application (MyMdb) start receiving the
messages from the queue
[*] At this point logback is not yet initialized, as I see the following
messages in my logfile:

*The following loggers will not work becasue they were created during the
default configuration phase of the underlying logging system.  See also

Any ideas how to solve this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20111003/06146299/attachment.html>

More information about the Logback-user mailing list