The moose likes Struts and the fly likes null value in log4j level Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "null value in log4j level" Watch "null value in log4j level" New topic
Author

null value in log4j level

andy garcia
Greenhorn

Joined: Oct 28, 2008
Posts: 4
Hi. I have a problem with log4j with Struts. I have a variable in the log4j.properties that sets the log level, like this:

if (GlobalProperties.get("log_level").equals("ALL")){
logger.setLevel(Level.ALL);
}else if (GlobalProperties.get("log_level").equals("OFF")){
logger.setLevel(Level.OFF);
}
When the Action gets running it works fine. The problem is when I call a method in a different class, the logger level retrieves a null value. Neither the logger.getLevel() nor the logger.getEffectiveLogger() nor the getRoot(). What am I doing wrong? Thanks very much in advance!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

I may have been a bit premature in sending this here, but I suspect this is better served in the Struts forum, I'm sure the resident bartender(s) will throw it back if I'm wrong


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: null value in log4j level
 
Similar Threads
Reconfigure SLF4J during runtime
Help! I am getting strange and unusual Eclipse Warnings
remove log4j appender from an API
Server loggng with log4j Tomcat 6.x
Properly shutting off logging