1

I thought I had found a solution of being able to change a custom appender's level value on the fly by utilizing the jsp tag referenced here;

http://nayidisha.com/techblog/mycontent/posts/nd-utils/site/loggerAdmin.html

Unfortunately, the link is broken so I am unable to download the utility. The article was from 2009 and appears to be an exact match for what I need. Anyone have any ideas on how to accomplish? Below is an example:

[log4j.xml] snippet

 <logger name="EXAMPLE_LOGGER" additivity="false"> <level value="DEBUG" /> <appender-ref ref="EXXAMPLE_LOG_APPENDER" /> </logger> 

I am looking for some way to modify the "level value" on the fly without restarting the managed server or polling the log4j.xml file. Thanks in advance for any insight.

1

1 Answer 1

1

There is WebLogic logging library, that can do that. You can implement LOG4J Logger that utilizes this library. We have done this in previous job. I think this is the library: http://docs.oracle.com/cd/E21764_01/web.1111/e13739/config_logs.htm#i1011558

import weblogic.logging.log4j.Log4jLoggingHelper; import weblogic.logging.LoggerNotAvailableException; public class MyLog4jTest { public void testWLSLog4j() { try { Logger logger = Log4jLoggingHelper.getLog4jServerLogger(); logger.addAppender(myAppender); // The Appender is configured using either the log4j props file or other custom mechanism. logger.info("Test log message"); } catch(LoggerNotAvailableException lex) { System.err.println("Unable to get a reference to the log4j Logger: "+ lex.getMessage()) } } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.