Commit Graph

43 Commits

Author SHA1 Message Date
moneromooo-monero 96e6b43970
blockchain_stats: don't use gmtime_r on Windows
In some cases, it doesn't like it (I don't know the details).

Factor into a new epee function
2018-11-21 00:50:53 +00:00
iDunk5400 2e2daebcc9
ANSI colors in Windows 10 2018-10-08 14:56:16 +02:00
Riccardo Spagni effcbf2060
Merge pull request #4459
bcf3f6af fuzz_tests: catch unhandled exceptions (moneromooo-monero)
3ebd05d4 miner: restore stream flags after changing them (moneromooo-monero)
a093092e levin_protocol_handler_async: do not propagate exception through dtor (moneromooo-monero)
1eebb82b net_helper: do not propagate exceptions through dtor (moneromooo-monero)
fb6a3630 miner: do not propagate exceptions through dtor (moneromooo-monero)
2e2139ff epee: do not propagate exception through dtor (moneromooo-monero)
0749a8bd db_lmdb: do not propagate exceptions in dtor (moneromooo-monero)
1b0afeeb wallet_rpc_server: exit cleanly on unhandled exceptions (moneromooo-monero)
418a9936 unit_tests: catch unhandled exceptions (moneromooo-monero)
ea7f9543 threadpool: do not propagate exceptions through the dtor (moneromooo-monero)
6e855422 gen_multisig: nice exit on unhandled exception (moneromooo-monero)
53df2deb db_lmdb: catch error in mdb_stat calls during migration (moneromooo-monero)
e67016dd blockchain_blackball: catch failure to commit db transaction (moneromooo-monero)
661439f4 mlog: don't remove old logs if we failed to rename the current file (moneromooo-monero)
5fdcda50 easylogging++: test for NULL before dereference (moneromooo-monero)
7ece1550 performance_test: fix bad last argument calling add_arg (moneromooo-monero)
a085da32 unit_tests: add check for page size > 0 before dividing (moneromooo-monero)
d8b1ec8b unit_tests: use std::shared_ptr to shut coverity up about leaks (moneromooo-monero)
02563bf4 simplewallet: top level exception catcher to print nicer messages (moneromooo-monero)
c57a65b2 blockchain_blackball: fix shift range for 32 bit archs (moneromooo-monero)
2018-09-29 22:20:38 +02:00
moneromooo-monero 4d52ec0ca4
mlog: do not display http errors by default
They're controllable by potential attackers and would just spam
2018-09-14 09:23:00 +00:00
moneromooo-monero 262e391fb1
mlog: handle filenames without parent directories
eg, --log-file=foo.log

This would otherwise throw and crash with a stack overflow
2018-07-26 22:49:54 +01:00
luigi1111 c0c6102260
Merge pull request #3972
8766528 epee: fallback to a counter if gmtime fails when rotating logs (moneromooo-monero)
2018-06-25 15:21:25 -05:00
stoffu 63d0ab09b5
mlog: --max-log-files to set the max number of rotated log files 2018-06-13 12:44:27 +09:00
moneromooo-monero 87665281ea
epee: fallback to a counter if gmtime fails when rotating logs 2018-06-09 19:23:48 +01:00
moneromooo-monero 18c2f6e21d
mlog: fix setting no logs 2018-04-25 20:42:11 +01:00
moneromooo-monero 38c8f4e0a3
mlog: terminate a string at last char, just in case 2017-12-18 15:15:16 +00:00
moneromooo-monero 09ce03d612
move includes around to lessen overall load 2017-12-16 22:46:38 +00:00
moneromooo-monero bc1b93333e
frob level 1 logs a bit for consistency
Level 1 logs map to INFO, so setting log level to 1 should
show these. Demote some stuff to DEBUG to avoid spam, though.
2017-10-07 20:03:42 +01:00
Riccardo Spagni 3bab2676ec
Merge pull request #2512
792ba4f0 Log categories can now be added to and removed from (moneromooo-monero)
48f92eb6 easylogging++: add categories getter (moneromooo-monero)
f35afe62 epee: factor log level/categories setting (moneromooo-monero)
2017-10-02 23:28:59 +04:00
moneromooo-monero 792ba4f0fe
Log categories can now be added to and removed from
Also, set_log without parameters now prints the log categories
2017-09-22 18:08:14 +01:00
moneromooo-monero f35afe62a4
epee: factor log level/categories setting 2017-09-22 14:14:58 +01:00
selsta 91def9a59b daemon, wallet: add --max-log-file-size option 2017-09-17 04:42:45 +02:00
moneromooo-monero cb2d5110ff
Tweak net logs so we get more info on why networking can't start
This should prevent "silent" failures to start
2017-08-15 19:49:25 +01:00
Riccardo Spagni b76ba219d9
Merge pull request #2189
335fc8ab mlog: fix crash accessing stale data when rotating logs (moneromooo-monero)
2017-08-07 15:25:46 +02:00
moneromooo-monero 599436a452
mlog: default to msgwriter logs only for log level 1
There might be privacy issues doing it by default
2017-07-24 10:34:52 +01:00
moneromooo-monero 335fc8ab23
mlog: fix crash accessing stale data when rotating logs 2017-07-22 19:15:44 +01:00
Riccardo Spagni 4014f31a73
Merge pull request #2173
a02d7458 mlog: make MONERO_LOGS env var understand N,logs type spec (moneromooo-monero)
2017-07-19 11:51:50 +02:00
moneromooo-monero a02d745844
mlog: make MONERO_LOGS env var understand N,logs type spec 2017-07-15 10:23:24 +01:00
moneromooo-monero 9706938016
mlog: add msgwriter:INFO to log 0 and 1 defaults
This ensures command output gets logged by default
2017-07-06 13:18:04 +01:00
stoffu dd8e3266b2
shared libs build (i.e. make debug) 2017-05-17 10:17:08 +09:00
moneromooo-monero 62efe5f656
mlog: direct log category changes to file only
Because some people just won't even try to read what is written
and freak out because the word FATAL is in here, despite the
context making it clear it's not an error.
2017-04-01 11:29:43 +01:00
moneromooo-monero 0effe196e4
Revert "Increase the log level for the info about log levels"
We want to know which log categories are active.

This reverts commit 4f7bce6d20.
2017-03-19 09:39:28 +00:00
Riccardo Spagni e10bf1d6c0
Merge pull request #1805
b7f85a30 mlog: default net.cn to FATAL (moneromooo-monero)
2017-03-03 14:12:21 +02:00
moneromooo-monero b7f85a30cd
mlog: default net.cn to FATAL
Errors in this layer depend on how peers behave, and thus errors
are expected
2017-02-26 11:02:05 +00:00
Nano Akron 4f7bce6d20
Increase the log level for the info about log levels 2017-02-25 14:58:18 +00:00
moneromooo-monero 56586bde9e
mlog: restrict net.p2p to FATAL by default 2017-02-21 17:37:03 +00:00
moneromooo-monero 4bf7849297
mlog: only silence errors for net by default, not net.* 2017-02-20 22:58:29 +00:00
moneromooo-monero 3b6839cc96
mlog: move log level changes to global level
Makes it more likely to show up
2017-02-12 11:45:22 +00:00
moneromooo-monero 28d0b11fde
mlog: s/Mew/New/ in log 2017-02-12 11:35:04 +00:00
Riccardo Spagni 9547e79af5
Merge pull request #1670
c3d7a198 mlog: probable fix for gmtime_r not being available on windows (moneromooo-monero)
2017-02-04 17:28:23 +02:00
moneromooo-monero cbdfa7576a
mlog: fix default logging being not verbose enough 2017-02-04 12:43:19 +00:00
moneromooo-monero c3d7a198bf
mlog: probable fix for gmtime_r not being available on windows 2017-02-04 11:48:58 +00:00
moneromooo-monero 1e8cc6764e
mlog: allow using numerical level as default prefix
eg, 2,foo:ERROR,bar:INFO
2017-01-22 16:54:17 +00:00
Riccardo Spagni cccf4b9889
Merge pull request #1613
13dd102e mlog: fix default level/category mapping (moneromooo-monero)
2017-01-22 11:50:04 -05:00
Riccardo Spagni e12f073f65
Merge pull request #1604
a854cec3 Make stack trace show up in log file with default settings (moneromooo-monero)
2017-01-22 11:41:38 -05:00
moneromooo-monero 13dd102e94
mlog: fix default level/category mapping
It was not matching the LOG_PRINT_Lx mapping for 2/3/4
2017-01-22 15:20:55 +00:00
moneromooo-monero a854cec3ba
Make stack trace show up in log file with default settings 2017-01-21 20:28:18 +00:00
moneromooo-monero 5e61687fdf
mlog: allow overriding log format
using the MONERO_LOG_FORMAT environment variable.

Default is:
%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg

Field list in easylogging++ documentation.

Don't forget to escape as needed.
2017-01-16 19:43:00 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00