[Using Sakai] TIP for *nix users: keeping and time-stamping catalina.out logfiles

Matthew Jones jonespm at umich.edu
Mon Dec 21 11:14:08 PST 2009


FYI: In addition, for more long running instances, you may also be
interested in daily rotating logs. You can override (or supplement)
the default logging with a DailyRollingFileAppender.

http://jira.sakaiproject.org/browse/SAK-16426

This old post of mine from the mailing list is still applicable to 2.6.x
http://n2.nabble.com/Sakai-Demo-2-5-2-is-not-creating-logs-td723055.html#a723255

Thanks for the restart rotating shell tip.

-Matthew

On Mon, Dec 21, 2009 at 1:57 PM, will at serensoft.com <will at serensoft.com> wrote:
> Here's a trick we use at Serensoft to have one time-stamped catalina.out
> logfile per tomcat-launch on a *nix Sakai server:
>
> #!/bin/sh
> # Sakai log-rotating start-up wrapper from Serensoft.com
>
> TODAY=`date +%Y/%m/%d`;
> NOW=`date +%T`
> LOGDIR=rotate/$TODAY
> LOGFILE=catalina.out
> mkdir -p $CATALINA_HOME/logs/$LOGDIR
> # remove original (the 'other' hard link)
> /bin/rm -f $CATALINA_HOME/logs/$LOGFILE
> # create new logfile
> touch $CATALINA_HOME/logs/$LOGFILE
> # make a HARD link (the 'main' link, from our perspective)
> # to tomcat/logs/calendar/YYYY/MM/DD/HH:MM:SS.catalina.log
> (cd $CATALINA_HOME/logs; ln $LOGFILE $LOGDIR/$NOW.$LOGFILE)
> # now for the "real" startup script:
> $CATALINA_HOME/bin/startup.sh
> # Follow the startup logs:
> tail -f $CATALINA_HOME/logs/$LOGFILE
>
> And that's all there is to it.
>
> Each HH:MM:SS.catalina.log is actually the full, original logfile; the
> catalina.out instance that Sakai dumps to is one of two hard links to the
> same file -- and that's the instance that gets blown away on every restart,
> so that it points to the new logfile instance. (Here's the single caveat:
> you'll lose your first, original catalina.out if you don't back it up before
> deploying this script.)
> ~/tomcat/logs> ls -1 rotate/2009/12/03
> 08:41:22.catalina.log
> 10:02:02.catalina.log
> 19:25:37.catalina.log
>
> So here you can see that, for example, on December 3rd, we bounced this
> particular Sakai three times. Name of the file is the timestamp of start-up,
> of course. Very convenient for anthropology or forensics (or morbid
> curiosity)!
>
>
> _______________________________________________
> sakai-user mailing list
> sakai-user at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-user
>
> TO UNSUBSCRIBE: send email to sakai-user-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
>


More information about the sakai-user mailing list