0

I have an application using Spring, so I have spring.jar as a 3rd party library. I'm using log4j for logging and I've set the root level as INFO. Here is my log4j.properties:

log4j.rootCategory=INFO
log4j.logger.org.springframework.context.support.ResourceBundleThemeSource=WARN
log4j.logger.org.springframework.ui.context.support.ResourceBundleThemeSource=WARN
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%-5p - %m%n

As you can see, I've tried to set a specific class' (which is inside spring jar) logging level. However, it keeps logging as:

[1/7/14 11:53:35:150 EET] 0000003b ResourceBundl I org.springframework.ui.context.support.ResourceBundleThemeSource getTheme Theme created: name 'theme', basename [theme]

so it is creating unnecessary text data and exaggerating my log file.

As far as I can see, the log level is INFO inside ResourceBundleMessageSource class.

So, why it keeps logging even if I've set the level to WARN?

Thanks!

Ercument Kisa
  • 168
  • 1
  • 3
  • 12

1 Answers1

0

You have set the log level for the wrong class.

log4j.logger.org.springframework.context.support.ResourceBundleMessageSource=WARN

when it should be

log4j.logger.org.springframework.context.support.ResourceBundleThemeSource=WARN
Antti Kolehmainen
  • 1,071
  • 1
  • 11
  • 23
  • 1
    Sorry for the mistake. M.Deinum also told about it. I've fixed the class name but nothing changes. Still printing the same log over and over again. Thanks for the reply. – Ercument Kisa Jan 16 '14 at 22:23
  • @ErcumentKisa hello, have you find a solution ? i'm interested – Mercer Mar 16 '16 at 15:51
  • Hey @Mercer, your application server's classloader mode is causing this issue. It must be set as "PARENT_LAST" to make your configurations apply. Check this for how you can change it: [link](http://stackoverflow.com/questions/21421916/how-to-set-java-class-loader-parent-last) – Ercument Kisa Mar 18 '16 at 06:32