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