Commit Graph

22 Commits

Author SHA1 Message Date
Avi Kivity
fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00
Avi Kivity
a55b434a2b treewide: extent copyright statements to present day 2021-06-06 19:18:49 +03:00
Avi Kivity
576e33149f Merge seastar upstream
* seastar 0083ee8...85ca12d (1):
  > Merge "Run-time logging configuration" from Jesse

Includes patch from Jesse:

"Switch to Seastar for logging option handling

In addition to updating the abstraction layer for Seastar logging in `log.hh`,
the configuration system (`db/config.{hh,cc}`) has been updated in two ways:

- The string-map type for Boost.program_options is now defined in Seastar.

- A configuration value can be marked as `UsedFromSeastar`. This is like `Used`,
  except the option is expected to be defined in the Boost.Program_options
  description for Seastar. If the option is not defined in Seastar, or it is
  defined with a different type, then a run-time exception is thrown early in
  Scylla's initialization. This is necessary because logging options which are
  now defined in Seastar were previously defined in Scylla and support for these
  options in the YAML file cannot be dropped. In order to be able to verify that
  options marked `UsedFromSeastar` are actually defined in Seastar, the
  interface for adding options to `db::config` has changed from taking a
  `boost::program_options::options_description_easy_init` (which is handle into
  a `boost::program_options::options_description` which only allows adding
  options) to taking a `boost::program_options::options_description`
  directly (which also allows querying existing options).

Scylla also fully defers to Seastar's support for run-time logging
configuration."

Signed-off-by: Jesse Haber-Kucharsky <jhaberku@scylladb.com>
Message-Id: <ef26cffb91bef1ae95d508187a6dd861a6c4fc84.1503344007.git.jhaberku@scylladb.com>
2017-08-27 13:11:33 +03:00
Avi Kivity
d2e4548b35 Merge seastar upstream
* seastar 0bcdd28...864d6dc (4):
  > Logging framework
  > Add libubsan and libasan to fedora deps docs
  > tests: add rpc cancellable tests
  > rpc: add cancellable interface

Dropped logging implementation in favor of seastar's due to a link
conflict with operator<<.
2016-06-01 18:28:42 +03:00
Calle Wilund
443af44f24 log: Add output operator for std::exception&/std::system_error& 2016-04-18 13:51:15 +00:00
Paweł Dziepak
c1cffd0639 log: try to report logger failure
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-04-11 23:54:47 +01:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Paweł Dziepak
8f78b8e190 log: ignore logging exceptions
Logging is used in many places including those that shouldn't really
throw any exceptions (destructors, noexcept functions).

Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-03-31 16:43:32 +01:00
Tomasz Grabiec
d7b403db1f log: Change default level from warn to info
Logging at 'warn' level leaves us with too silent logs, not as helpful
as they could be in case of failure.

Message-Id: <1452283669-11675-1-git-send-email-tgrabiec@scylladb.com>
2016-01-09 09:24:22 +02:00
Amnon Heiman
521d9b62dd Add a level_name function to logger
This is a helper function that returns a log level name. It will be used
by the API to report the log levels.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-19 14:59:54 +03:00
Gleb Natapov
510ed4a1a0 Fix operator<< for std::exception_ptr to receive reference to an object 2015-10-15 17:14:50 +03:00
Gleb Natapov
d53be0a91e Move operator<< for std::exception_ptr to std namespace and make it get const
If the operator is not in std namespace it cannot be found in non global
contexts.
2015-09-27 14:16:35 +03:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Tomasz Grabiec
eec76b1f2c log: Introduce logger::is_enabled(log_level) 2015-07-28 11:31:08 +02:00
Avi Kivity
91d8d46709 logger: support for syslog()
Note that while syslog() may block, we still call it synchronously via
the reactor thread.  Anything else would make logging a nightmare.
2015-07-15 16:20:37 +03:00
Avi Kivity
5b7e283451 logger: provide lexical_cast support for log_level
A boost bug prevents automatic generation, so help it.
2015-07-14 18:16:19 +03:00
Avi Kivity
99a15de9e5 logger: de-thread_local-ize logger
The logger class constructor registers itself with the logger registry,
in order to enable dynamically setting log levels.  However, since
thread_local variables may be (and are) initialized at the time of first
use, when the program starts up no loggers are registered.

Fix by making loggers global, not thread_local.  This requires that the
registry use locking to prevent registration happening on different threads
from corrupting the registry.

Note that technically global variables can also be initialized at the
point of first use, and there is no portable way for classes to self-register.
However this is the best we can do.
2015-07-14 17:18:11 +03:00
Avi Kivity
a0cb90fe67 logger: add API to convert log_level to/from iostream 2015-07-14 15:33:02 +03:00
Avi Kivity
6ef552ef34 logger: add registry APIs to manage loggers 2015-07-14 15:19:14 +03:00
Avi Kivity
c065623da5 logger: add APIs to set and retrieve the log level 2015-07-14 14:48:53 +03:00
Nadav Har'El
e88b7e3453 logging: conveniently log exception
This patch adds an output operator overload for std::exception_ptr, to
make it easy to log a caught exception. It always shows the exception's
exact type, and for some types of exceptions (subtypes of std::system_error
and std::exception) it prints more information.

For example, the code

  try {
    throw std::runtime_error("Hello world");
  } catch (...) {
    sstlog.warn("Exception: {}", std::current_exception());
  }

produces the output:
  Exception when deleting sstable file: std::runtime_error (Hello world)

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-30 11:23:01 +03:00
Avi Kivity
0362800e8d log: add slf4j-compatible logger class
Supports variadic logging with placeholders, e.g.

  logger.error("what happened? x = {}, y = {}", x, y);

Instantiate loggers as static thread_local, e.g.

  class foo {
      static thread_local logging::logger logger;
  };

  thread_local logging::logger foo::logger{logging::logger_for<foo>};
2014-12-29 17:09:41 +02:00