Hi Dario,

There is a bug in org.slf4j.ext.LoggerWrapper which LogLogger
extends. The methods taking a Marker as first argument, invoke
isInfoEnabled() instead of inInfoEnabled(marker). For example, the
code currently reads:

  public void info(Marker marker, String msg) {
   if (!logger.isInfoEnabled())
      return;
    if (instanceofLAL) {
      ((LocationAwareLogger) logger).log(marker, fqcn,
          LocationAwareLogger.INFO_INT, msg, null, null);
    } else {
      logger.info(marker, msg);
    }
  }

instead of

  public void info(Marker marker, String msg) {
   if (!logger.isInfoEnabled(marker))
      return;
    if (instanceofLAL) {
      ((LocationAwareLogger) logger).log(marker, fqcn,
          LocationAwareLogger.INFO_INT, msg, null, null);
    } else {
      logger.info(marker, msg);
    }
  }

The Please file bug report so that this issue can be tracked. You can
file the bug report in logback or slf4j (the bug is actually in
slf4j-ext).

Sorry for the inconvenience,
--
Ceki
http://twitter.com/#!/ceki

On 10.06.2012 11:21, Dario Campagna wrote:
Hi Ceki,

Could you provide a code sample of how you invoke a LocLogger with a marker?

Sure! The following class shows how I use a LocLogger to generate a logging 
request with a marker.

public class LocLoggerTest {

        public static void main(String[] args) {

                IMessageConveyor mc = new MessageConveyor(Locale.getDefault());
                
                LocLoggerFactory llFactory_default = new LocLoggerFactory(mc);
                
                LocLogger locLogger = 
llFactory_default.getLocLogger("defaultLocLogger");
                
                Marker alwaysMarker = MarkerFactory.getMarker("ALWAYS");
                
                locLogger.info(alwaysMarker,"This will always appear.");
                
                locLogger.info("Hello!");
                
        }

}

A simple configuration file to test it is

<configuration debug="true">

        <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                <encoder>
                        <pattern>%level - %date - %marker - %msg%n</pattern>
                </encoder>
        </appender>
        
        <turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
                <Marker>ALWAYS</Marker>
                <OnMatch>ACCEPT</OnMatch>
                <OnMismatch>NEUTRAL</OnMismatch>
        </turboFilter>
        
        <logger name="defaultLocLogger" level="INFO">
                <appender-ref ref="STDOUT" />
        </logger>

</configuration>

When I change the logger level to a value grater than INFO, the logging request 
marked ALWAYS is not enabled.


Cheers,
Dario

_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to