hello, all We are now using log4j.RollingFileAppender class to store logs at server side, and we have a batch program which gethers those log files running at AM 0:00 every day. The batch program can remove those backed-up log files (xxx.log.1 etc) , but it is failed to remove current log file , because the log file is still openning.
so we tried to open-write-close the current log file for each logging event, like this. ---------------------------------------------------------------------------- authFileNameTemp = outPath + "/" + authFileName + now.yyyymmdd() + ".log"; AuthLogger.removeAllAppenders(); PatternLayout layout = new PatternLayout(pLayout); RollingFileAppender authAppender = new RollingFileAppender(layout,authFileNameTemp); authAppender.setMaxFileSize(authMaxSize); authAppender.setMaxBackupIndex(Integer.parseInt(authMaxBackupIndex)); authAppenderTemp = authAppender; AuthLogger.addAppender(authAppender); AuthLogger.setLevel(Level.toLevel(authLevel)); AuthLogger.info(strAuthMsgs); ---------------------------------------------------------------------------- it seemed work, but we found another problem, the first backed-up log file(xxx.log.1) is missing after Rolling Action. so why this is happenning ? and is there any way to make current log file got deleted at any time ? regards --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
