Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cnfiguring accesslogvalve to rotate log every 2 hours

 
conrad Johnston
Greenhorn
Posts: 5
Android Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic