gerrit/lib
Edwin Kempin 2b81d71374 Add dependency to Flogger
Flogger is an open source project (Apache 2 License) from Google that
provides a fluent JAVA API for logging:
* https://github.com/google/flogger
* https://google.github.io/flogger/

We want to use Flogger instead of slf4j. This idea was discussed at the
Gerrit hackathon in Lund [1] and on the mailing list [2].

Benefits:
* Better Readability
* Better Performance
* Will allow us to implement request tracing

Flogger API examples:
* logger.atSevere()
    .withCause(err)
    .log("Error in %s %s", req.getMethod(), uri);
* logger.atInfo()
    .atMostEvery(1, TimeUnit.HOURS)
    .log(...)
* logger.atInfo()
    .withStackTrace(StackSize.FULL)
    .log(...)

Within Google Flogger is long-established and is used by almost 3/4 of
all Google's Java projects, hence this library is very mature.

The Flogger API can be used with different logging backends. We are
using the log4j backend, as we are currently using log4j as backend with
slf4j. This means there are no changes to how logs are configured
(existing log4j.properties and log4j.xml files continue to work). It
also means that this doesn't effect any integrations that work with
log4j (e.g. integration with logstash continues to work).

To use the log4j backend for Flogger the system property
'flogger.backend_factory' must be set to
'com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance'.
E.g. this system property may be set in gerrit.config:
[container]
  javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"

If this property is not set Gerrit sets it automatically on startup so
that we always have a proper logging configuration. We do this in
Main.java before loading any class. This is important since Flogger
reads this system property only once when the FluentLogger class is
loaded and we must be sure that the system property was set before this.

Using Flogger and slf4j in parallel is not a problem. Logs from both
APIs end up in the same log file(s).

This change doesn't migrate any classes to Flogger yet. This will be
done by follow-up changes.

JGit is still using slf4j and needs an explicit runtime dependency on
slf4j.

[1] https://docs.google.com/presentation/d/1Kwn77c1PScMLDEWiJDklEm43NsN2-mWm2PqHwYTkJfI/edit?usp=sharing
[2] https://groups.google.com/d/msg/repo-discuss/meEWJO7c4pA/fxDx2waRCQAJ

Change-Id: Ifc31fb95c10397857e8de5657c729f49c1820ec4
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-06-05 13:06:05 +02:00
..
antlr Dissolve gerrit-index top-level directory 2017-10-31 11:02:36 -04:00
asciidoctor Move AsciiDoctor Java files to a java package 2018-05-24 15:33:19 -04:00
auto Upgrade auto-value to 1.6 2018-04-18 08:47:02 +02:00
ba-linkify Manually add @license to ba-linkify.js 2018-03-26 14:14:57 -04:00
bouncycastle Don't ship bouncycastle libraries in plugin API 2017-04-07 07:38:04 +02:00
codemirror Revert "Update codemirror to 5.27.2" 2017-07-03 16:43:38 +00:00
commons Move //lib:common-io to //lib/commons:io 2018-01-24 15:21:30 +01:00
dropwizard Remove Buck based build 2017-01-23 12:44:58 +00:00
easymock Remove Buck based build 2017-01-23 12:44:58 +00:00
elasticsearch-rest-client Elasticsearch: replace native API in prod w/ REST 2018-05-31 08:06:19 +09:00
flogger Add dependency to Flogger 2018-06-05 13:06:05 +02:00
fonts Update Roboto to Roboto-Regular 2017-09-06 13:00:11 -07:00
greenmail Remove Buck based build 2017-01-23 12:44:58 +00:00
guice Bump guice version to 4.2.0 2018-03-06 21:31:22 +00:00
gwt Remove Buck based build 2017-01-23 12:44:58 +00:00
highlightjs PolyGerrit: Add support for erlang and puppet in highlight 2017-07-14 02:55:21 +01:00
httpcomponents lib/jest for Elasticsearch: refactor dependencies 2018-04-13 15:41:14 -04:00
jackson Acceptance tests: Replace embedded ES with docker testcontainer 2018-05-31 08:13:48 +09:00
jetty Remove Buck based build 2017-01-23 12:44:58 +00:00
jgit Add dependency to Flogger 2018-06-05 13:06:05 +02:00
js Bump dependency versions 2018-05-21 20:50:41 +00:00
jsoup Remove one last buck file from gerrit's core 2017-01-27 19:41:56 +00:00
log Acceptance tests: Replace embedded ES with docker testcontainer 2018-05-31 08:13:48 +09:00
lucene Acceptance tests: Replace embedded ES with docker testcontainer 2018-05-31 08:13:48 +09:00
mail Remove Buck based build 2017-01-23 12:44:58 +00:00
mime4j Remove Buck based build 2017-01-23 12:44:58 +00:00
mina Format lib/mina/BUILD with buildifier 2017-03-30 17:31:27 +09:00
openid Remove Buck based build 2017-01-23 12:44:58 +00:00
ow2 Remove Buck based build 2017-01-23 12:44:58 +00:00
polymer_externs Add transpilation to PolyGerrit 2017-05-15 17:00:01 +09:00
powermock Bazel: Fix powermock-core declaration 2017-01-24 23:31:15 +01:00
prolog Merge branch 'stable-2.14' 2017-05-17 19:48:49 +09:00
testcontainers Acceptance tests: Replace embedded ES with docker testcontainer 2018-05-31 08:13:48 +09:00
truth Optionally persist ChangeNotesCache 2018-05-18 11:17:49 -04:00
BUILD Move Truth rules to a subdirectory of lib 2018-05-16 14:20:06 -07:00
guava.bzl Upgrade guava to 25.1-jre 2018-05-25 09:52:36 +09:00
LICENSE-antlr Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-Apache1.1 Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-Apache2.0 Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-args4j Synchronize args4j license with upstream 2016-06-07 18:59:40 +00:00
LICENSE-asciidoctor Add correct license for asciidoctor 2016-08-19 04:05:06 +00:00
LICENSE-automaton Synchronize automaton license with upstream 2016-06-09 09:31:58 +00:00
LICENSE-ba-linkify Move ba-linkify.js to lib 2018-03-26 14:14:57 -04:00
LICENSE-bouncycastle Synchronize bouncy castle license with upstream 2016-06-10 06:31:21 +02:00
LICENSE-CC0-1.0 Add support for elliptic curve/ed25519 SSH keys 2017-03-28 15:26:29 +00:00
LICENSE-CC-BY3.0-unported Clarify that the CC-BY 3.0 license is the unported version 2016-09-21 11:19:22 +02:00
LICENSE-clippy Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-codemirror-minified Use a pre-built minified CodeMirror in the release build 2016-04-04 20:33:27 -04:00
LICENSE-codemirror-original Use a pre-built minified CodeMirror in the release build 2016-04-04 20:33:27 -04:00
LICENSE-diffy Diffy should use the unported CC-BY 3.0 license 2016-09-21 11:26:15 +02:00
LICENSE-DO_NOT_DISTRIBUTE Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-elasticsearch Elasticsearch: replace native API in prod w/ REST 2018-05-31 08:06:19 +09:00
LICENSE-es6-promise Add es6-promise for Internet Explorer 2016-09-13 15:14:32 +00:00
LICENSE-fetch Add fetch polyfill for use in all supported browsers 2016-03-03 23:49:18 -05:00
LICENSE-h2 Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-highlightjs Syntax highlighting 2016-07-25 13:47:30 -07:00
LICENSE-icu4j Adds the Soy library and injects it via EmailArguments 2016-08-22 09:45:33 -07:00
LICENSE-jgit Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-jsch Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-jsoup Add jsoup to Buck and Bazel 2016-11-16 01:24:59 +00:00
LICENSE-moment Recognize time format preferences. 2016-03-15 15:22:39 -07:00
LICENSE-MPL1.1 Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-OFL1.1 Serve fonts from Gerrit instead of Google Fonts. 2016-04-01 13:11:02 -04:00
LICENSE-ow2 Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-page.js Build bower_components with buck 2015-11-12 19:01:53 -05:00
LICENSE-polymer Build bower_components with buck 2015-11-12 19:01:53 -05:00
LICENSE-postgresql Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-prologcafe Update license text for PrologCafe 2013-05-13 09:44:25 -07:00
LICENSE-promise-polyfill Build bower_components with buck 2015-11-12 19:01:53 -05:00
LICENSE-protobuf Add dependency on the Google protocol buffer library 2013-09-10 15:59:25 -07:00
LICENSE-PublicDomain Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-silk_icons Synchronize license for silk icons 2016-09-21 11:04:46 +02:00
LICENSE-slf4j Build with Buck 2013-05-09 13:40:36 +00:00
LICENSE-testcontainers Acceptance tests: Replace embedded ES with docker testcontainer 2018-05-31 08:13:48 +09:00
LICENSE-xz Download commands: Add JGit archive 2014-03-03 23:34:46 +00:00