I have migrated from log4j 1.2.17 to log4j 2.2. and I'm getting the following issues:
My AsyncLogger is working like a sync one. This is my config for this logger:
<RollingFile name="ACCESS_LOG" fileName="${sys:log.dir}vproxy_access.${date:yyyy-MM-dd}" filePattern="${sys:log.dir}vproxy_access.${date:yyyy-MM-dd}" append="true" bufferedIO="true" bufferSize="8192" immediateFlush="false"> <PatternLayout> <Pattern>%m%d{yyyy-MM-dd HH:mm:ss}%n </PatternLayout> <Policies/> </RollingFile>
<AsyncLogger name="LOGGER_ACCESS" level="info" includeLocation="true" additivity="false"> <AppenderRef ref="ACCESS_LOG"/> </AsyncLogger>
The log creation is correct but everything I log to this file is not buffered and the lines are committed immediately. I've been compared my config with others I've seen in other posts and I can't see what's wrong.
- When I shutdown my application, now I'm getting the following error:
Exception in thread "pool-1-thread-1" java.lang.NoClassDefFoundError: org/apache/logging/log4j/message/ParameterizedMessage at org.apache.logging.log4j.message.ParameterizedMessageFactory.newMessage(ParameterizedMessageFactory.java:47) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:737) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:708) at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:314) at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:77) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.message.ParameterizedMessage at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) ... 6 more
When this error appears I'm not logging anything. The last line I log is shown correctly in its corresponding log.
- When logging to a file with a sync logger, strange characters occasionally appear. See below "^[[?1;2c^[[?1;2c" (this didn't happen with 1.2.17).
2015-04-02 13:58:51 Starting messaging service ...
^[[?1;2c^[[?1;2c2015-04-02 13:59:06 Messaging service successfully started.
2015-04-02 13:59:06 Starting balancer test port ...
2015-04-02 13:59:06 Balancer test port successfully started.
Thanks in advance.
Joan.