In log4j, output INFO logs of classes only from your package.

Been awhile since I’ve been using log4j for most of my projects. I wanted to output INFO statements only from my package and block log statements from all other packages i was using. Using the following you will see only ERROR statements from other packages and INFO statements from your package.

#Give root logger ERROR level, so that we get only ERROR output from ‘other’ packages
log4j.rootLogger=ERROR, stdout

#Only appender is stdout

# Pattern to output the caller’s file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) – %m%n

#Give all loggers in my package INFO level, so that we see get all our messages