Skip to content

Commit 17b6663

Browse files
authored
Improve Linux SysLog Support (#3)
Updates the Linux logging story so that it can collect all the same logs as Windows (now including the ETW events). Also adds some info as to how to collect logs for a repro.
1 parent 41c63b3 commit 17b6663

File tree

7 files changed

+405
-352
lines changed

7 files changed

+405
-352
lines changed

BUILD.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\S
2828

2929
- Run `..\artifacts\bin\Release\msquictest.exe`
3030

31+
### Collecting logs
32+
33+
- To start a trace, run `netsh trace start overwrite=yes report=dis correlation=dis traceFile=quic.etl maxSize=1024 provider={ff15e657-4f26-570e-88ab-0796b258d11c} level=0x5`
34+
- Run the repro.
35+
- To stop the trace, run `netsh trace stop`
36+
- To decode the `quic.etl` file, run **TODO**
37+
3138
## Building on Linux (or [WSL](https://docs.microsoft.com/en-us/windows/wsl/wsl2-install))
3239

3340
- Run `mkdir bld && cd bld`
@@ -37,3 +44,12 @@ reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\S
3744
### Running the tests
3845

3946
- Run `../artifacts/bin/msquictest`
47+
48+
### Collecting logs
49+
50+
On Linux, MsQuic uses [syslog](http://man7.org/linux/man-pages/man3/syslog.3.html) for logging by default. To view the logs:
51+
52+
- On **WSL**, run `sudo service rsyslog start` to make sure syslog is configured.
53+
- **Optionally**, run `sudo truncate -s 0 /var/log/syslog` to clear out the current log file.
54+
- Run the repro.
55+
- You can view the logs from the `/var/log/syslog` file.

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
4646
set(QUIC_CXX_FLAGS "${QUIC_C_FLAGS}")
4747
else()
4848
# Custom build flags.
49-
set(QUIC_C_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_STUB -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -pthread")
50-
set(QUIC_CXX_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_STUB -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-reorder -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-format --std=c++0x -g -pthread")
49+
set(QUIC_C_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_SYSLOG -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -pthread")
50+
set(QUIC_CXX_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_SYSLOG -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-reorder -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-format --std=c++0x -g -pthread")
5151
endif()
5252

5353
include_directories(${CMAKE_SOURCE_DIR}/inc)

core/inline.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,3 +621,8 @@ QuicConnGetDestCidFromSeq(
621621
_In_ QUIC_VAR_INT SequenceNumber,
622622
_In_ BOOLEAN RemoveFromList
623623
);
624+
625+
uint8_t
626+
QuicPacketTraceType(
627+
_In_ const QUIC_SENT_PACKET_METADATA* Metadata
628+
);

inc/quic_platform_dispatch.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,33 +66,11 @@ void
6666
typedef
6767
void
6868
(*QUIC_LOG)(
69-
_In_ QUIC_LOG_LEVEL Level,
70-
_In_ const char* File,
71-
_In_ int Line,
72-
_In_ const char* Func,
69+
_In_ QUIC_TRACE_LEVEL Level,
7370
_In_ const char* Fmt,
7471
_In_ va_list args
7572
);
7673

77-
typedef
78-
void
79-
(*QUIC_LOG_ASSERT)(
80-
_In_z_ const char* File,
81-
_In_ int Line,
82-
_In_z_ const char* Func,
83-
_In_z_ const char* Expr
84-
);
85-
86-
typedef
87-
void
88-
(*QUIC_TRACE_LOGGING_WRITE)(
89-
_In_ const char* EventName,
90-
_In_ const char* File,
91-
_In_ int Line,
92-
_In_ const char* Func
93-
);
94-
95-
9674
typedef
9775
QUIC_RECV_DATAGRAM*
9876
(*QUIC_DATAPATH_RECVCONTEXT_TO_RECVBUFFER)(

inc/quic_trace.h

Lines changed: 291 additions & 164 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)