Hi I'm new to using log4j and would like to know if I can change the configuration of log4j while it is already running. I have passed my log4j.xml to the DOMConfigurator and then I would like to change some settings.
Here is my log4j.xml file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- ==========Appenders========== --> <!-- Define asyncAppender --> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> <filter class="com.apani.common.log.RepeatFilter"/> <appender-ref ref="STDOUT"/> <appender-ref ref="R"/> </appender> <!-- Define STDOUT to a console --> <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ISO8601} %-17X{ipAddress} [%t] [%p] - %m%n"/> </layout> </appender> <!-- Define R; Rolling file logger --> <appender name="R" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="logs/adminlog.txt"/> <param name="MaxFileSize" value="100KB"/> <param name="MaxBackupIndex" value="1"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ISO8601} %-17X{ipAddress} [%t] [%p] - %m%n"/> </layout> </appender> <logger name="sql"> <level value="off"/> </logger> <!-- ==========Setup the Root category========== --> <!-- rules for logging DEBUG<INFO<WARN<ERROR<FATAL. --> <root> <priority value = "error"/> <appender-ref ref="ASYNC"/> </root> </log4j:configuration> Now based on a user config file, I would like to change some of the config such as the MaxFileSize of the rolling file appender or the number of backup logs it keeps. I would also like to change the logging level of root or sql. Is it possible to to this? If so, how do I go about doing this? Thanks in advance -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6747745 Sent from the Log4j - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]