Skip to content

Conversation

@IronMine
Copy link
Contributor

No description provided.

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks.

Can you see if logback has helper methods to query if current context is a terminal that supports colors?

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to using the withJansi feature here

https://logback.qos.ch/manual/layouts.html#coloring

@IronMine
Copy link
Contributor Author

This is excatly what i am trying to do but when it's set to true it does not have color anymore ^^

@IronMine
Copy link
Contributor Author

this does not color the logs ! when i desactivate withJansi they are colored back

@itzg
Copy link
Owner

itzg commented Oct 24, 2024

It looks like you need to use their highlight and not your custom one.

@IronMine
Copy link
Contributor Author

i tried... no with theyr highlight it does not work too

@itzg
Copy link
Owner

itzg commented Oct 24, 2024

It worked fine for me; however, I did have to run it in a regular terminal rather than within IntelliJ's run config (in my case). This what I ran to test the changes:

./gradlew installDist
build/install/mc-image-helper/bin/mc-image-helper install-curseforge --output-directory=/tmp/cf --slug=prominence-2-classic

and this is what I have for the pattern:

            <pattern>%highlight([mc-image-helper] %d{HH:mm:ss.SSS} %-5level : %msg%n)</pattern>

@itzg
Copy link
Owner

itzg commented Oct 24, 2024

...and just now added a "test-logging-level" subcommand to further confirm things:

image

@IronMine
Copy link
Contributor Author

okay but outside of intellIj terminal right ?

@itzg
Copy link
Owner

itzg commented Oct 24, 2024

okay but outside of intellIj terminal right ?

I'm running the above commands from IntelliJ Terminal window, but not via the Gradle/app run config

image

@IronMine
Copy link
Contributor Author

okay but outside of intellIj terminal right ?

I'm running the above commands from IntelliJ Terminal window, but not via the Gradle/app run config

image

Okay nice it works for me ! Can you confirm it works with the custom hilight ( so the warnings are yellow) ?

@itzg
Copy link
Owner

itzg commented Oct 25, 2024

Can you confirm it works with the custom hilight ( so the warnings are yellow) ?

I don't want to use custom highlighting if their built-in works -- besides yours is still missing the is-terminal conditional. I would prefer to have it not match colors than reinvent their wheel.

@IronMine
Copy link
Contributor Author

as you want. But i do not reinvent their wheel, i just customize the colors of the highlight --

@itzg
Copy link
Owner

itzg commented Oct 25, 2024

I can't see that they're conditionalizing either, so I'm fine with your custom one then

Double checked theirs at
https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.java

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@itzg itzg merged commit 3d49835 into itzg:master Oct 25, 2024
1 check passed
@itzg
Copy link
Owner

itzg commented Oct 25, 2024

Kicked off a release build to get included in image

https://github.com/itzg/mc-image-helper/releases/tag/1.40.3

@IronMine
Copy link
Contributor Author

Kicked off a release build to get included in image

https://github.com/itzg/mc-image-helper/releases/tag/1.40.3

Thanks a lot !

@IronMine IronMine deleted the ADD_COLOR_TO_LOGS branch October 27, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants