What is the configuration in log4j.xml for rotating the logs based on time as well as size

Kindly let me know if there is a way to rotate the logfiles based on time as well as size.

The log file is required to be in a format logfilename.log.date when the roll over happens based on time.

Answers


If you want to do the rotation based on time DailyRollingFileAppender probably is the best practice. You can have yearly, monthly, hourly etc logs based on your configuration.

If you want size based rotation RollingFileAppender could be very useful.

Furthermore, if you want to use both time and size at the same time I would suggest you to take a look at TimeAndSizeRollingAppender, free under the Apache 2.0 license, which claims to be providing full features of both DailyRollingFileAppender and RollingFileAppender.


Take a look at DailyRollingFileAppender and RollingFileAppender.

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html


Need Your Help

Architecture to store layout data

jquery jquery-ui cakephp cakephp-2.0

I'm not looking for someone to write all the code, I'm looking mainly for more theoretical information.

How do I reorder rows in DataTable using drag drop?

jsf primefaces

I am using PrimeFaces and JSF. Can anyone tell me how do I reorder rows of a DataTable using Primefaces drag and drop component?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.