0

I have a django app on Webfaction, and it seems that logs it is sending do not get written in the log file.

I have the following code:

    log.debug('batch, guid: %s' % request.POST['guid'])
    events = request.POST.getlist('logbatch[]')
    for event in events:
        a = event.split(';')
        userlog = UserLog(csq_id=CsqId.objects.get(guid=request.POST['guid']), elementId=a[1], event=a[0], counter=int(a[2]), clientTime=js_time_to_python(int(a[3])))
        userlog.save()

In general, logging works and is configured correctly. However, when I look in the database, I can see UserLog objects that are not logged in. As the DB insertion happens after the logging, I am certain that django did log the code. So why is it not in the log file?

Ran Moshe
  • 350
  • 1
  • 12

1 Answers1

0

Read the Django documentation on logging. You need to configure logging in your settings.py first, before you start using it. There is also an example configuration provided in the documentation.

Ludwik Trammer
  • 24,602
  • 6
  • 66
  • 90
  • Ludwik, thanks for your answer. Logging does generally works in my app - but for this logic, some logs are missing, even though I can see the logic is working. – Ran Moshe Sep 23 '13 at 04:31