I'd like to hear more pros and cons about this from other users. massimo
On Feb 1, 11:19 am, Jim Karsten <[email protected]> wrote: > On my development server, I log errors to syslog so they are > accessible from a single location. Web2py tickets present a problem > since they are not logged. I could configure syslog to access errors > from the ticket error file, but it contains more information than I > need and the text isn't in a suitable format. > > I added three lines to the RestrictedError class log() method in gluon/ > restricted.py. The traceback message of a ticket is then logged quite > nicely. > > def log(self, request): > ... > > ticket_storage = TicketStorage(db=request.tickets_db) > ticket_storage.store(request, f, d) > => for line in str(self.traceback).split("\n"): > => if len(line.strip()) > 1: > => logger.error(line.strip()) > return '%s/%s' % (a, f) > except: > logger.error(self.traceback) > return None > > Is there any interest in adding that to the source code? > > Also, when I first tested this, I copied the > logger.error(self.traceback) line from the except clause to log the > ticket message. It only logged the first line. The message logged is: > "Traceback (most recent call last):" which isn't much use. Possibly a > for loop similar to what I used above would improve that. > > Regards, > Jim Karsten

