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

Use a mature logging library #1344

Open
KangLin opened this issue Dec 7, 2023 · 10 comments
Open

Use a mature logging library #1344

KangLin opened this issue Dec 7, 2023 · 10 comments

Comments

@KangLin
Copy link
Contributor

KangLin commented Dec 7, 2023

The current logs do not meet the requirements. Continuing to reinvent the wheel is a waste of resources. It is recommended to use a mature logging library. For example:

Although they are C++ libraries, they are easy to apply to this project. Only the macro needs to be rewritten TURN_LOG_FUNC

@jelmd
Copy link
Contributor

jelmd commented Dec 7, 2023

IMHO not a good idea to pull in C++ things, unless they are completely standalone, i.e. do not require libstdc++, etc. Aren't there any pure C alternatives?

@KangLin
Copy link
Contributor Author

KangLin commented Dec 7, 2023 via email

@jelmd
Copy link
Contributor

jelmd commented Dec 7, 2023

They are completely standalone.

OK, just checked Ubuntu 20.04 because Ubuntu is IMHO a late adopter, i.e. if a certain package/version is there, probably all other distrOS have it, too.

In my java life I used log4j in 2000+ and later (~2006) slf4j + logback. Yes, great. But not sure, whether it is a little bit too much overhead. Anyway, whatever you choose, please make sure, that we can use the version/package the vendor ships for the related distros.

I've only used these two C++ logging libraries. So let's discuss it here. - pure C: - log4c: But it doesn't seem to be maintained.

I'm not coding in C++ at all, so can't really contribute much to this.

zlog

Never heard about it. Looks like that there is no vendor package for Ubuntu 20.04+.

Everyone knows which logging libraries?

@KangLin
Copy link
Contributor Author

KangLin commented Dec 8, 2023

I looked at the source code, log4cplus provides a C interface 😄
https://github.com/log4cplus/log4cplus/blob/REL_1_1_2/include/log4cplus/clogger.h

logging-log4cxx does not provide a C interface 😢

In my java life I used log4j in 2000+ and later (~2006) slf4j + logback. Yes, great. But not sure, whether it is a little bit too much overhead. Anyway, whatever you choose, please make sure, that we can use the version/package the vendor ships for the related distros.

Stability and performance have been verified in practice.

@KangLin
Copy link
Contributor Author

KangLin commented Dec 8, 2023

@coturn @eakraly @ggarber
TODO:

  • Log interface

    • #define TURN_LOG_CATEGORY(category, level, ...)
      The newly added one can display logs by category
    • #define TURN_LOG_FUNC(level, ...)
      Stay compatible
    • void* turn_log_init();
    • void turn_log_clean(void*);
    • int turn_log_set_conf_file(const char* file);
  • Log libraries

    • mature pure c log libraries. Please recommend the mature C logging library.
    • log4cplus
  • The current log is frozen

KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 18, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 19, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
KangLin added a commit to KangLin/coturn that referenced this issue Dec 20, 2023
@KangLin
Copy link
Contributor Author

KangLin commented Dec 21, 2023

Use log4cplus #1351

@pwilczynskiclearcode
Copy link

Is there a way to set loglevel of coturn so it displays only warnings and errors? Current INFO-level is really verbose?
Or do we need to wait for the library change so it's possible?

@KangLin
Copy link
Contributor Author

KangLin commented Jan 18, 2024

@pwilczynskiclearcode
The current log of coturn can set loglevel in command lien or configure file.
But the maintainability of the current logs is bad.

@KangLin
Copy link
Contributor Author

KangLin commented Jan 18, 2024

@eakraly
In O&M, the function of output to the log server is very important too.
I've compared known C logging libraries and all of them are missing this feature.

@jelmd
Copy link
Contributor

jelmd commented Jan 18, 2024

@pwilczynskiclearcode I've running an instance since mid of December: the main log contains 1-2K lines per week, only - and these are just the connection logs like 2024-01-17 23:25:55.610058 (18732): INFO: new session 000000000910 tid: 0 rsid: 1: local 123.45.67.89:443, remote 987.654.321.09:53562. I use the metric enhanced coturn (PR #1343) compiled with export TURN_NO_PQ=1 TURN_NO_MYSQL=1 TURN_NO_MONGO=1 TURN_NO_HIREDIS=1 (because no-one needs it on our site). It has connection logging turned off by default (and thus is almost a no-op log), but allows one to enable it by ip-log option. FWIW: my related settings are:

# Verbose Mode: verbose .. moderate verbose, Verbose .. extra verbose
#verbose
# enable prometheus metrics
prom
prom-compact
prom-sid
prom-sid-retain = 30
log-ip
# Log to a single filename (rather than new log files each startup).
log-file=/var/log/coturn.log
simple-log
new-log-timestamp
new-log-timestamp-format="%F %T.%N"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants