FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
233 stars 201 forks source link

Filter out realms connection error message from debug log #991

Closed dicedpixels closed 9 months ago

dicedpixels commented 9 months ago

Filter out realms connection error exception message from debug log. Using another <RegexFilter> did not work, hence the current regex.

img

There are two log entries related to not being able to connect to Realms. Only the log entry related to the exception, Couldn't connect to realms is removed.

Sample log attached.

log.txt

modmuss50 commented 9 months ago

You filter out Couldn't connect to realms but in the PR desc you say the error is Could not authorize you against Realms server: Invalid session id. Which one is correct?

dicedpixels commented 9 months ago

You filter out Couldn't connect to realms but in the PR desc you say the error is Could not authorize you against Realms server: Invalid session id. Which one is correct?

I've fixed the PR description. What I wanted to highlight is that only the exception Couldn't connect to realms is removed.

Could not authorize you against Realms server: Invalid session id is printed as an info so, I did not remove it.

dicedpixels commented 9 months ago

It seems like 1.20.3-pre3 changed the InvalidCredentialsException message. Now it's this: image

If the way I've done the RegexFilter is okay, I can include this as well.

modmuss50 commented 9 months ago

If the way I've done the RegexFilter is okay, I can include this as well.

Yes, if we can include them all that would be great, shame they keep changing it 😆

Maybe it would be easier to read if there was only 1 message per RegexFilter? Im not too bothered either way.

dicedpixels commented 9 months ago

Maybe it would be easier to read if there was only 1 message per RegexFilter? Im not too bothered either way.

I agree too but defining the filters like

<Filters>
  <RegexFilter regex="^Failed to verify authentication$" onMatch="DENY" onMismatch="ACCEPT"/>
  <RegexFilter regex="^Failed to fetch user properties$" onMatch="DENY" onMismatch="ACCEPT"/>
  <RegexFilter regex="^Couldn't connect to realms$" onMatch="DENY" onMismatch="ACCEPT"/>
</Filters>

doesn't seem to work as expected. It filters using the 1st regex and skips the other two. I couldn't find anything explaining this behavior online either. I tried different regexes as well.

modmuss50 commented 9 months ago

Maybe it would be easier to read if there was only 1 message per RegexFilter? Im not too bothered either way.

I agree too but defining the filters like

<Filters>
  <RegexFilter regex="^Failed to verify authentication$" onMatch="DENY" onMismatch="ACCEPT"/>
  <RegexFilter regex="^Failed to fetch user properties$" onMatch="DENY" onMismatch="ACCEPT"/>
  <RegexFilter regex="^Couldn't connect to realms$" onMatch="DENY" onMismatch="ACCEPT"/>
</Filters>

doesn't seem to work as expected. It filters using the 1st regex and skips the other two. I couldn't find anything explaining this behavior online either. I tried different regexes as well.

Ah, thats annoying. Lets just do it as one line then, its not the end of the world.

dicedpixels commented 9 months ago

Ah, thats annoying. Lets just do it as one line then, its not the end of the world.

PR updated with @justanothercorpusguy's suggestion and it works.

onMismatch="ACCEPT" indeed stops further processing. NEUTRAL does not.

https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/Filter.Result.html#NEUTRAL