Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: Refactor logging code into a global object #12954

Merged
merged 6 commits into from
May 1, 2018
Merged

Conversation

jimpo
Copy link
Contributor

@jimpo jimpo commented Apr 11, 2018

This is purely a refactor with no behavior changes.

This creates a new class BCLog::Logger to encapsulate all global logging configuration and state.

@laanwj
Copy link
Member

laanwj commented Apr 12, 2018

Concept ACK, splitting the logging functionality out of util makes sense, util.cpp is large, haphazard and this is a clearly distinguishable concern from the rest.

@maflcko
Copy link
Member

maflcko commented Apr 13, 2018

Concept ACK. Needs rebase

Copy link
Member

@sipa sipa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

src/util.h Outdated
} \
} while(0)
#endif

template<typename... Args>
bool error(const char* fmt, const Args&... args)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should move to logging as well, so the cyclic dependency between logging and util can be avoided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LogPrintf is also used in TraceThread, and I don't think either of them actually belong in logging (the whole point of this PR is to create a more cohesive separation). I can very easily imagine another method that gets added to util.h in the future requiring logging as well.

The dependency isn't really cyclic -- logging.cpp includes util.h, and util.h includes logging.h, but logging.h does not include util.h.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My view is that you should always treat the .h and the .cpp file as one unit. While this may indeed not be a cyclic dependency for the compiler, it is certainly one between the two modules semantically: logging can't work without util, and util can't work without logging. Finding out why that is the case helps creating a cleaner separation.

You're right that util is going to depend on logging though, as it contains a number of higher level functions. However, It looks like logging only really needs util for finding the debug log path, though. All the rest is in utiltime. This seems easy to fix, by instead having init query the path and call a setter on logging for it for example. If other reviewers are fine with that, we can fix that up in another PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last I looked, when reviewing #13021, I saw another approach to solving the cyclic dependency is to include utiltime.h in logging.cpp and splitting out args and path handling from util.h. Didn’t go all the way to implementing that but would be happy to as a follow-on to #13021.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, didn’t finish reading your comment @sipa. Anyway I’m for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with d903273cf8e51d2789ba8a88c608a66e63dcdc14.

@maflcko
Copy link
Member

maflcko commented Apr 17, 2018

Needs rebase again. (Since this has some Concept ACKs, but is somewhat largish, it might be easier to merge in two steps. First the move-only commit in a separate pull request and then the refactoring in this pull request)

sipa added a commit that referenced this pull request Apr 20, 2018
…les.

b77b6e2 MOVEONLY: Move logging code from util.{h,cpp} to new files. (Jim Posen)

Pull request description:

  Split out first commit from #12954 to reduce amount of rebasing necessary.

  This introduces a cyclic dependency between `logging` and `util` that should be cleaned up in a future PR.

Tree-SHA512: 695e512f9c2f7b4ca65e367fc924358e3cb2dc531bcbb7a6f62710b2a87280b35aba7793aa272e457fcd65448abe3feb1deb3b8064ed208917ca356b0f410813
Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK d903273cf8e51d2789ba8a88c608a66e63dcdc14. Couple of comments inline but nothing to prevent merge.

* the timestamp when multiple calls are made that don't end in a
* newline.
*/
std::atomic_bool m_started_new_line{true};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this maintains the old (broken) behaviour:

  • two threads are running. Thread A logs a line that doesn't terminate with a newline (ie a 'continuing' log)
  • thread B then logs a line. This is treated as a 'continuation' log of thread A's previous log, and is printed on the same line, without a timestamp
  • thread A's 'continuation' log is printed on a new line, with a timestamp

No need to fix that in this PR.

extern bool fPrintToDebugLog;

extern bool fLogTimestamps;
extern bool fLogTimeMicros;
extern bool fLogIPs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit util: Establish global logger object. : any reason to exclude fLogIPs from g_logger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not actually used by the logger, it's just used in the net code. Arguably it should live there instead.

@@ -264,7 +259,7 @@ void BCLog::Logger::ShrinkDebugFile()
int nBytes = fread(vch.data(), 1, vch.size(), file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated nit: Could change int to size_t here, so that it doesn't break when someone changes RECENT_DEBUG_HISTORY_SIZE to 5GB.

Copy link
Member

@jamesob jamesob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK d903273

  • ./src/qt/bitcoin-qt -regtest -conf="$(pwd)/bitcoin.conf" -debug=1
    • Displays all available logs.
  • ./src/qt/bitcoin-qt -testnet -conf="$(pwd)/bitcoin.conf" -debug=0
    • Displays only uncategorized logs.
  • ./src/qt/bitcoin-qt -testnet -conf="$(pwd)/bitcoin.conf" -debug=1
    • Displays all available logs.
  • ./src/qt/bitcoin-qt -testnet -conf="$(pwd)/bitcoin.conf" -help
    • Displays available logging categories for -debug.
  • ./src/bitcoind -debug=foobar
    • Warns of invalid logging category.
  • ./src/bitcoind -debug=1 -debugexclude=net,addrman,rand,leveldb
    • Displays all available logs (confusing, but this matches behavior on master).
  • ./src/bitcoind -debugexclude=net,addrman,rand,leveldb
    • Excludes specified log categories.
  • ./src/bitcoind -testnet -config="$(pwd)/bitcoin.conf" -debug=reindex -reindex
    • Shows reindex-related log messages.
  • ./src/bitcoind -testnet -config="$(pwd)/bitcoin.conf" -debug=net -reindex
    • Shows no reindex-related log messages, but plenty of net-related ones.

Nice change. The one nit I had definitely shouldn't hold this up.

src/logging.cpp Outdated
flag = BCLog::ALL;
return true;
}
for (unsigned int i = 0; i < ARRAYLEN(LogCategories); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: seems like you could phrase this more simply as

for (CLogCategoryDesc& cat : LogCategories) { ... }

There doesn't seem to be a need to have the index on hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, fixed. Also gets rid of the dependency of logging on utilstrencodings.

Jim Posen added 3 commits April 27, 2018 16:09
The object encapsulates logging configuration, and in a later commit,
set up routines will also be moved into the class.
Jim Posen added 3 commits April 29, 2018 14:37
Changing parameter types from pointers to references and uint32_t to
BCLog::LogFlags simplies calling code.
-BEGIN VERIFY SCRIPT-
sed -i "s/fileout/m_fileout/" src/logging.h src/logging.cpp
sed -i "s/mutexDebugLog/m_file_mutex/" src/logging.h src/logging.cpp
sed -i "s/vMsgsBeforeOpenLog/m_msgs_before_open/" src/logging.h src/logging.cpp
sed -i "s/logCategories/m_categories/" src/logging.h src/logging.cpp
sed -i "s/fPrintToConsole/m_print_to_console/" src/logging.h src/logging.cpp src/init.cpp
sed -i "s/fPrintToDebugLog/m_print_to_file/" src/logging.h src/logging.cpp src/init.cpp src/test/test_bitcoin.cpp src/bench/bench_bitcoin.cpp
sed -i "s/fLogTimestamps/m_log_timestamps/" src/logging.h src/logging.cpp src/init.cpp
sed -i "s/fLogTimeMicros/m_log_time_micros/" src/logging.h src/logging.cpp src/init.cpp
sed -i "s/fReopenDebugLog/m_reopen_file/" src/logging.h src/logging.cpp src/init.cpp
sed -i "s/fStartedNewLine/m_started_new_line/" src/logging.h src/logging.cpp
-END VERIFY SCRIPT-
This breaks the cyclic between logging and util.
@jnewbery
Copy link
Contributor

utACK 8c2d695. Only difference is changing to range based for loops per #12954 (comment)

@sipa
Copy link
Member

sipa commented May 1, 2018

utACK 8c2d695. Nice to see this encapsulated.

@sipa sipa merged commit 8c2d695 into bitcoin:master May 1, 2018
sipa added a commit that referenced this pull request May 1, 2018
8c2d695 util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317 util: Refactor GetLogCategory. (Jim Posen)
3316a9e util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fc util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
@jimpo jimpo deleted the logging branch May 1, 2018 05:34
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 25, 2019
Summary:
PR10150:
7fd50c3 allow libevent logging to be updated during runtime (John Newbery)
5255aca [rpc] Add logging RPC (John Newbery)
4d9950d Set BCLog::LIBEVENT correctly for old libevent versions. (John Newbery)

Tree-SHA512: d6788a7205372c0528da71eca052910dfb055f2940ca884f422ff3db66e23a2b49c6a15b8f27d5255554fe5c5a928f5dd903fdc63b0bd6c8fa7783e77bb30fe8

Our logging code was refactored some time ago in a way that looks a lot like Core PR12954. Functionally, however, we are still behind in comparison to Core when their refactor occurred. That has made this backport very complicated. I have made comments on each change that directly link to the PR it was backported from to assist in review. As mentioned in the summary, some changes had to be modified to bridge the gap between the state of Core's logging code before and after the refactor in PR12954.

Backport of Core PR10150:
bitcoin/bitcoin#10150

As is, Core's logging code as seen in PR10150 is incompatible with our own logging code.  I Also pulled the `EnableOrDisableLogCategories()` function and the updated libevent filter code and `Logger::GetCategoryMask()` function from Core PR12954 which is a refactor of Core's logging code that makes it more closely mirror our own.
bitcoin/bitcoin#12954

Test Plan:
  make check
  ./bitcoind

  ./bitcoin-cli help
`logging` rpc should not show up in the list of commands.

  ./bitcoin-cli help logging
This should display `logging` rpc help

  ./bitcoin-cli logging
This should display the list of logging options all set to false (default).

  ./bitcoin-cli logging "[\"all"\"]
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to true if your libevent version is at or above v2.1.1.  Otherwise, every option except libevent will be set to true.
The second line should cause the logger to write some extra debug information to the `debug.log` file.

  ./bitcoin-cli logging "[]" "[\"all\"]"
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to false again.
The second line should cause the logger to revert back to its original logging behavior, outputting no extra logging information to `debug.log`.

  ./bitcoin-cli logging "[\"libevent"\"]
If your version of libevent is below v2.1.1, you should receive an error stating `libevent logging cannot be updated when using libevent before v2.1.1.`  If your libevent is version is at or above 2.1.1, then it should proceed as normal.  Tested by changing line 431 in httpserver.cpp from `#if LIBEVENT_VERSION_NUMBER >= 0x02010100` to `#if LIBEVENT_VERSION_NUMBER < 0x02010100`.

Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3464
Fuzzbawls added a commit to PIVX-Project/PIVX that referenced this pull request Apr 14, 2020
5c8e968 [Trivial] Document logtimemicros flag in the help (random-zebra)
4daa10a util: Store debug log file path in BCLog::Logger member. (random-zebra)
2f03e85 scripted-diff: Rename BCLog::Logger member variables. (random-zebra)
303700e util: Refactor GetLogCategory. (random-zebra)
0ae18c0 util: Encapsulate logCategories within BCLog::Logger. (random-zebra)
a2fb3fd util: Move debug file management functions into Logger. (random-zebra)
5a42d82 util: Establish global logger object. (random-zebra)
15c0da4 [Refactor] Complete boost::filesystem namespace in util (random-zebra)
81ddbf4 MOVEONLY: Move logging code from util.{h,cpp} to new files. (random-zebra)

Pull request description:

  Implemented on top of:
  - [x] #1449
  - [x] #1437
  - [x] #1439
  - [x] #1450
  - [x] #1451
  - [x] #1455

  This creates a new class BCLog::Logger to encapsulate all global logging configuration and state.

  Adapted from
  - bitcoin#13021
  - bitcoin#12954

ACKs for top commit:
  Fuzzbawls:
    ACK 5c8e968
  furszy:
    utACK 5c8e968

Tree-SHA512: 0b10a031dd7e32b48485236fbdd8249d011049e6f99e1df145b7dea4cab9e6e67e19d1bb13ff48e99eb2487a8399bbb8298fe851ad8873416fc1053aee0379bc
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 18, 2020
… new files.

b77b6e2 MOVEONLY: Move logging code from util.{h,cpp} to new files. (Jim Posen)

Pull request description:

  Split out first commit from bitcoin#12954 to reduce amount of rebasing necessary.

  This introduces a cyclic dependency between `logging` and `util` that should be cleaned up in a future PR.

Tree-SHA512: 695e512f9c2f7b4ca65e367fc924358e3cb2dc531bcbb7a6f62710b2a87280b35aba7793aa272e457fcd65448abe3feb1deb3b8064ed208917ca356b0f410813
Signed-off-by: pasta <pasta@dashboost.org>

# Conflicts:
#	src/Makefile.am
#	src/util.cpp
#	src/util.h
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 19, 2020
… new files.

b77b6e2 MOVEONLY: Move logging code from util.{h,cpp} to new files. (Jim Posen)

Pull request description:

  Split out first commit from bitcoin#12954 to reduce amount of rebasing necessary.

  This introduces a cyclic dependency between `logging` and `util` that should be cleaned up in a future PR.

Tree-SHA512: 695e512f9c2f7b4ca65e367fc924358e3cb2dc531bcbb7a6f62710b2a87280b35aba7793aa272e457fcd65448abe3feb1deb3b8064ed208917ca356b0f410813
Signed-off-by: pasta <pasta@dashboost.org>

# Conflicts:
#	src/Makefile.am
#	src/util.cpp
#	src/util.h
jonspock pushed a commit to jonspock/devault that referenced this pull request Oct 1, 2020
Summary:
PR10150:
7fd50c3 allow libevent logging to be updated during runtime (John Newbery)
5255aca [rpc] Add logging RPC (John Newbery)
4d9950d Set BCLog::LIBEVENT correctly for old libevent versions. (John Newbery)

Tree-SHA512: d6788a7205372c0528da71eca052910dfb055f2940ca884f422ff3db66e23a2b49c6a15b8f27d5255554fe5c5a928f5dd903fdc63b0bd6c8fa7783e77bb30fe8

Our logging code was refactored some time ago in a way that looks a lot like Core PR12954. Functionally, however, we are still behind in comparison to Core when their refactor occurred. That has made this backport very complicated. I have made comments on each change that directly link to the PR it was backported from to assist in review. As mentioned in the summary, some changes had to be modified to bridge the gap between the state of Core's logging code before and after the refactor in PR12954.

Backport of Core PR10150:
bitcoin/bitcoin#10150

As is, Core's logging code as seen in PR10150 is incompatible with our own logging code.  I Also pulled the `EnableOrDisableLogCategories()` function and the updated libevent filter code and `Logger::GetCategoryMask()` function from Core PR12954 which is a refactor of Core's logging code that makes it more closely mirror our own.
bitcoin/bitcoin#12954

Test Plan:
  make check
  ./bitcoind

  ./bitcoin-cli help
`logging` rpc should not show up in the list of commands.

  ./bitcoin-cli help logging
This should display `logging` rpc help

  ./bitcoin-cli logging
This should display the list of logging options all set to false (default).

  ./bitcoin-cli logging "[\"all"\"]
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to true if your libevent version is at or above v2.1.1.  Otherwise, every option except libevent will be set to true.
The second line should cause the logger to write some extra debug information to the `debug.log` file.

  ./bitcoin-cli logging "[]" "[\"all\"]"
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to false again.
The second line should cause the logger to revert back to its original logging behavior, outputting no extra logging information to `debug.log`.

  ./bitcoin-cli logging "[\"libevent"\"]
If your version of libevent is below v2.1.1, you should receive an error stating `libevent logging cannot be updated when using libevent before v2.1.1.`  If your libevent is version is at or above 2.1.1, then it should proceed as normal.  Tested by changing line 431 in httpserver.cpp from `#if LIBEVENT_VERSION_NUMBER >= 0x02010100` to `#if LIBEVENT_VERSION_NUMBER < 0x02010100`.

Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3464
jonspock pushed a commit to jonspock/devault that referenced this pull request Oct 5, 2020
Summary:
PR10150:
7fd50c3 allow libevent logging to be updated during runtime (John Newbery)
5255aca [rpc] Add logging RPC (John Newbery)
4d9950d Set BCLog::LIBEVENT correctly for old libevent versions. (John Newbery)

Tree-SHA512: d6788a7205372c0528da71eca052910dfb055f2940ca884f422ff3db66e23a2b49c6a15b8f27d5255554fe5c5a928f5dd903fdc63b0bd6c8fa7783e77bb30fe8

Our logging code was refactored some time ago in a way that looks a lot like Core PR12954. Functionally, however, we are still behind in comparison to Core when their refactor occurred. That has made this backport very complicated. I have made comments on each change that directly link to the PR it was backported from to assist in review. As mentioned in the summary, some changes had to be modified to bridge the gap between the state of Core's logging code before and after the refactor in PR12954.

Backport of Core PR10150:
bitcoin/bitcoin#10150

As is, Core's logging code as seen in PR10150 is incompatible with our own logging code.  I Also pulled the `EnableOrDisableLogCategories()` function and the updated libevent filter code and `Logger::GetCategoryMask()` function from Core PR12954 which is a refactor of Core's logging code that makes it more closely mirror our own.
bitcoin/bitcoin#12954

Test Plan:
  make check
  ./bitcoind

  ./bitcoin-cli help
`logging` rpc should not show up in the list of commands.

  ./bitcoin-cli help logging
This should display `logging` rpc help

  ./bitcoin-cli logging
This should display the list of logging options all set to false (default).

  ./bitcoin-cli logging "[\"all"\"]
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to true if your libevent version is at or above v2.1.1.  Otherwise, every option except libevent will be set to true.
The second line should cause the logger to write some extra debug information to the `debug.log` file.

  ./bitcoin-cli logging "[]" "[\"all\"]"
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to false again.
The second line should cause the logger to revert back to its original logging behavior, outputting no extra logging information to `debug.log`.

  ./bitcoin-cli logging "[\"libevent"\"]
If your version of libevent is below v2.1.1, you should receive an error stating `libevent logging cannot be updated when using libevent before v2.1.1.`  If your libevent is version is at or above 2.1.1, then it should proceed as normal.  Tested by changing line 431 in httpserver.cpp from `#if LIBEVENT_VERSION_NUMBER >= 0x02010100` to `#if LIBEVENT_VERSION_NUMBER < 0x02010100`.

Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3464
jonspock pushed a commit to devaultcrypto/devault that referenced this pull request Oct 10, 2020
Summary:
PR10150:
7fd50c3 allow libevent logging to be updated during runtime (John Newbery)
5255aca [rpc] Add logging RPC (John Newbery)
4d9950d Set BCLog::LIBEVENT correctly for old libevent versions. (John Newbery)

Tree-SHA512: d6788a7205372c0528da71eca052910dfb055f2940ca884f422ff3db66e23a2b49c6a15b8f27d5255554fe5c5a928f5dd903fdc63b0bd6c8fa7783e77bb30fe8

Our logging code was refactored some time ago in a way that looks a lot like Core PR12954. Functionally, however, we are still behind in comparison to Core when their refactor occurred. That has made this backport very complicated. I have made comments on each change that directly link to the PR it was backported from to assist in review. As mentioned in the summary, some changes had to be modified to bridge the gap between the state of Core's logging code before and after the refactor in PR12954.

Backport of Core PR10150:
bitcoin/bitcoin#10150

As is, Core's logging code as seen in PR10150 is incompatible with our own logging code.  I Also pulled the `EnableOrDisableLogCategories()` function and the updated libevent filter code and `Logger::GetCategoryMask()` function from Core PR12954 which is a refactor of Core's logging code that makes it more closely mirror our own.
bitcoin/bitcoin#12954

Test Plan:
  make check
  ./bitcoind

  ./bitcoin-cli help
`logging` rpc should not show up in the list of commands.

  ./bitcoin-cli help logging
This should display `logging` rpc help

  ./bitcoin-cli logging
This should display the list of logging options all set to false (default).

  ./bitcoin-cli logging "[\"all"\"]
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to true if your libevent version is at or above v2.1.1.  Otherwise, every option except libevent will be set to true.
The second line should cause the logger to write some extra debug information to the `debug.log` file.

  ./bitcoin-cli logging "[]" "[\"all\"]"
  ./bitcoin-cli getbestblockhash
  check debug.log
The first line should output the list of logging options all set to false again.
The second line should cause the logger to revert back to its original logging behavior, outputting no extra logging information to `debug.log`.

  ./bitcoin-cli logging "[\"libevent"\"]
If your version of libevent is below v2.1.1, you should receive an error stating `libevent logging cannot be updated when using libevent before v2.1.1.`  If your libevent is version is at or above 2.1.1, then it should proceed as normal.  Tested by changing line 431 in httpserver.cpp from `#if LIBEVENT_VERSION_NUMBER >= 0x02010100` to `#if LIBEVENT_VERSION_NUMBER < 0x02010100`.

Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3464
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request May 21, 2021
8c2d695 util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317 util: Refactor GetLogCategory. (Jim Posen)
3316a9e util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fc util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request May 25, 2021
8c2d695 util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317 util: Refactor GetLogCategory. (Jim Posen)
3316a9e util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fc util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
TheArbitrator pushed a commit to TheArbitrator/dash that referenced this pull request Jun 4, 2021
8c2d695 util: Store debug log file path in BCLog::Logger member. (Jim Posen)
8e7b961 scripted-diff: Rename BCLog::Logger member variables. (Jim Posen)
1eac317 util: Refactor GetLogCategory. (Jim Posen)
3316a9e util: Encapsulate logCategories within BCLog::Logger. (Jim Posen)
6a6d764 util: Move debug file management functions into Logger. (Jim Posen)
f55f4fc util: Establish global logger object. (Jim Posen)

Pull request description:

  This is purely a refactor with no behavior changes.

  This creates a new class `BCLog::Logger` to encapsulate all global logging configuration and state.

Tree-SHA512: b34811f54a53b7375d7b6f84925453c6f2419d21179379ee28b3843d0f4ff8e22020de84a5e783453ea927e9074e32de8ecd05a6fa50d7bb05502001aaed8e53
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 30, 2021
… new files.

b77b6e2 MOVEONLY: Move logging code from util.{h,cpp} to new files. (Jim Posen)

Pull request description:

  Split out first commit from bitcoin#12954 to reduce amount of rebasing necessary.

  This introduces a cyclic dependency between `logging` and `util` that should be cleaned up in a future PR.

Tree-SHA512: 695e512f9c2f7b4ca65e367fc924358e3cb2dc531bcbb7a6f62710b2a87280b35aba7793aa272e457fcd65448abe3feb1deb3b8064ed208917ca356b0f410813
Signed-off-by: pasta <pasta@dashboost.org>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants