Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望每次当 log4cxx 创建新的日志文件时,它都会在日志文件的顶部(作为第一条消息)写入特殊字符串。
我怎么能强迫它这样做?
谢谢你!
您可以从创建布局log4cxx::PatternLayout并重新实现,创建文件时从(通过)appendHeader()调用此函数。log4cxx::FileAppender::setFile()log4cxx::WriterAppender::writeHeader()
log4cxx::PatternLayout
appendHeader()
log4cxx::FileAppender::setFile()
log4cxx::WriterAppender::writeHeader()