[DISCUSS] Change Jenkins default logging format

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

[DISCUSS] Change Jenkins default logging format

Baptiste MATHUS
Hello everyone,

Having worked on more things related to Jenkins logging recently, I've had the opportunity to remember my past pain when I was operating a Jenkins instance and sending logs to an ELK cluster.
Compared to almost everything else in the infrastructure, the logstash rules for Jenkins logs were unnecessarily complex.

The main pain-points, for me at least, had been the two-lines (sigh) per log default, and also the localized date format (or log level...). 
Even now, so many years after reading those, I still struggle daily to make sure I'm reading the right line/date associated to the message I'm reading on the line above.

I would like to propose we change the current logging format behavior to a more readable and more operation-friendly one.
This would result in something close to the following format:

[   INFO][2018-04-04 12:40:49] Logging initialized @180ms to org.eclipse.jetty.util.log.JavaUtilLog (from org.eclipse.jetty.util.log.Log initialized)
[   INFO][2018-04-04 12:40:49] Beginning extraction from war file (from winstone.Logger logInternal)
[WARNING][2018-04-04 12:40:49] Empty contextPath (from org.eclipse.jetty.server.handler.ContextHandler setContextPath)
[   INFO][2018-04-04 12:40:49] jetty-9.4.z-SNAPSHOT (from org.eclipse.jetty.server.Server doStart)

Instead of the usual:

Apr 04, 2018 12:36:41 PM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @354ms to org.eclipse.jetty.util.log.JavaUtilLog
Apr 04, 2018 12:36:41 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.handler.ContextHandler setContextPath
WARNING: Empty contextPath
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.4.z-SNAPSHOT


WDYT?

If this looks interesting to people, I'm ready to file the associated JEP for it and possibly work on its implementation in the future.

Obviously, we would need some way to revert to the "legacy" format, at least for some time for users to adapt. But that is not something I'm particularly worried about.

-- Baptiste

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS4rN67DpzH5FoOg7YBU8jxFArjzq0ev%2BqRjowObu_pKvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Oleg Nenashev
Hi Baptiste,

Anyone can easily change the logging format in Jenkins by passing custom J.U.L properties file.
So it should not be a problem to change logging format even if you do not add a custom logging appender for ELK.

Changing a default logging format may cause regressions in existing monitoring systems. I would rather be conservative and keep the default logging format in Jenkins unless there is a strong justification to do that. New subprojects like Jenkins Essentials and Jenkins X could easily change the default format, because they have no compatibility commitment so far.

Best regards,
Oleg


On Wednesday, April 4, 2018 at 3:18:00 PM UTC+2, Baptiste Mathus wrote:
Hello everyone,

Having worked on more things related to Jenkins logging recently, I've had the opportunity to remember my past pain when I was operating a Jenkins instance and sending logs to an ELK cluster.
Compared to almost everything else in the infrastructure, the logstash rules for Jenkins logs were unnecessarily complex.

The main pain-points, for me at least, had been the two-lines (sigh) per log default, and also the localized date format (or log level...). 
Even now, so many years after reading those, I still struggle daily to make sure I'm reading the right line/date associated to the message I'm reading on the line above.

I would like to propose we change the current logging format behavior to a more readable and more operation-friendly one.
This would result in something close to the following format:

[   INFO][2018-04-04 12:40:49] Logging initialized @180ms to org.eclipse.jetty.util.log.JavaUtilLog (from org.eclipse.jetty.util.log.Log initialized)
[   INFO][2018-04-04 12:40:49] Beginning extraction from war file (from winstone.Logger logInternal)
[WARNING][2018-04-04 12:40:49] Empty contextPath (from org.eclipse.jetty.server.handler.ContextHandler setContextPath)
[   INFO][2018-04-04 12:40:49] jetty-9.4.z-SNAPSHOT (from org.eclipse.jetty.server.Server doStart)

Instead of the usual:

Apr 04, 2018 12:36:41 PM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @354ms to org.eclipse.jetty.util.log.JavaUtilLog
Apr 04, 2018 12:36:41 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.handler.ContextHandler setContextPath
WARNING: Empty contextPath
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.4.z-SNAPSHOT


WDYT?

If this looks interesting to people, I'm ready to file the associated JEP for it and possibly work on its implementation in the future.

Obviously, we would need some way to revert to the "legacy" format, at least for some time for users to adapt. But that is not something I'm particularly worried about.

-- Baptiste

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a7cbc69c-e9d1-4c37-8a96-b35b1e920200%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Daniel Beck

> On 4. Apr 2018, at 18:12, Oleg Nenashev <[hidden email]> wrote:
>
> Changing a default logging format may cause regressions in existing monitoring systems. I would rather be conservative and keep the default logging format in Jenkins unless there is a strong justification to do that.

I expect that a change in logging format would surface quickly enough to not cause major headaches. Users with elaborate monitoring are probably also more likely to use LTS and we can cover this change in an upgrade guide.

The format is annoying enough that we should change it to something sane.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/879DFDED-BDED-4BC9-AB75-CD633C1C6A2F%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

R. Tyler Croy
In reply to this post by Oleg Nenashev
(replies inline)

On Wed, 04 Apr 2018, Oleg Nenashev wrote:

> Hi Baptiste,
>
> Anyone can easily change the logging format in Jenkins by passing custom
> J.U.L properties file.
> So it should not be a problem to change logging format even if you do not
> add a custom logging appender for ELK.
>
> Changing a default logging format may cause regressions in existing
> monitoring systems. I would rather be conservative and keep the default
> logging format in Jenkins unless there is a strong justification to do
> that. New subprojects like Jenkins Essentials and Jenkins X could easily
> change the default format, because they have no compatibility commitment so
> far.

Thanks for sharing your thoughts Oleg, it makes me wonder: how could we
quantify the positive/negative impact of this (arguably) "bad default."

I'm reminded of some of the pre-Jenkins 2 discussions about security defaults
for example. I spent some time trying to discover Jenkins-log-parsing projects,
tools, and their communities to which we could reach out. Unfortunately I
wasn't able to find anything big past a couple of blog posts :-/

From my personal experience as an Operator, compact and easily parseable
(sed/awk/perl) one-line logs are HUGELY valuable and worth any temporary
heartburn some people may experience with their existing hacks.



Cheers

- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>
     xmpp: [hidden email]

  % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20180404172432.wlr4c5f35tuvnijj%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Carlos Sanchez
I'm +1 to change the format. 2 lines is really annoying

On Wed, Apr 4, 2018 at 7:24 PM, R. Tyler Croy <[hidden email]> wrote:
(replies inline)

On Wed, 04 Apr 2018, Oleg Nenashev wrote:

> Hi Baptiste,
>
> Anyone can easily change the logging format in Jenkins by passing custom
> J.U.L properties file.
> So it should not be a problem to change logging format even if you do not
> add a custom logging appender for ELK.
>
> Changing a default logging format may cause regressions in existing
> monitoring systems. I would rather be conservative and keep the default
> logging format in Jenkins unless there is a strong justification to do
> that. New subprojects like Jenkins Essentials and Jenkins X could easily
> change the default format, because they have no compatibility commitment so
> far.


Thanks for sharing your thoughts Oleg, it makes me wonder: how could we
quantify the positive/negative impact of this (arguably) "bad default."

I'm reminded of some of the pre-Jenkins 2 discussions about security defaults
for example. I spent some time trying to discover Jenkins-log-parsing projects,
tools, and their communities to which we could reach out. Unfortunately I
wasn't able to find anything big past a couple of blog posts :-/

From my personal experience as an Operator, compact and easily parseable
(sed/awk/perl) one-line logs are HUGELY valuable and worth any temporary
heartburn some people may experience with their existing hacks.



Cheers

- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>
     xmpp: [hidden email]

  % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20180404172432.wlr4c5f35tuvnijj%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALHFn6NsdOsMRtD%3DacAATvOiY_Wo15gxu6Fwh5iRCs3ogqMmfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Arnaud Héritier
I think I already claimed my hate for this logging format many times.
For sure I understand Oleg's concern with the impact of changing the default settings.
Like always for such kind of change when we don't really know how it could impact our users I would prefer to introduce the change non activated by default in 2.x and wait a 3.x for the change of the default value but if we have to wait for 500 weeklies before the 3.x ..... I'm a bit septic about my approach


On Wed, Apr 4, 2018 at 7:45 PM, Carlos Sanchez <[hidden email]> wrote:
I'm +1 to change the format. 2 lines is really annoying

On Wed, Apr 4, 2018 at 7:24 PM, R. Tyler Croy <[hidden email]> wrote:
(replies inline)

On Wed, 04 Apr 2018, Oleg Nenashev wrote:

> Hi Baptiste,
>
> Anyone can easily change the logging format in Jenkins by passing custom
> J.U.L properties file.
> So it should not be a problem to change logging format even if you do not
> add a custom logging appender for ELK.
>
> Changing a default logging format may cause regressions in existing
> monitoring systems. I would rather be conservative and keep the default
> logging format in Jenkins unless there is a strong justification to do
> that. New subprojects like Jenkins Essentials and Jenkins X could easily
> change the default format, because they have no compatibility commitment so
> far.


Thanks for sharing your thoughts Oleg, it makes me wonder: how could we
quantify the positive/negative impact of this (arguably) "bad default."

I'm reminded of some of the pre-Jenkins 2 discussions about security defaults
for example. I spent some time trying to discover Jenkins-log-parsing projects,
tools, and their communities to which we could reach out. Unfortunately I
wasn't able to find anything big past a couple of blog posts :-/

From my personal experience as an Operator, compact and easily parseable
(sed/awk/perl) one-line logs are HUGELY valuable and worth any temporary
heartburn some people may experience with their existing hacks.



Cheers

- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>
     xmpp: [hidden email]

  % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20180404172432.wlr4c5f35tuvnijj%40blackberry.coupleofllamas.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALHFn6NsdOsMRtD%3DacAATvOiY_Wo15gxu6Fwh5iRCs3ogqMmfQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
-----
Arnaud Héritier
Mail/GTalk: aheritier AT gmail DOT com
Twitter/Skype : aheritier

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAFNCU-_ck5Tc0gbvBqDDMqnUnBtvnHP3cRUaapfcvJJ6jCmDyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Baptiste MATHUS
In reply to this post by Oleg Nenashev


2018-04-04 18:12 GMT+02:00 Oleg Nenashev <[hidden email]>:
Hi Baptiste,

Anyone can easily change the logging format in Jenkins by passing custom J.U.L properties file.

Yes. But in practice, I'm convinced virtually nobody does this.
 
So it should not be a problem to change logging format even if you do not add a custom logging appender for ELK.

Changing a default logging format may cause regressions in existing monitoring systems. I would rather be conservative and keep the default logging format in Jenkins unless there is a strong justification to do that. New subprojects like Jenkins Essentials and Jenkins X could easily change the default format, because they have no compatibility commitment so far.

FTR, I did consider this strategy about keeping the current behavior, and introduce some sysprop to enable the new (and much much better, IMO) behavior.
But this is IMO not the way we provide the best possible Jenkins experience to users, especially newcomers. 

And I don't think we should consider Jenkins Essentials to be the only place where we make the OOTB experience as smooth as possible.

Do you really see a big issue if we offer a sysprop to revert to the current behavior, *but* change the default to something more sensible?
I fail to see how hard it would be for people having built monitoring about Jenkins logs to just temporarily use the sysprop while they adapt their logstash or whatever parsing rules. 
I can even probably provide it for logstash at least.

And again, this is IMO for the good of the project and its users, so even if there's some (small) disruption this is probably worth it.

Thanks a bunch for your feedback in any case.

-- Baptiste

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS48-5JTQKOSjt9dtFRimET-%3DH9JKGNh0OoWnKwq6QS0Gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Oleg Nenashev
Hi,

Please be sure I do not try to derail this story. Actually I think it is very important, especially if we could go beyond System logs. There are other log types in Jenkins (E.g. build logs), and in the modern CD/DevOps/whatever world it would be preferable to have some unified logging within the entire automation system. Yes, for the entire system, not just for Jenkins.

Creating automation-friendly system logging with Logstash/Fluentd support OOTB would definitely help to unify logging. For other log types there are stories like JENKINS-38313 "External Task Log Storage" which also lean towards such direction.

Thanks for sharing your thoughts Oleg, it makes me wonder: how could we
quantify the positive/negative impact of this (arguably) "bad default."I'm reminded of some of the pre-Jenkins 2 discussions about security defaults

The current logging format is bad for sure, nobody argues with that from what I see :)
 
for example. I spent some time trying to discover Jenkins-log-parsing projects,
tools, and their communities to which we could reach out. Unfortunately I
wasn't able to find anything big past a couple of blog posts :-/

WDYM? Parsing of system logs or logs in general?
 
And I don't think we should consider Jenkins Essentials to be the only place where we make the OOTB experience as smooth as possible.

Yes, we should not. But it definitely could be a place to start from.
  1. We enable the new logging format in Essentials + immediately get benefit from it (e.g. via Logstash/fluentd)
  2. We offer a feature flag in standard Jenkins. Start from opt-in, then maybe opt-out at some point
  3. For installations passing through the installation wizard, we enable the feature by default (like we do with security defaults now)

BR, Oleg


 

On Wed, Apr 4, 2018 at 8:44 PM, Baptiste Mathus <[hidden email]> wrote:


2018-04-04 18:12 GMT+02:00 Oleg Nenashev <[hidden email]>:
Hi Baptiste,

Anyone can easily change the logging format in Jenkins by passing custom J.U.L properties file.

Yes. But in practice, I'm convinced virtually nobody does this.
 
So it should not be a problem to change logging format even if you do not add a custom logging appender for ELK.

Changing a default logging format may cause regressions in existing monitoring systems. I would rather be conservative and keep the default logging format in Jenkins unless there is a strong justification to do that. New subprojects like Jenkins Essentials and Jenkins X could easily change the default format, because they have no compatibility commitment so far.

FTR, I did consider this strategy about keeping the current behavior, and introduce some sysprop to enable the new (and much much better, IMO) behavior.
But this is IMO not the way we provide the best possible Jenkins experience to users, especially newcomers. 

And I don't think we should consider Jenkins Essentials to be the only place where we make the OOTB experience as smooth as possible.

Do you really see a big issue if we offer a sysprop to revert to the current behavior, *but* change the default to something more sensible?
I fail to see how hard it would be for people having built monitoring about Jenkins logs to just temporarily use the sysprop while they adapt their logstash or whatever parsing rules. 
I can even probably provide it for logstash at least.

And again, this is IMO for the good of the project and its users, so even if there's some (small) disruption this is probably worth it.

Thanks a bunch for your feedback in any case.

-- Baptiste

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/4PTMMwQNfjw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS48-5JTQKOSjt9dtFRimET-%3DH9JKGNh0OoWnKwq6QS0Gg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPfivLDSPxVdKCjq13bC2dubhabmNugN%3DFXobO%3Db6jqKGfDX8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Daniel Beck

> On 4. Apr 2018, at 21:20, Oleg Nenashev <[hidden email]> wrote:
>
> • We enable the new logging format in Essentials + immediately get benefit from it (e.g. via Logstash/fluentd)
> • We offer a feature flag in standard Jenkins. Start from opt-in, then maybe opt-out at some point
> • For installations passing through the installation wizard, we enable the feature by default (like we do with security defaults now)
>

I'm conflicted about these. On the surface, this provides a compelling path forward with everyone getting what they want. However,

1. If we plan to allow opt-out in the end anyway, why start with opt-in? It's not a new subsystem that needs to be proven first. Good defaults are important, and letting those in the know who care deeply enable it for themselves might just delay the general implementation (perhaps indefinitely).
2. For this to be a setup wizard type distinction, it almost certainly needs to be promoted to a UI option (I think it would be the first wizard setting to not have one). I'm not positive this is a good idea.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/E4201E29-D362-4A14-BCFB-45D7E9FD9445%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Jesse Glick-4
In reply to this post by Baptiste MATHUS
On Wed, Apr 4, 2018 at 9:17 AM, Baptiste Mathus <[hidden email]> wrote:
> Instead of the usual:
>
> Apr 04, 2018 12:36:41 PM org.eclipse.jetty.util.log.Log initialized
> INFO: Logging initialized @354ms to org.eclipse.jetty.util.log.JavaUtilLog
> Apr 04, 2018 12:36:41 PM winstone.Logger logInternal
> INFO: Beginning extraction from war file

From this part of your message, what I suspect you are talking about
is the default logging format *in Winstone*. That is not a part of
Jenkins per se, nor is it controllable by code in Jenkins core. It is
specific to what appears on stderr when Jenkins is launched using
`java -jar jenkins.war`; when the WAR is loaded from other servlet
containers, they get to choose how log messages are presented. If you
wish to improve the default console format presented by Winstone, go
right ahead, but do not think that this is something that can be
controlled by the administrator except via Winstone command-line
options. There are already `--logfile`, `--logThrowingLineNo`,
`--logThrowingThread`, and `--debug` in this area.

As to the concrete format to pick, I do not have a strong opinion but
note that there is a compact one-line formatter in `support-core`
(later copied to `jenkins-test-harness` as well).

There is another place where a two-line format is displayed: in the
`LogRecorder` GUI, in `/log/all` for example. Certainly that could be
changed freely, since no one could (sanely) be depending on *that*.
Already it is colorized for readability, and you can do any HTML
tricks you like to present information nicely.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3DpkrVmDXaaWTr%2BcpJKw%3Dghk8BCECtv%2BqZVk__v9M%2Bvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

GSimpson
In reply to this post by Oleg Nenashev

> On Wednesday, April 4, 2018 at 9:12:39 AM UTC-7, Oleg Nenashev wrote:
> Anyone can easily change the logging format in Jenkins by passing custom J.U.L properties file.

I am going to go ahead and strongly disagree with the characterization that changing the logging is easy. I may be the only one that has ever struggled with getting custom logging for Jenkins but no one told the Jenkins Logging Wiki it was easy either:

Unfortunately, there is no simple way in Jenkins to send log messages generated by Jenkins himself or by any plugins to the console, to a file or anywhere else. No matter what command line options you will use, you just won't succeed.

Can you please please please share your secrets? 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/bcde770c-ae38-475c-adca-e2e91423e059%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Daniel Beck

> On 5. Apr 2018, at 23:24, gsimpson via Jenkins Developers <[hidden email]> wrote:
>
> I am going to go ahead and strongly disagree with the characterization that changing the logging is easy. I may be the only one that has ever struggled with getting custom logging for Jenkins but no one told the Jenkins Logging Wiki it was easy either:
>
>> Unfortunately, there is no simple way in Jenkins to send log messages generated by Jenkins himself or by any plugins to the console, to a file or anywhere else. No matter what command line options you will use, you just won't succeed.
>
> Can you please please please share your secrets?

I'm not sure I understand the problem described in the wiki. I pieced together the following after a quick google search or two (i.e. these rules are probably mostly broken garbage):

> $ cat Desktop/logging.properties
> # Logging
> handlers = java.util.logging.FileHandler
> .level = ALL
>
> # File Logging
> java.util.logging.FileHandler.pattern = %h/jenkins.log
> java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
> java.util.logging.FileHandler.level = ALL
>
> java.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n'
> $ java -Djava.util.logging.config.file=/Users/danielbeck/Desktop/logging.properties -jar ~/Jenkins/wars/jenkins-2.107.1.war

This works: It will create the file /Users/danielbeck/jenkins.log with extremely verbose content, in the custom one line format. I don't know what problems the wiki author encountered when they wrote this, but it seems wrong or obsolete.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/E926E82C-9839-407E-B9A0-314C1ADF62B9%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

James Nord-2
In reply to this post by Baptiste MATHUS
> Anyone can easily change the logging format in Jenkins by passing custom J.U.L properties file.

I know at least one person that did!

+1 to change the default. I think date&time should always come first though, not level and use a datetime format that does not have to cope with am/pm or crazy American date styles!

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/3be73c62-04ac-49d7-ad89-ccbd6f2b511a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Jesse Glick-4
On Wed, Apr 11, 2018 at 10:01 AM, James Nord <[hidden email]> wrote:
> I think date&time should always come first though, not level and use a datetime format that does not have to cope with am/pm or crazy American date styles!

FTR the formatter in `support-core` produces output such as

2018-04-11 15:15:56.836+0000 [id=37] INFO
o.j.main.modules.sshd.SSHD#start: Started SSHD at port 2222

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1B%2BQSm7_5aJ3B6QC6%2BVwYdoiqvLo_hPRNrcYdHsz6xcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Jesse Glick-4
On Wed, Apr 11, 2018 at 11:18 AM, Jesse Glick <[hidden email]> wrote:
2018-04-11 15:15:56.836+0000 [id=37] INFO
o.j.main.modules.sshd.SSHD#start: Started SSHD at port 2222

Rrrgh, GMail line-wrapping without the RFC to preserve significant newlines. Trying again as HTML:

2018-04-11 15:15:56.836+0000 [id=37] INFO o.j.main.modules.sshd.SSHD#start: Started SSHD at port 2222

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr30tGroBGdMTndw1ihaOLtR1zxvdhVioovz6DC3CgjYow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] Change Jenkins default logging format

Cyrille Le Clerc
In reply to this post by Baptiste MATHUS
As I have already said many times, I fully support this initiative.

Tomcat has done this move a while ago and it was a great success.

Cyrille

On Wednesday, April 4, 2018 at 3:18:00 PM UTC+2, Baptiste Mathus wrote:
Hello everyone,

Having worked on more things related to Jenkins logging recently, I've had the opportunity to remember my past pain when I was operating a Jenkins instance and sending logs to an ELK cluster.
Compared to almost everything else in the infrastructure, the logstash rules for Jenkins logs were unnecessarily complex.

The main pain-points, for me at least, had been the two-lines (sigh) per log default, and also the localized date format (or log level...). 
Even now, so many years after reading those, I still struggle daily to make sure I'm reading the right line/date associated to the message I'm reading on the line above.

I would like to propose we change the current logging format behavior to a more readable and more operation-friendly one.
This would result in something close to the following format:

[   INFO][2018-04-04 12:40:49] Logging initialized @180ms to org.eclipse.jetty.util.log.JavaUtilLog (from org.eclipse.jetty.util.log.Log initialized)
[   INFO][2018-04-04 12:40:49] Beginning extraction from war file (from winstone.Logger logInternal)
[WARNING][2018-04-04 12:40:49] Empty contextPath (from org.eclipse.jetty.server.handler.ContextHandler setContextPath)
[   INFO][2018-04-04 12:40:49] jetty-9.4.z-SNAPSHOT (from org.eclipse.jetty.server.Server doStart)

Instead of the usual:

Apr 04, 2018 12:36:41 PM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @354ms to org.eclipse.jetty.util.log.JavaUtilLog
Apr 04, 2018 12:36:41 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.handler.ContextHandler setContextPath
WARNING: Empty contextPath
Apr 04, 2018 12:36:42 PM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.4.z-SNAPSHOT


WDYT?

If this looks interesting to people, I'm ready to file the associated JEP for it and possibly work on its implementation in the future.

Obviously, we would need some way to revert to the "legacy" format, at least for some time for users to adapt. But that is not something I'm particularly worried about.

-- Baptiste

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/3593c7a5-6f77-4dc7-94f8-e2d8cad4b521%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.