Index: rawlog.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/rawlog/rawlog.module,v
retrieving revision 1.3.2.19
diff -u -r1.3.2.19 rawlog.module
--- rawlog.module	28 Nov 2010 18:28:13 -0000	1.3.2.19
+++ rawlog.module	3 Jan 2011 12:59:44 -0000
@@ -51,7 +51,7 @@
  */
 function rawlog_create_logfile($filename = '', $type = '', $update_filename = TRUE) {
   $logfile = rawlog_update_filename($filename, $type);
-  if (!($fp = fopen($logfile, "w"))) {
+  if (!($fp = _rawlog_fopen($logfile, "w"))) {
     drupal_set_message(t('Rawlog: Failed to create log file @file.', array('@file' => $logfile)));
   }
   else {
@@ -322,3 +322,14 @@
     }
   }
 }
+
+function _rawlog_fopen($path, $mode, $chmod = 0755){ 
+  $directory = str_replace(basename($path), '', $path);
+  $file = basename($path);
+  if (!is_dir($directory)) {
+    if (!mkdir($directory, $chmod, 1)) {
+      return FALSE;
+    }
+  }
+ return fopen($path, $mode);
+}
