How does Log4j2 DefaultRolloverStrategy’s max attribute really work?

The DefaultRolloverStrategy will use the date pattern specified in the filePattern if a TimeBasedTriggeringPolicy is specified. To use the max attribute, specify a %i pattern in the filePattern, and add <SizeBasedTriggeringPolicy size=”20 MB” /> to the rollover policies. (Or some other size of course.) The value for max in <DefaultRolloverStrategy max=”5″/> will then ensure that … Read more

Log4Net: Rolling File appender, define extension

The other answers escape the “g” in “log” since “g” is a special character in datePattern. This isn’t wrong, but I prefer to wrap the entire set of non-date characters in single quotes, like so: <datePattern value=”yyyy-MM-dd’.log'” /> This gives the same results, but is easier for me to manage. This way, I don’t have … Read more

Intermittent log4net RollingFileAppender locked file issue

Try adding <lockingModel type=”log4net.Appender.FileAppender+MinimalLock” /> to your <appender /> element. There is some performance impact because this means that log4net will lock the file, write to it, and unlock it for each write operation (as opposed to the default behavior, which acquires and holds onto the lock for a long time). One implication of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)