I'm trying to set Logback appender path programmatically. (RollingFileAppender with FixedWindowRollingPolicy to be exact)
I'm doing this because I want to enable my users to set the log path in a preference dialog (Eclipse RCP)
I've tried something like this, but I doesn't change the log path from what's defined in the configuration file:
Logger logback_logger = (ch.qos.logback.classic.Logger)LoggerFactory
.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
RollingFileAppender<ILoggingEvent> rfappender =
(RollingFileAppender<ILoggingEvent>)logback_logger.getAppender("FILE");
rfappender.setFile(newFile);
FixedWindowRollingPolicy rollingPolicy =
(FixedWindowRollingPolicy)rfappender.getRollingPolicy();
rollingPolicy.setFileNamePattern(newPattern);