all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Apache2 error messages
@ 2022-09-28 13:36 Jean Louis
  2022-10-03 15:33 ` Felix Dietrich
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Louis @ 2022-09-28 13:36 UTC (permalink / raw)
  To: Help GNU Emacs

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. Never mind, I would like to send messages to error log.

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

Is the way to go to use `message' function?

Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Apache2 error messages
  2022-09-28 13:36 Apache2 error messages Jean Louis
@ 2022-10-03 15:33 ` Felix Dietrich
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Dietrich @ 2022-10-03 15:33 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs

Hello Jean,

Jean Louis <bugs@gnu.support> 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ʼ 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 ‘message’ you can write to the standard output stream, when using
Emacs with the “--script” or “--batch” command 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ʼs
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 “logger” by wrapping the Emacs Lisp
script:

  #+NAME: posix-logger-wrapper
  #+begin_src sh
    {
      ./emacs-script 2>&1 1>&3 3>&- \
        | logger -t "EMACSCGI" >/dev/null 2>&1 3>&-
    } </dev/null 3>&1
  #+end_src


  #+NAME: bash-logger-wrapper
  #+begin_src sh
    # Using bashʼs process substitution:
    ./emacs-script > >(logger -t "EMACSCGI" >/dev/null 2>&1) </dev/null
  #+end_src


3. run a command line tool like “logger” directly from within Emacs:

  #+NAME: logger-within-emacs
  #+begin_src emacs-lisp
    (setq my/logger (start-process "logger" nil
                                   "logger"
                                   (format "--id=%s" (emacs-pid))
                                   "-t" "EMACSCGI"
                                   "--prio-prefix"))
    ;; <134> corresponds to facility “local0” with severity “info”.
    ;; See description of command line switch “--prio-prefix”.
    (process-send-string my/logger "<134>Hello World.\n")
  #+end_src emacs-lisp


4. write a log file with Emacs (‘append-to-file’, ‘write-file’,
‘write-region’).


Footnotes:
[1]  (info "(elisp) Output Streams")

[2]  Syslog Protocol: <https://datatracker.ietf.org/doc/rfc5424/>

[3]  BSD Syslog Protocol: <https://tools.ietf.org/html/rfc3164>

[4]  Journald Protocol: <https://systemd.io/JOURNAL_NATIVE_PROTOCOL/>


-- 
Felix Dietrich



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-03 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 13:36 Apache2 error messages Jean Louis
2022-10-03 15:33 ` Felix Dietrich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.