• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cnfiguring accesslogvalve to rotate log every 2 hours

 
Greenhorn
Posts: 5
Android Tomcat Server Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am setting up some web logging and need to be able to configure a non standard log rotation period.

I understand from the Apache foundations doc that adding fileDateFormat="yyyy-MM-dd.HH" will force the log to be rotated every hour.

but it doesn't really give you any more clues than that. Has anyone come across this before?

Cheers,

C.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Conrad!

I'm not sure exactly what you mean. What most people think of as Tomcat's main "log" file (catalina.out) isn't even a proper log. It's just the redirected stdout/stderr from the JVM that Tomcat is running in. And, incidentally, because it's not a true logfile, it's not recommended for webapps to write to stdout/stderr.

Are you referring to one of the other logs such as the localhost log or the log produced optionally when the request-tracking valve is enabled (access log)?
 
conrad Johnston
Greenhorn
Posts: 5
Android Tomcat Server Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

sorry, i was a little too vague!

I am configuring web referrer logging. The current configuration I have is as follows:


The Apache Foundations documentation for Tomcat state the following for the attribute fileDateFormat

"Allows a customized date format in the access log file name. The date format also decides how often the file is rotated. If you wish to rotate every hour, then set this value to: yyyy-MM-dd.HH"

This rotates that log every hour with the naming format as given in my config above, but i really need it to rotate every 2 hours.

My current work around is to post process the logs and concatenate two of them together. But it would be nicer if I could get Tomcat to do this step for me!

Cheers,

C.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, unless you edited your topic title, I was suffering from my usual early-morning blindness. At any rate, it says very specifically "Access Log Valve" now.

I can't think of any way to specify a pattern using their rules that would be good for every 2 or 3 or whatever hours. You can always check to see if there's a crontab-like pattern option attribute. Otherwise, your best bet is probably to yank a copy of the accesslog valve code and create a customized copy.
 
conrad Johnston
Greenhorn
Posts: 5
Android Tomcat Server Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
cheers tim,

I think i will go with my post processing option and concatenate the logs. I don't want to create version dependencies for those that follow.

Thanks very much for your assistence though.

C.
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic