diff --git a/.github/workflows/cmake.yaml b/.github/workflows/cmake.yaml index 0a5b383a8..043091e31 100644 --- a/.github/workflows/cmake.yaml +++ b/.github/workflows/cmake.yaml @@ -24,7 +24,8 @@ jobs: libpq-dev libmariadb-dev libsqlite3-dev \ libhiredis-dev \ libmongoc-dev \ - libmicrohttpd-dev + libmicrohttpd-dev \ + liblog4cplus-dev - uses: actions/checkout@v4 - name: Prometheus support run: | diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 389478623..4f991bd4a 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -39,7 +39,7 @@ jobs: SOURCE_DIR: ${{github.workspace}}\.cache\source TOOLS_DIR: ${{github.workspace}}\.cache\tools INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_${{matrix.triplet}}_${{matrix.BUILD_TYPE}} - VCPKGGITCOMMITID: acc3bcf76b84ae5041c86ab55fe138ae7b8255c7 + VCPKGGITCOMMITID: 0e47c1985273129e4d0ee52ff73bed9125555de8 VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b99ee182..0f4c46644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,11 +130,6 @@ install(FILES postinstall.txt DESTINATION doc/turnserver COMPONENT Runtime) -install(FILES examples/etc/turnserver.conf - DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} - COMPONENT Runtime - RENAME turnserver.conf.default - ) install(DIRECTORY examples DESTINATION share diff --git a/README.md b/README.md index 17aa3bda1..f6b3b8c4a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Optional - [Hiredis](https://github.com/redis/hiredis) (user database, monitoring) - SQLite (user database) - PostgreSQL (user database) +- [log4cplus](https://github.com/log4cplus/log4cplus) (log library) ### Building ```shell diff --git a/docs/Log.md b/docs/Log.md new file mode 100644 index 000000000..bdabb7ed3 --- /dev/null +++ b/docs/Log.md @@ -0,0 +1,345 @@ +# Log + +This project includes the following two types of log implementations: + +- Use a mature logging library. current use [log4cplus](https://github.com/log4cplus/log4cplus) +- The project is implemented on its own [Discarded] + +See: [Discussions](https://github.com/coturn/coturn/issues/1344) + +## Setup log4cplus + +- System distribution + - Ubuntu + + sudo apt install liblog4cplus-dev + +- Install from source code + - Download [source code](https://github.com/log4cplus/log4cplus) + + git clone https://github.com/log4cplus/log4cplus.git + + - Compile. See: https://github.com/log4cplus/log4cplus + + cd log4cplus + mkdir build + cd build + cmake .. + cmake --build . --traget install + +## Usage + +### Interface + +- TURN_LOG_CATEGORY(category, level, ...) +- TURN_LOG_FUNC(level, ...) : Discarded, please use TURN_LOG_CATEGORY + +### Log4cplus configure file + +[Example](../examples/etc/log.conf) + +- Appender + +|Appender |Description | +|:--------------------------:|:------------------:| +|ConsoleAppender |Ouput to console | +|SysLogAppender |Appends log events to a file. | +|NTEventLogAppender |Appends log events to NT EventLog. Only windows| +|FileAppender |Ouput to file | +|RollingFileAppender |Backup the log files when they reach a certain size| +|DailyRollingFileAppender |The log file is rolled over at a user chosen frequency| +|TimeBasedRollingFileAppender|The log file is rolled over at a user chosen frequency while also keeping in check a total maximum number of produced files. | +|SocketAppender |Output to a remote a log server.| +|Log4jUdpAppender |Sends log events as Log4j XML to a remote a log server. | +|AsyncAppender | | + +- Layout + +| Layout | Description | +|:-----------:|:-----------:| +|SimpleLayout |Simple layout| +|TTCCLayout | | +|PatternLayout|Pattern layout| + + - [PatternLayout](https://log4cplus.github.io/log4cplus/docs/log4cplus-2.1.0/doxygen/classlog4cplus_1_1PatternLayout.html#details) + + +The recognized conversion characters are + +
Conversion Character | +Effect | +
b | +Used to output file name component of path name. +E.g. main.cxx from path ../../main.cxx. | +
c | + +Used to output the logger of the logging event. The +logger conversion specifier can be optionally followed by +precision specifier, that is a decimal constant in +brackets. +If a precision specifier is given, then only the corresponding +number of right most components of the logger name will be +printed. By default the logger name is printed in full. +For example, for the logger name "a.b.c" the pattern +%c{2} will output "b.c". + + | +
d | + +Used to output the date of the logging event in UTC.
+
+The date conversion specifier may be followed by a date format
+specifier enclosed between braces. For example, %%d{%%H:%%M:%%s}
+or %%d{%%d %%b %%Y %%H:%%M:%%s}. If no date format
+specifier is given then %%d{%%d %%m %%Y %%H:%%M:%%s}
+is assumed.
+
+The Following format options are possible:
+
strftime() function
+found in the <ctime> header for more information.
+ |
+
D | + +Used to output the date of the logging event in local time. + +All of the above information applies. + | +
E | + +Used to output the value of a given environment variable. The +name of is supplied as an argument in brackets. If the variable does +exist then empty string will be used. + +For example, the pattern %E{HOME} will output the contents +of the HOME environment variable. + | +
F | + +Used to output the file name where the logging request was +issued. + +NOTE Unlike log4j, there is no performance penalty for +calling this method. | +
h | + +Used to output the hostname of this system (as returned +by gethostname(2)). + +NOTE The hostname is only retrieved once at +initialization. + + | +
H | + +Used to output the fully-qualified domain name of this +system (as returned by gethostbyname(2) for the hostname +returned by gethostname(2)). + +NOTE The hostname is only retrieved once at +initialization. + + | +
l | + +Equivalent to using "%F:%L" + +NOTE: Unlike log4j, there is no performance penalty for +calling this method. + + | +
L | + +Used to output the line number from where the logging request +was issued. + +NOTE: Unlike log4j, there is no performance penalty for +calling this method. + + |
m | +Used to output the application supplied message associated with +the logging event. | +
M | + +Used to output function name using
+__FUNCTION__ or similar macro.
+
+NOTE The __FUNCTION__ macro is not
+standard but it is common extension provided by all compilers
+(as of 2010). In case it is missing or in case this feature
+is disabled using the
+LOG4CPLUS_DISABLE_FUNCTION_MACRO macro, %M
+expands to an empty string. |
+
n | + +Outputs the platform dependent line separator character or +characters. + |
p | +Used to output the LogLevel of the logging event. | +
r | +Used to output miliseconds since program start +of the logging event. | +
t | + +Used to output the thread ID of the thread that generated +the logging event. (This is either `pthread_t` value returned +by `pthread_self()` on POSIX platforms or thread ID returned +by `GetCurrentThreadId()` on Windows.) | +
T | + +Used to output alternative name of the thread that generated the +logging event. | +
i | + +Used to output the process ID of the process that generated the +logging event. | +
x | + +Used to output the NDC (nested diagnostic context) associated +with the thread that generated the logging event. + | +
X | + +Used to output the MDC (mapped diagnostic context) +associated with the thread that generated the logging +event. It takes optional key parameter. Without the key +paramter (%%X), it outputs the whole MDC map. With the key +(%%X{key}), it outputs just the key's value. + | +
"%%" | +The sequence "%%" outputs a single percent sign. + | +