[logback-user] LocLoggers and TurboFilters

ceki ceki at qos.ch
Tue Jun 12 14:05:58 CEST 2012


Dario,

Upgrading the slf4j-ext dependency to 1.6.6 should fix this issue.
-- 
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


More information about the Logback-user mailing list