I am using log4j to log error and other system information. but come of the info logged twice at INFO level.
public static void main(final String... args) throws
This is another option if you don't like to use the "additivity" feature.
In my case (and mostly your case too) the root logger is behind this additional log and you have another higher logger in your configurations, something like this
This will result in duplicated logs, and if you removed the root logger at all from this configuration file, log4j
will force it's default root logger, check this note
Log4j will provide a default configuration if it cannot locate a configuration file. The default configuration, provided in the DefaultConfiguration class, will set up:
A ConsoleAppender attached to the root logger.
A PatternLayout set to the pattern "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" attached to the ConsoleAppender
Note that by default Log4j assigns the root logger to Level.ERROR.
If you want to override the default root logger and force it to not log you can remove it's Appender from your configuration file, like this
This is just another option, however, I like to use the recommended method and set the "additivity" attribute to the child logger