• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Log4J DailyRollingFileAppender not rolling

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a Logging utility class which wraps the log4j API and allows simple logging. It programmatically sets a DailyRollingFileAppender, and it's always worked without a hitch for me.

Now, I'm integrating into an existing tomcat webapp. Using my class, the log files are not rolling, but just continue to build up in the same file. I have noticed a properties file in the WEB-INF directory called log.properties, which contains the usual Log4j configuration. This file specifies a RollingFileAppender set to roll at 10Mb. Is there a chance that my class, when run under tomcat, is picking up this config file by default?

If so, can I stop it doing that?
If not, what else could be causing my log files not to roll?

Many thanks for any help!
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gezza Hall:
If so, can I stop it doing that?


Why do not you configure the logging system using PropertyConfigurator Class and specify the configuration file.
 
Gezza Hall
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I probably 'could' but want to keep it simple in this case.

Besides, I don't think that the existing log.properties file is the problem here - for some reason my logs simply aren't rolling!
 
Sheriff
Posts: 28413
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gezza Hall:
Is there a chance that my class, when run under tomcat, is picking up this config file by default?

Seems to me there are several simple experiments you could do to find that out. Such as changing that config file and see if what you changed made a difference.
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some buddy once told me that the DailyRollingFileAppender will only roll if Log4j is active at midnight, so the server has to be running constantly. I never checked that, but you might test that as well by resetting your local computer time (if it's possible to test your application locally).
 
Gezza Hall
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah I've done the experiments, and it's not a conflict with the other files.

Strangely, the rolling logs work on my local machine, which is not active at midnight - but they don't work on our tomcat machine which is permanently running.
reply
    Bookmark Topic Watch Topic
  • New Topic