Forum OpenACS Q&A: servername-error.log

Posted by arief zj on
I've a problem here...I can't view the errors log when it is too big 
(107MB) VI only displayed few of it. my machine (where i work) there are several error.log 
where one of them is the current one(the 107MB) and the others are 
the previous error log for certain period. I donno whom to 
ask..except here :(

1)How can the NEW error.log be 
or automatically by the AOLserver?


Hope u guys understand my words..
Posted by Arjun Sanyal on
You can roll the error log manually by calling the ns_logroll command
in a .tcl file, or automatically using a script such as which rolls the log every day at the given time.

Follow the directions in the file and feel free to post here if you have
any questions.

Posted by MaineBob OConnor on

Try using the less command. It works on any sized file as a viewer. It allows you to move around: use "Esc->" to go to the end of the file and work your way backwards. type "h" for help on other commands including text search.

less server.log

You can manually archive and create a new server log by following these steps:

  • Stop aolserver
  • gzip the server.log
  • touch server.log to create a new blank log
  • chown theuser.thegroup server.log to be sure owner and group is correct if you were logged in as root. You can check owner/group with the usual "ls -l" directory command.
  • restart aolserver.


Posted by Andrew Piskorski on
Oh, ns_logroll, how useful! Thanks Arjun, somehow I never knew about that. Duh. FYI, AOLserver will also roll the server log if you send it a SIGHUP, so my (probably inferior) solution was to write a little Bourne shell script to send a a SIGHUP, and schedule it from crontab.

E.g., the crontab entries:

# Roll the AOLserver error log once a week, 12 am every Saturday:
0 0 * * 6 /web/acs-util/ mysite-dev
0 0 * * 6 /web/acs-util/ mysite

And the shell script itself - (I think I regsub'd the one backslash properly for BBoard - we'll see):

# $Header: /home/cvsroot/acs-util/,v 1.1 2002/01/03 17:30:04 andy Exp $
# Rolls the AOLserver error log by sending a SIGHUP to the AOLserver
# process.  Intended to be run from crontab on an e.g. nightly or
# weekly basis.
# by Andrew Piskorski <>, 2002/01/03

# TODO: Hard-coding the AOLserver home directory here is not so good.
# Come up with a better, more centralized way:


CMDNAME=`basename $0`

# First parameter passed to this script MUST be the AOLserver server
# name, e.g. "parnassus-dev":


Where:  AOLSERVER_SERVER_NAME is e.g. 'parnassus-dev'. "

if [ "$server_name" = "" ]
  echo ; echo "$USAGE" ; echo


if [ ! -r "$nspid_file" ]
  echo "ERROR:  The AOLserver nspid file '$nspid_file' is not readable!" 1>&2

nsd_pid=`cat $nspid_file`

if [ ! "$nsd_pid" -gt 0 ]
  echo "ERROR:  '$nsd_pid' is not a valid AOLserver PID!" 1>&2

# Note: For some reason, the 'kill -s HUP $pid" syntax for kill
# doesn't work, so use the numeric form instead (SIGHUP is signal 1):

kill -1 $nsd_pid

if [ ! $cmd_exit_status -eq 0 ]
  echo "ERROR:  Command 'kill -s HUP $nsd_pid' failed with error code '$cmd_exit_status'." 1>&2
Posted by Andrew Piskorski on
And I concur with Bob - less is very useful for reading server logs.
E.g., 'G' will take you to the end of the file and read in any new
lines that have been appended - usually much more convenient than 'M-x
revert-buffer' in Emacs, not to mention much less RAM intensive for
large files.
Posted by Patrick Giagnocavo on
With a 107MB log file, less will still take a very long time to load, and while it may fit into RAM, it will still kill performance of other processes on the box while you are using it.

First, stop the server, move the logfile to a different filename, then restart the server.  This will cause new log entries to go to a newly created error.log, and allow you to work on the other file without doing something that might make AOLserver get confused.

I would suggest that you use the "split" command to split the error.log file into more manageable chunks.  Then you can use less, vi, emacs, or whatever you prefer to look at the chunks.  The split man page will have more information for you on how to use it.

If this doesn't work for you, then the answer is to use a combination of "tail -f error.log" to see any new entries that are added, tail -n to display a certain number of lines at the end of the file, and grep.

Posted by arief zj on
Thanks to Arjun, now I know the existence of ns_logroll :D... 
and it works..I haven't try the script yet..but thanx a lot.
My thanx also goes to Bob,Andrew,Patrick.

I actually dont like to look those errors thru Vi,emacs nor less...
instead, I used a script which I can observe those errors thru browser 
(which is much easier to me rather than invoking those tools).

The problem was, whenever the file is TOOOO BIGGO, the scripts failed :( . 
Thats why I need to know how to roll the log ...
thanx anyway
Posted by Jonathan Ellis on
I always have tail -f running on the error log in one of my emacs buffers; just clear it out with normal emacs commands when it gets too big. :)