GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes Log4j: How app.log and app.log.1 are written at same time? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j: How app.log and app.log.1 are written at same time?" Watch "Log4j: How app.log and app.log.1 are written at same time?" New topic
Author

Log4j: How app.log and app.log.1 are written at same time?

Samyuktha S Kumar
Greenhorn

Joined: Nov 07, 2012
Posts: 2
Hi,

I have a web app running on tomcat. I have rolling file appender. I have configured log4j to write logs into say app.log
But I find that at a time app.log and app.log.1 are written at the same time.
I dont understand how this can be possible.
Please help
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

the file "app.log" is the current log, others are rolled files.


PM Me If You Want to get Urgent Help on Java Programming
Samyuktha S Kumar
Greenhorn

Joined: Nov 07, 2012
Posts: 2
Then only app.log should be updated at current point of time. If the file exceeds the max limit size then it rolls over to the next file
But in this case both app.log and app.log.1. are updated at same time. They have logs with the same timestamp inside it

Is it like more than one process is writing log?

Our app is running on a cluster.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Yes, if you have more than one process writing to a file at the same time, strange things can happen.
 
GeeCON Prague 2014
 
subject: Log4j: How app.log and app.log.1 are written at same time?