[DISCUSS] Improve colored logging output

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[DISCUSS] Improve colored logging output

Guillaume Nodet-2
I'm wondering about improving the colored logging output in both the
"log:display" command and when running "bin/karaf run".
I'm thinking about keeping the log file the way it is, but simplifying the
output on the console and improving the color a bit.

23:11:44.198 *INFO* [pool-14-thread-3] Registering commands for bundle
org.apache.karaf.log.core/4.2.0.SNAPSHOT

23:11:51.043 *ERROR* [Karaf local console user karaf] Exception caught
while executing command

...

23:15:19.481 *DEBUG* [Karaf local console user karaf] Executing command:
'ld'

I've currently reused the maven color scheme, so *debug* *info* *warning*
*error*.

The current behavior is that "bin/karaf run" is uncolored, while
"log:display" have fully colored lines, both having the same output as the
log file.  The problem with the log file pattern is that it oftens does not
fit in the screen, even with a large one.

If you have any thoughts, let me know...
I have the above code ready to commit, but I'm happy to change the scheme,
drop it, or whatever else...

Cheers,
Guillaume
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Improve colored logging output

Matt Sicker
I really like the colour scheme that Spring Boot uses by default with
Logstash and Log4j2 and is what I tend to copy/paste into my own logging
config files.

On 19 October 2017 at 16:33, Guillaume Nodet <[hidden email]> wrote:

> I'm wondering about improving the colored logging output in both the
> "log:display" command and when running "bin/karaf run".
> I'm thinking about keeping the log file the way it is, but simplifying the
> output on the console and improving the color a bit.
>
> 23:11:44.198 *INFO* [pool-14-thread-3] Registering commands for bundle
> org.apache.karaf.log.core/4.2.0.SNAPSHOT
>
> 23:11:51.043 *ERROR* [Karaf local console user karaf] Exception caught
> while executing command
>
> ...
>
> 23:15:19.481 *DEBUG* [Karaf local console user karaf] Executing command:
> 'ld'
>
> I've currently reused the maven color scheme, so *debug* *info* *warning*
> *error*.
>
> The current behavior is that "bin/karaf run" is uncolored, while
> "log:display" have fully colored lines, both having the same output as the
> log file.  The problem with the log file pattern is that it oftens does not
> fit in the screen, even with a large one.
>
> If you have any thoughts, let me know...
> I have the above code ready to commit, but I'm happy to change the scheme,
> drop it, or whatever else...
>
> Cheers,
> Guillaume
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Improve colored logging output

Matt Sicker
Sorry, not Logstash: Logback.

On 19 October 2017 at 23:43, Matt Sicker <[hidden email]> wrote:

> I really like the colour scheme that Spring Boot uses by default with
> Logstash and Log4j2 and is what I tend to copy/paste into my own logging
> config files.
>
> On 19 October 2017 at 16:33, Guillaume Nodet <[hidden email]> wrote:
>
>> I'm wondering about improving the colored logging output in both the
>> "log:display" command and when running "bin/karaf run".
>> I'm thinking about keeping the log file the way it is, but simplifying the
>> output on the console and improving the color a bit.
>>
>> 23:11:44.198 *INFO* [pool-14-thread-3] Registering commands for bundle
>> org.apache.karaf.log.core/4.2.0.SNAPSHOT
>>
>> 23:11:51.043 *ERROR* [Karaf local console user karaf] Exception caught
>> while executing command
>>
>> ...
>>
>> 23:15:19.481 *DEBUG* [Karaf local console user karaf] Executing command:
>> 'ld'
>>
>> I've currently reused the maven color scheme, so *debug* *info* *warning*
>> *error*.
>>
>> The current behavior is that "bin/karaf run" is uncolored, while
>> "log:display" have fully colored lines, both having the same output as the
>> log file.  The problem with the log file pattern is that it oftens does
>> not
>> fit in the screen, even with a large one.
>>
>> If you have any thoughts, let me know...
>> I have the above code ready to commit, but I'm happy to change the scheme,
>> drop it, or whatever else...
>>
>> Cheers,
>> Guillaume
>>
>
>
>
> --
> Matt Sicker <[hidden email]>
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Improve colored logging output

Guillaume Nodet-2
In reply to this post by Matt Sicker
I modified it a bit to use the red / yellow / green for error / warn / info
levels but kept cyan for debug / trace:

10:03:51.308 DEBUG [FelixStartLevel] ServiceEvent REGISTERED -
[org.apache.karaf.shell.api.console.SessionFactory] -
org.apache.karaf.shell.core

10:03:51.311 DEBUG [FelixStartLevel] org.apache.karaf.bundle.core (8):
Starting extension synchronously

10:03:51.342 *INFO * [FelixStartLevel] Registering commands for bundle
org.apache.karaf.bundle.core/4.2.0.SNAPSHOT

10:03:51.344 DEBUG [FelixStartLevel] org.apache.karaf.config.core (9):
Starting extension synchronously

10:03:51.356 *INFO * [FelixStartLevel] Registering commands for bundle
org.apache.karaf.config.core/4.2.0.SNAPSHOT

10:03:51.358 DEBUG [FelixStartLevel] ServiceEvent REGISTERED -
[org.osgi.service.cm.ConfigurationListener] - org.apache.karaf.config.core

10:03:51.360 *WARN * [FelixStartLevel] org.apache.karaf.config.core (9):
Error while creating extension

I've pushed a branch [1] if people want to have a look.  The properties for
colors have been extracted out of the pattern for ease of configuration,
but unfortunately they are duplicated because the "log:command" and
"bin/karaf run" use different mechanism.

I plan to have a look at removing some useless thread informations, i.e.
giving some names to threadpools when possible.

[1]
https://github.com/apache/karaf/commit/5686ccf651600790197b9ca4e5ce69e0930107f5

2017-10-20 6:43 GMT+02:00 Matt Sicker <[hidden email]>:

> I really like the colour scheme that Spring Boot uses by default with
> Logstash and Log4j2 and is what I tend to copy/paste into my own logging
> config files.
>
> On 19 October 2017 at 16:33, Guillaume Nodet <[hidden email]> wrote:
>
> > I'm wondering about improving the colored logging output in both the
> > "log:display" command and when running "bin/karaf run".
> > I'm thinking about keeping the log file the way it is, but simplifying
> the
> > output on the console and improving the color a bit.
> >
> > 23:11:44.198 *INFO* [pool-14-thread-3] Registering commands for bundle
> > org.apache.karaf.log.core/4.2.0.SNAPSHOT
> >
> > 23:11:51.043 *ERROR* [Karaf local console user karaf] Exception caught
> > while executing command
> >
> > ...
> >
> > 23:15:19.481 *DEBUG* [Karaf local console user karaf] Executing command:
> > 'ld'
> >
> > I've currently reused the maven color scheme, so *debug* *info* *warning*
> > *error*.
> >
> > The current behavior is that "bin/karaf run" is uncolored, while
> > "log:display" have fully colored lines, both having the same output as
> the
> > log file.  The problem with the log file pattern is that it oftens does
> not
> > fit in the screen, even with a large one.
> >
> > If you have any thoughts, let me know...
> > I have the above code ready to commit, but I'm happy to change the
> scheme,
> > drop it, or whatever else...
> >
> > Cheers,
> > Guillaume
> >
>
>
>
> --
> Matt Sicker <[hidden email]>
>



--
------------------------
Guillaume Nodet