Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: ceki <ceki-vdLmLxQ6Fys <at> public.gmane.org>
Subject: Re: LocLoggers and TurboFilters
Newsgroups: gmane.comp.java.logback.user
Date: Sunday 10th June 2012 19:50:21 UTC (over 5 years ago)
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
>
> 
>
> 	
> 		
> 			%level - %date - %marker - %msg%n
> 		
> 	
> 	
> 	
> 		ALWAYS
> 		ACCEPT
> 		NEUTRAL
> 	
> 	
> 	
> 		
> 	
>
> 
>
> When I change the logger level to a value grater than INFO, the logging
request marked ALWAYS is not enabled.
>
>
> Cheers,
> Dario
 
CD: 3ms