import java.io.IOException; import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; /** * Test for adding appender to log4j at runtime. * @author SGSCLGLD * */ public class LogingTest { static Logger log = Logger.getLogger(LogingTest.class); public static void main(String[] args) throws IOException { // setting up a FileAppender at runtime. PatternLayout patternLayout = new PatternLayout(); patternLayout.setConversionPattern("[%d{d/M/yyyy HH:mm:ss}] %p [%t] %c{1}.%M(%L) | %m%n"); FileAppender appender = new FileAppender(patternLayout,"D:\\ME\\WS_Share\\test1\\log.txt",false); log.addAppender(appender); log.info("Hello world..."); } }
Java RSA Key Generation/Encryption/Decryption RSA秘钥生成/加密/解密 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.