Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JBoss/WildFly and the fly likes Log4j logging file housekeeping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Log4j logging file housekeeping" Watch "Log4j logging file housekeeping" New topic

Log4j logging file housekeeping

Ravi Gupt

Joined: Oct 16, 2007
Posts: 17
Hi Guys,

I have a requirement that on each jboss server restart it should create a new myServer.log file and it should rename old file to myServer_DDMMYY_HHMMSS.log

for example: I have created a RollingFileAppender for myServer.log in jboss-log4j.xml, what changes should I do in this configuration so that it archives(renames) existing file and create a new myServer.log on each server re-start.

Peter Johnson

Joined: May 14, 2008
Posts: 5812

Add some code to the startup script to do this; there is no Log4J configuration option that will do this for you.

JBoss In Action
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Log4j logging file housekeeping
Similar Threads
Error starting up my jboss
Usage of the .sar file
server filesets in eclipse
Basic weblogic help
Jboss + Lomboz +Eclipse setup