b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

log4j appender自定义_log4j routingappender_fileappender log4j(25)

电脑杂谈  发布时间:2017-01-30 04:04:43  来源:网络整理

1 protected long maxFileSize = 10 * 1024 * 1024;

2 protected int maxBackupIndex = 1;

3 private long nextRollover = 0;

4

5 public void rollOver() {

6File target;

7File file;

8if (qw != null) {

9long size = ((CountingQuietWriter) qw).getCount();

10LogLog.debug("rolling over count=" + size);

11// if operation fails, do not roll again until

12// maxFileSize more bytes are written

13nextRollover = size + maxFileSize;

14}

15LogLog.debug("maxBackupIndex=" + maxBackupIndex);

16

17boolean renameSucceeded = true;

18// If maxBackups <= 0, then there is no file renaming to be done.

19if (maxBackupIndex > 0) {

20// Delete the oldest file, to keep Windows happy.

21file = new File(fileName + &#39;.&#39; + maxBackupIndex);

22if (file.exists())

23renameSucceeded = file.delete();

24

25// Map {(maxBackupIndex - 1), , 2, 1} to {maxBackupIndex, , 3,

26// 2}

27for (int i = maxBackupIndex - 1; i >= 1 && renameSucceeded; i--) {

28file = new File(fileName + "." + i);

29if (file.exists()) {

30target = new File(fileName + &#39;.&#39; + (i + 1));

31LogLog.debug("Renaming file " + file + " to " + target);

32renameSucceeded = file.renameTo(target);

33}

34}

35

36if (renameSucceeded) {

37// Rename fileName to fileName.1

38target = new File(fileName + "." + 1);

39this.closeFile(); // keep windows happy.

40file = new File(fileName);

41LogLog.debug("Renaming file " + file + " to " + target);

42renameSucceeded = file.renameTo(target);

43//

44// if file rename failed, reopen file with append = true


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29497-25.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...