83981f86e707d9432c16723208f4c92fa3d5d753
hiram
  Wed Dec 13 11:36:13 2017 -0800
send hgCustom error messages to apache error log and commify the number of lines refs #20695

diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index 99b30cf..a93cb5e 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -210,32 +210,43 @@
 	}
     puts("</TD></TR></TABLE>\n");
     }
 
 /* intro text */
 puts("<P>");
 if (isUpdateForm)
     puts("Update your custom track configuration, data, and/or documentation.");
 else
     puts("Display your own data as custom annotation tracks in the browser.");
 addIntro();
 puts("<P>");
 
 /* row for error message */
 if (isNotEmpty(err))
+    {
     printf("<P><B>&nbsp;&nbsp;&nbsp;&nbsp;<span style='color:RED; font-style:italic;'>"
            "Error</span>&nbsp;%s</B><P>", err);
+    /* send two lines of the message to the apache error log also: */
+    char *tmpString = cloneString(err);
+    char *lineBreak = strchr(tmpString, '\n');
+    if (lineBreak)  /* first line break becomes a blank */
+        *lineBreak = ' ';
+    lineBreak = strchr(tmpString, '\n');
+    if (lineBreak)  /* second one becomes end of string */
+        *lineBreak = (char) 0;
+    fprintf(stderr, "hgCustom load error: %s\n", tmpString);
+    }
 
 cgiSimpleTableStart();
 
 /* first rows for update form are for track and browser line entry */
 if (isUpdateForm)
     {
     /* row for instructions */
     cgiSimpleTableRowStart();
     cgiSimpleTableFieldStart();
     if (dataUrl)
         puts("Configuration:");
     else
         {
         puts("Edit configuration:");
         }