[ 
https://issues.apache.org/jira/browse/KARAF-7029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17282051#comment-17282051
 ] 

Bernd Eckenfels commented on KARAF-7029:
----------------------------------------

Vassil, I just checked with a fresh Apache karaf runtime 4.2.11 vs. 4.3.0 
(unmodified upstream) download and it seems to work here, so maybe its really a 
problem with our custom distribution (maybe Pax Logging version or the fact 
that we have deployed the Log4J(v1) extra packages, will check this - I noticed 
that the 4.2.10 based distribution has colors but differently formatted than 
upstream karaf as well).

JB: we will investigate and update the issue, no need to check it out for now.

But a minor observation, looks like the and "toString() != null" is not needed 
in the surrounding if:

    
https://github.com/apache/karaf/blob/65bd88e8149ba6e013665a238dfa32b92465f1c4/log/src/main/java/org/apache/karaf/log/core/internal/LogEventFormatterImpl.java#L76


> Karaf console colors are broken
> -------------------------------
>
>                 Key: KARAF-7029
>                 URL: https://issues.apache.org/jira/browse/KARAF-7029
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.3.0
>         Environment: Windows 10 Pro
> java -version
> openjdk version "11.0.10" 2021-01-19 LTS
> OpenJDK Runtime Environment Zulu11.45+28-SA (build 11.0.10+9-LTS)
> OpenJDK 64-Bit Server VM Zulu11.45+28-SA (build 11.0.10+9-LTS, mixed mode)
>            Reporter: Vassil Zorev
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 4.3.1
>
>
> Hi,
> In my company we work with Karaf for some time now and recently i got a karaf 
> update on my system. It's currently version 4.3.0.SEE2 (we have forked the 
> main repository, but i expect it is close enough to the official 4.3.0). Also 
> I checked the sources in the master branch and they are the same in the 
> relevant place so i would expect the bug is on the master as well. But on to 
> the point.
> The karaf console => log:tail is no longer colored, but all white. I checked 
> my org.apache.karaf.log.cfg file and there is no '--no-color' property there. 
> So i debugged a bit 
> org.apache.karaf.log.core.internal.LogEventFormatterImpl.getColor(PaxLoggingEvent,
>  boolean) and found an issue there.
> return level2Color.get(event.getLevel());
> the map key is of type org.osgi.service.log.LogLevel, while event.getLevel() 
> is of type org.ops4j.pax.logging.spi.PaxLevel (incompatible). So for testing 
> purposes i changed to return level2Color.get(event.getLevel().toLevel()); 
> (which is the proper LogLevel type)
> and the console was colored again.
> I file this as minor although for me it is at least normal, i got very used 
> to the color-coded log levels... :)
> Please verify the proposed fix and consider applying it, it hopefully 
> requires minimal verification and impact.
>  
>  
> Thank you!
> Regards,
> Vassil Zorev
>  
> Edit:
> I didn't think about dependency version mismatches between the main branch 
> and our forked branch, so if this is working for you then please point at a 
> potential problem we can also fix on the forked branch.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to