2

I don't get any GC logging messages when running Racket code in raket-mode in emacs.

Running the following code in DrRacket gives back a log entry while running it in Emacs REPL does not.

(define my-logger (make-log-receiver (current-logger) 'debug 'GC))
(collect-garbage)
(sync/timeout 1 my-logger)

How can I get the log messages in the Emacs REPL case?

PLux
  • 21
  • 1

1 Answers1

1
  1. Make sure you have a somewhat recent version of racket-mode (e.g. latest from MELPA).
  2. Use C-c C-l a.k.a. M-x racket-logger to open a racket-logger-mode buffer.
  3. If you have any problems or questions, feel free to open an issue.

Update: The above instructions don't really answer why your own program isn't getting a log event. This is a really interesting bug -- thanks! More conversation on the issue thread. When I figure it out, I'll try to come back here and update this answer again with something hopefully interesting and educational about Racket logging.


Update: This turned out to be a "what was I thinking?" bug in racket-mode. I was creating a new logger:

(define global-logger (make-logger))
  (current-logger global-logger)

rather than just using the existing one:

(define global-logger (current-logger))

The existing logger is special, as the Racket documentation for loggers explains:

On start-up, Racket creates an initial logger that is used to record events from the core run-time system. For example, an 'debug event is reported for each garbage collection (see Garbage Collection).

I've pushed a commit to a topic branch and when I get all-green from CI I'll merge to master; it should be available via MELPA soon after.

Greg Hendershott
  • 16,100
  • 6
  • 36
  • 53
  • Thanks for your answer. I have done that and the result is exactly the same, no log message from GC. I'm using racket-mode version 20180824.1410, racket 6.9 – PLux Aug 26 '18 at 08:09
  • I saw your [issue](https://github.com/greghendershott/racket-mode/issues/325) -- thanks! This seems unique to the GC logger, so possibly a bug in racket-mode, so I'll continue the conversation there. – Greg Hendershott Aug 26 '18 at 13:01