Appenders are generally added to the root logger. Here's some pseudocode
// get the root logger and remove the appender we want
Logger logger = Logger.getRootLogger();
Appender appender = logger.getAppender("foo");
logger.removeAppender(appender)
// when we want to add it back...
logger.addAppender(appender);
I'm pretty sure you can do this on other loggers than the root logger as well, though I've never tried that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…