From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felix Dietrich Newsgroups: gmane.emacs.help Subject: Re: Apache2 error messages Date: Mon, 03 Oct 2022 17:33:28 +0200 Message-ID: <871qro6hx3.fsf@sperrhaken.name> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33530"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Cc: Help GNU Emacs To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 03 17:35:39 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofNTn-0008Xe-2T for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 03 Oct 2022 17:35:39 +0200 Original-Received: from localhost ([::1]:55348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofNTl-0003zb-Uq for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 03 Oct 2022 11:35:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofNSS-0003yD-G3 for help-gnu-emacs@gnu.org; Mon, 03 Oct 2022 11:34:16 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.131]:55273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofNSQ-0001wF-Ia for help-gnu-emacs@gnu.org; Mon, 03 Oct 2022 11:34:16 -0400 Original-Received: from localhost ([77.11.116.140]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MBDSg-1oUyfH0ysg-00Ck3q; Mon, 03 Oct 2022 17:33:37 +0200 In-Reply-To: (Jean Louis's message of "Wed, 28 Sep 2022 16:36:31 +0300") X-Provags-ID: V03:K1:2/ptVDEFnEQlOxfiX2Kv7gVkIW8iLxoFdV7ktxfMxVezbdUnZFJ pNKyVc/wyNXHoeag6Pm/ObC2hkK702MQLWc9FkBi50fxNB2DcPrhtOjx1oJs+uYmNOKiGe2 N2NE5+WYsbIHjaW9KUDsInF7WJ+k2txT/7WczxI7RJy0qrEs0linatbMo+W5DOzAaOZrFmz SMvC8zaAjsJ35aRZZzgfw== X-UI-Out-Filterresults: notjunk:1;V03:K0:/MXOGf8XumI=:imwXO2sxWtO8Psm+j/JNKJ JO88MbaEXifaW+7xoeFd+UqxlNarc6ZPU7hJaURNGFTWD1MbM77HyYuDOvHgs1uYZ/J3dARUv IUjsBXgqAFMuT4DZcxIuiN5AX6Sa6nl76FEAaiZJduHN8Kl1CpGuGmifpxTn4PhCOtRn8zPfT VCsvn5+4M5DIToeYquX6RqJzZOqOOJ0I7qLYsmQGNKGA/m80il7ILHma0RNwCHgvAA7T1jrGw 4IS/wIyj4LNjp74hS8/T4jHDod7kF6KjW3PVY1ZKaEyb38rGK36RVr7UcwFNXDD8m3AS7OOKO 37aKU3j/h5307y5QnMd+FRmDdZHP/0+hkGOjn5dwAPvU6YGjgk1zYaMsokH1upyZHdnwMhv1H VN+tIOR+n30ozORqSDr2/sX0SRArArPGDVvxELQhGpa0PcbZLeRuVF/ZfdpJFNRHbnrMMgmXb ph0tC/PIHuHLKItrYl48ch5jVvGBrY1IdQMAGuqwSHz7+VcluPVXpzWm6jAOXmNiCEFMApoNZ clNm8eMld2zHcPRoTJEOvhrPJjz4ecpWX6dIYP1rf3QleR5N/fvq9ZgmFcmPkE1aks0HPxTvM p4S3MeUiDqHwa6X7gmWihyvFwRPzynj/Gx/HHl9W2pxMJk8co5OErU5HvAoOFsm6aK5duC4Ae mqtlyLrPQm1xte2/7JVhT130CisYrSVE3Cud8JaHXGX7D7YzQzI0MXimWsy63GvL23emo1JvS 88XM8Ut3M1/ZRvJfC527t65jYoLfcqRNhCJeeHY6cJfWMHoCakwuWyycx+u+guYybRgFCGms Received-SPF: none client-ip=212.227.126.131; envelope-from=felix.dietrich@sperrhaken.name; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139701 Archived-At: Hello Jean, Jean Louis writes: > I would like myself to be able to send messages to Apache log. > > Now this message is appearing in error.log, but it does not appear to > be error. > > Wed Sep 28 06:31:32.023427 2022] [cgi:error] [pid 5706] [client 102.83.37= .37:54464] AH01215: Loading /var/www/.emacs.d/init.el (source)...: /var/www= /subscribe.example.com/doi.cgi This appears to be one of Emacs=CA=BC startup messages. These are written = to the standard error stream. > Never mind, I would like to send messages to error log. Is the way to > go to use `message' function? With =E2=80=98message=E2=80=99 you can write to the standard output stream,= when using Emacs with the =E2=80=9C--script=E2=80=9D or =E2=80=9C--batch=E2=80=9D comm= and line options. Using an Emacs Lisp file as a CGI script, I believe what is written to the standard output is sent back to the client (if it is written after correct headers). Presumably, output on the standard error stream is written to Apache=CA=BCs error log. From within Emacs, you can write to standard error using [1]: #+begin_src emacs-lisp (print "This is the output" #'external-debugging-output) #+end_src Alternatively, you may want to look into other ways of logging. For example you could: 1. send messages to logging daemons (like journald or syslog) connecting to their sockets directly and sending them messages formatted according to their protocols [2][3][4], 2. use a command line tool like =E2=80=9Clogger=E2=80=9D by wrapping the Em= acs Lisp script: #+NAME: posix-logger-wrapper #+begin_src sh { ./emacs-script 2>&1 1>&3 3>&- \ | logger -t "EMACSCGI" >/dev/null 2>&1 3>&- } &1 #+end_src #+NAME: bash-logger-wrapper #+begin_src sh # Using bash=CA=BCs process substitution: ./emacs-script > >(logger -t "EMACSCGI" >/dev/null 2>&1) corresponds to facility =E2=80=9Clocal0=E2=80=9D with severity= =E2=80=9Cinfo=E2=80=9D. ;; See description of command line switch =E2=80=9C--prio-prefix=E2=80= =9D. (process-send-string my/logger "<134>Hello World.\n") #+end_src emacs-lisp 4. write a log file with Emacs (=E2=80=98append-to-file=E2=80=99, =E2=80=98= write-file=E2=80=99, =E2=80=98write-region=E2=80=99). Footnotes: [1] (info "(elisp) Output Streams") [2] Syslog Protocol: [3] BSD Syslog Protocol: [4] Journald Protocol: --=20 Felix Dietrich