mdfind - Disable debug output: [UserQueryParser] Loading keywords and predicates for locale "de_CH"

Hey

Whenever I run mdfind, it prints some annoying debug output. Example:

$ mdfind ……………
2023-04-24 07:21:53.046 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de_CH"
2023-04-24 07:21:53.047 mdfind[642:1948002] [UserQueryParser] Loading keywords and predicates for locale "de"
…

That's on macOS Ventura 13.3.1 (22E261). I've got another mac with an older macOS, and there mdfind didn't do this.

While googling, I found a post on reddit with a "solution", which just filters out those lines from stderr, like so:

function mdfind() {
    /usr/bin/mdfind $@ 2> >(grep --invert-match ' \[UserQueryParser\] ' >&2)
}

This does not solve the problem, it just hides it.

Is there a way to turn off these debug messages?

Thanks, Alexander

Post not yet marked as solved Up vote post of alexs77 Down vote post of alexs77
1k views

Replies

The format of those log messages suggests that they’re being logged by the system log API but AFAICT that’s not the case. If the were:

  • You wouldn’t seem them coming out to stderr by default.

  • You could suppress them using log settings, as described in the docs linked to by Your Friend the System Log.

Some spelunking reveals that they’re actually being logged by CFLog, an internal function that’s more-or-less equivalent to NSLog. I don’t see any way to prevent them from being replicated to stderr.

Regardless of what else you do, I encourage you to file a bug requesting that the Spotlight “UserQueryParser” switch to using the system log API directly.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thanks, Eskimo, I'll do that.

    That seems to be a regressoion. "Back in the day", on older macOS versions, mdfind didn't misbehave like that.

    I can tell when it did not do that (but not right now, as I don't have the old macbook at me). I cannot tell when it started doing that.

Add a Comment