1) Change RollingFileAppender to DailyRollingFileAppender
Search for
log4j.RollingFileAppender
Replace with
log4j.DailyRollingFileAppender
2) To comment out the MaxFileSize line:
Search for
log4j\.appender\.[a-zA-Z]+\.MaxFileSize
Replace with
#$&
This works because $& matches the entire expression matched.
(Commenting out instead of deleting in case you want to go back to Rolling.)
3) To comment out the MaxBackupIndex line:
Search for
log4j\.appender\.[a-zA-Z]+\.MaxBackupIndex
Replace with
#$&
4) To insert the DatePattern='.'yyyy-MM-dd line just before existing log4j.appender.SOMETHING.layout= line:
Search for
(log4j\.appender\.[a-zA-Z]+\.)layout=
Replace with
${1}DatePattern='.'yyyy-MM-dd\n$&
This works because:
The parentheses marking from "log4j" to just before "layout" marks out the part returned by ${1}
Then the "\n" adds a newline
Then the $& restores the beginning of the layout= line.
-->
Mostly Linux & Python syntax notes and hyperlinks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment