How to Build Tencent's Mars XLog from Source for 16K Alignment and Custom Log Formats
Android's requirement for 16 KB page alignment breaks prebuilt native libraries that haven't been recompiled. Building XLog from the latest branch fixes that incompatibility and unlocks log-format customization that the frozen release never exposed.
The official Mars XLog release is stuck on version 1.3.0, missing 16K page alignment for .so files and offering no way to customize log output. The repository's `release/android/2024-t2.1` branch, however, contains recent commits and can be built successfully with NDK r29, Python 3.14, and CMake 4.2. Three build-script edits fix stale NDK paths, suppress deprecation warnings that new CMake treats as errors, and remove three unresolvable symbols from the linker export file.
Once compiled, the resulting `mars_xlog_sdk` module drops directly into an Android project as a library or an AAR. The real payoff of a source build is the ability to edit the log header, per-line prefix, and console output format by modifying `appender.cc`, `formater.cc`, and `ConsoleLog.cc` respectively. The walkthrough includes the exact ProGuard rules needed to keep the JNI layer intact.
Mars XLog remains a viable high-performance logger despite its abandoned release page; the active branch shows that internal maintenance continued inside WeChat.
Most build failures when reviving old C++ Android libraries trace to three predictable issues: NDK path drift, stricter compiler warnings in modern CMake, and stale symbol exports.
Customizing log formats at the native layer is a rare capability that most logging libraries don't expose, making a source build of XLog unusually valuable for teams with specific log-pipeline requirements.