[slf4j-user] Automated checker for SLF4J

Rishi Madan rishimadan.rm at gmail.com
Tue Mar 5 14:23:30 CET 2013


Hello All ,

I am using SLF4J with logback , with WebSphere Application Server . But I
am getting duplicate messages related to WAS.like this

[2/7/13 23:44:21:054 IST] 0000001b AdminHelper   A   ADMN1010I: An attempt
is made to stop the SamplesGallery application. (User ID =
defaultWIMFileBasedRealm/wasadmin)
[2/7/13 23:44:21:060 IST] 0000001b SystemOut     O 15958 [Default : 2]
WARN com.ibm.ws.management.AdminHelper  - ADMN1010I -

First line is printed using WAS loggers , and is correct.
But Second line is duplicate of first and is printed by SLF4J and is not
correct..

Can I prevent slf4j , not to print WAS related messages / or redirect it to
some other log file.
My log4j.properties is

log4j.appender.consoleAppender = org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout = org.apache.log4j.PatternLayout

#note the %X{userName} - this is how you fetch data from Mapped Diagnostic
Context (MDC)
log4j.appender.consoleAppender.layout.ConversionPattern = %-4r [%t] %5p %c
%x - %m - %X{userName}%n

log4j.rootLogger = DEBUG, consoleAppender

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=c:/slf4j.log
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%t %-5p %c{2} - %m%n
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n


Thanks
Rishi Madan

On Sat, Feb 23, 2013 at 8:15 AM, Kengo TODA <skypencil at gmail.com> wrote:

> Hello all,
>
> I redesigned this ruleset, and now it can work as a FindBugs plugin
> (target to parse is changed from Java source to .class file).
> So it can count placeholders correctly.
>
> https://github.com/eller86/findbugs-slf4j
>
> Check it if it is interesting for you. Thanks!
>
>
> On Sun, Aug 19, 2012 at 10:06 PM, Kengo TODA <skypencil at gmail.com> wrote:
> > Thanks, I misunderstood.
> > I changed that XML so it will be included from next version (0.4).
> >
> > On Sun, Aug 19, 2012 at 4:17 PM, niels <opensource21 at gmail.com> wrote:
> >> That's sounds great to me, specially
> >>
> https://github.com/eller86/ruleset-for-SLF4J#number-of-placeholder-should-be-equal-to-number-of-argument
> .
> >> How ever if I understand the FAQ
> >> http://www.slf4j.org/faq.html#declared_static right there is no
> >> recommendation any more. But I guess it's easy to change the check by
> >> the configuration.
> >>
> >> Niels
> >>
> >> 2012/8/10 Kengo TODA <skypencil at gmail.com>:
> >>> Hello all SLF4J users.
> >>>
> >>> I have created a simple PMD ruleset for SLF4J. It helps to unify
> coding style
> >>> and fix bug.
> >>>
> >>>     - https://github.com/eller86/ruleset-for-SLF4J
> >>>
> >>> I created it for myself, but I guess it would be helpful for some of
> you.
> >>> I'm happy if it works well for you.
> >>>
> >>>
> >>> Thanks.
> >>>
> >>>
> >>> On Wed, Feb 1, 2012 at 11:50 PM, Kengo TODA <skypencil at gmail.com>
> wrote:
> >>>> Hello.
> >>>>
> >>>> I'm finding automated checker for SLF4J like PMD ruleset or Findbugs
> plugin.
> >>>> Because I want to pick up bad codes like:
> >>>>   - giving wrong class to LoggerFactory#getLogger(Class) (maybe
> >>>> copy-pasted from other class)
> >>>>   - using static variable instead of instance variable to store Logger
> >>>>   - calling LoggerFactory#getLogger in method
> >>>>
> >>>> I've googled but cannot find it.
> >>>> Is there already developed one? Or, I have to develop it by own?
> >>>>
> >>>>
> >>>> Thank you for your time.
> >>>> Kengo TODA
> >>>>
> >>>> --
> >>>> ***
> >>>> Kengo TODA (eller86)
> >>>> skypencil at gmail.com
> >>>> http://skypencil.jp/
> >>>
> >>>
> >>>
> >>> --
> >>> ***
> >>> Kengo TODA (eller86)
> >>> skypencil at gmail.com
> >>> http://skypencil.jp/
> >>> _______________________________________________
> >>> slf4j-user mailing list
> >>> slf4j-user at qos.ch
> >>> http://mailman.qos.ch/mailman/listinfo/slf4j-user
> >> _______________________________________________
> >> slf4j-user mailing list
> >> slf4j-user at qos.ch
> >> http://mailman.qos.ch/mailman/listinfo/slf4j-user
> >
> >
> >
> > --
> > ***
> > Kengo TODA (eller86)
> > skypencil at gmail.com
> > http://skypencil.jp/
>
>
>
> --
> ***
> Kengo TODA (eller86)
> skypencil at gmail.com
> http://skypencil.jp/
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20130305/2ed29ebf/attachment.html>


More information about the slf4j-user mailing list