[infinispan-dev] cache name in logs

Olaf Bergner olaf.bergner at gmx.de
Fri Apr 29 11:26:08 EDT 2011


Am 29.04.11 16:55, schrieb Galder Zamarreño:
> On Apr 28, 2011, at 11:47 PM, Manik Surtani wrote:
>
>> We do now support JBoss Logging.
>>
>> https://issues.jboss.org/browse/ISPN-380
>>
>> @Galder, does JBoss Logging have support for what Mircea mentioned below?
> I've skimmed through the javadoc but didn't see anything in particular for this at least around the message loggers which are the ones that help with internationalization.
>
> I think it could be fitted but would require a fair amount of changes, such as making some static loggers, particularly those for named cache components non static in order to take the cache name. Maybe you could have a named cache component for a log factory?
A workaround that IMHO feels a little hackish though would be to simply 
append the current cache's name to the class name when instantiating a 
logger:

logger = LoggerFactory.getLogger(getClass().getName() + "[cache = " + 
cacheName + "]")

I wouldn't recommend this.
> The other potential can of worms here is when multiple cache managers are in action (i.e. managed environments) and you have multiple cache managers with same cache names. You could end up having to put cache manager as well and this could get too verbose. It could maybe be configurable somehow.
>
> David, any other ideas?
>
>> On 27 Apr 2011, at 13:21, Olaf Bergner wrote:
>>
>>> Silly me, forgot the link: http://logback.qos.ch/manual/mdc.html.
>>>
>>> Am 27.04.11 16:55, schrieb Mircea Markus:
>>>> Hi,
>>>>
>>>> I'm looking into some logs for the a JBW demo : it has 4 caches deployed on each node and lots of topology changes happen. It's close to impossible to tell  which log pertains to which cache, especially around the DistributionInterceptorImpl.
>>>> Wouldn't it make sense that, for certain components, to include the name of the cache in the logs? IThis might be achieved with minimal changes by adding an additional param to the LogFactory.getLog(Class) method and let the logger itself do the heavy lifting.
>>>> e.g.
>>>> Log l = LogFactory.getLog(DistributionManagerImpl.class, "cacheName");
>>>> and on each call l.trace("A message") the logger might output, besides underlying log's format, the string "[cacheName] A message".
>>>>
>>>> Wdyt?
>>>> Cheers,
>>>> Mircea
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> infinispan-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>> --
>> Manik Surtani
>> manik at jboss.org
>> twitter.com/maniksurtani
>>
>> Lead, Infinispan
>> http://www.infinispan.org
>>
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
> --
> Galder Zamarreño
> Sr. Software Engineer
> Infinispan, JBoss Cache
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>



More information about the infinispan-dev mailing list