• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1220
  • Last Modified:

JBoss Server Log File Rotation

Hi,

Currently, JBoss log4j configuration comes with two existing log rolling appender sections:

 
RollingFileAppender – Rotate server.log files based on specified file size criteria DailyRollingFileAppender – Rotate server.log file based on specified time/date (daily by default)
 
However, I am looking for configuration which can rotate the log files based on file size and append the date/time stamp to the backup file created.
I have the following configuration in log4j XML file - log files are successfully getting rolled over based on size and maximum index criteria, but the backup files are not time/date stamped, instead they are created as ‘sever.log.1, server.log.2  etc…’.
 
<!-- A size based file rolling appender -->
   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
     <param name="File" value="${jboss.server.log.dir}/server.log"/>
     <param name="Append" value="true"/>
     <param name="MaxFileSize" value="3000KB"/>
     <param name="MaxBackupIndex" value="3"/>
 
     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
     </layout>           

   </appender>

Open in new window


I am looking for appender configuration that will roll log files based on file size, but also append the time/date stamp to it.

Appreciate your inputs.

Regards,
Aravind G
0
aravindgopaluni
Asked:
aravindgopaluni
  • 3
1 Solution
 
ahoffmannCommented:
did you try adding:

<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
0
 
aravindgopaluniAuthor Commented:
Hi,

Thanks for your inputs, I will verify and confirm

Regards,
Aravind G
0
 
aravindgopaluniAuthor Commented:
Hi,

I have verified the configuration and it seems with date appender the backup files are created as 'serverlog.1' etc...
0
 
aravindgopaluniAuthor Commented:
I have verified the configuration and it seems with date appender the backup files are created as 'serverlog.1' etc...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now