[ https://issues.apache.org/jira/browse/LOGCXX-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553966#comment-17553966 ]
Michael Gibbs commented on LOGCXX-556: -------------------------------------- Thanks for looking into that - sorry I didn't respond earlier, I was on vacation. I don't think I'll be able to easily test until this is in a release, but I'm happy for this to be closed. > Debug assertion in runtime library when logging string larger than > MaxMessageLength and using a SyslogAppender > -------------------------------------------------------------------------------------------------------------- > > Key: LOGCXX-556 > URL: https://issues.apache.org/jira/browse/LOGCXX-556 > Project: Log4cxx > Issue Type: Bug > Components: Appender > Affects Versions: 0.12.1 > Environment: Windows MSVC 17.2.2 x86 > Reporter: Michael Gibbs > Assignee: Robert Middleton > Priority: Minor > Attachments: image-2022-06-01-13-24-05-356.png, > image-2022-06-01-13-30-25-208.png, image-2022-06-01-13-31-27-072.png > > > I upgraded from log4cxx 0.10.0.1 to 0.12.1.0 on Windows and get this debug > assertion when logging a string larger than the MaxMessageLength using a > SyslogAppender. > In Release mode the string is logged correctly and split up into multiple log > messages of length MaxMessageLength. > !image-2022-06-01-13-24-05-356.png! > !image-2022-06-01-13-30-25-208.png! > !image-2022-06-01-13-31-27-072.png! > Version 0.12.1 built in x86 with vcpkg on Windows using Visual Studio 2022 > 17.2.2. 0.13.0 is not yet available from vcpkg but I can't see any commits > that would change this behaviour. > Code to reproduce: > {code:java} > #include "log4cxx/logger.h" > #include "log4cxx/xml/domconfigurator.h" > int main(void) > { > log4cxx::xml::DOMConfigurator::configure("log4cxx.xml"); > log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("main")); > LOG4CXX_ERROR(logger, "aaaaaaaa"); > auto rootlogger = log4cxx::Logger::getRootLogger(); > auto appender = rootlogger->getAppender(LOG4CXX_STR("ASYNC")); > > if (appender != nullptr) > { > appender->close(); > } > }{code} > > log4cxx.xml > {code:java} > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> > <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> > > <appender name="SYSLOG" class="org.apache.log4j.SyslogAppender"> > <param name="Threshold" value="INFO" /> > <param name="SysLogHost" value="localhost" /> > <param name="Facility" value="DAEMON" /> > <param name="MaxMessageLength" value="10" /> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="%d %-5p - %m%n" /> > </layout> > </appender> > > <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> > <param name="BufferSize" value="500"/> > <param name="Blocking" value="true"/> > <param name="LocationInfo" value="true"/> > <appender-ref ref="SYSLOG"/> > </appender> > > <root> > <level value="INFO"/> > <appender-ref ref="ASYNC" /> > </root> > </log4j:configuration>{code} > The workaround is to increase MaxMessageLength as much as necessary. > -- This message was sent by Atlassian Jira (v8.20.7#820007)