It would be easy if that piece of code were mine, but it is from another
library so I cannot modify. I also found out that one of the libraries in
my project has been fixed so that slf4 outputs to sdk4loggeradpater(JUL)
and there is where logger.info("JSR 356 Mapping path {}",  "/{path}");
passes the message formated to log4j2 JUL LoggerManager as "JSR 356 Mapping
path /{path}" and log4j tries to reformat . Maybe log4j-jul should auto
scape the messages recived from JUL or not throw a format exception or auto
scape on exception and retry to format.

On Sat, Jul 4, 2015, 21:14 Remko Popma <remko.po...@gmail.com> wrote:

> Interesting.
>
> Your app uses the java.util.logging API. These classes use MessageFormat
> ("...{0}...{1}...") for parameters.
>
> Your code: logger.info("JSR 356 Mapping path {}",  "/{path}");
> causes MessageFormat to throw an IllegalArgumentException: can't parse
> argument number: path
>
> The first part ("JSR 356 Mapping path {}") is missing an index number, but
> perhaps the argumentIndex is optional for MessageFormat.
>
> However, it looks like the parameter ("/{path}") itself is also parsed as a
> MessageFormat pattern.
>
> You can fix this by escaping the curly braces. According to the
> MessageFormat docs everything in single quotes is interpreted literally, so
> "/'{path}'" will not be interpreted as a pattern but as a literal string.
>
> So, try this:
>  logger.info("JSR 356 Mapping path {}",  "/'{path}'");
>
>
>
> On Sun, Jul 5, 2015 at 4:18 AM, Jose Luis Valencia <
> jvalen...@rocoto.com.pe>
> wrote:
>
> > This is the call stack:
> > at
> >
> org.apache.logging.log4j.spi.AbstractLogger.<init>(AbstractLogger.java:133)
> >   at org.apache.logging.log4j.core.Logger.<init>(Logger.java:68)
> >   at
> >
> >
> org.apache.logging.log4j.core.async.AsyncLogger.<init>(AsyncLogger.java:211)
> >   at
> >
> >
> org.apache.logging.log4j.core.async.AsyncLoggerContext.newInstance(AsyncLoggerContext.java:53)
> >   at
> >
> >
> org.apache.logging.log4j.core.LoggerContext.getLogger(LoggerContext.java:299)
> >   at
> >
> >
> org.apache.logging.log4j.core.LoggerContext.getLogger(LoggerContext.java:56)
> > B>>>>  at
> >
> >
> org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:37)<<<<<<<<<B
> >   at
> >
> >
> org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:31)
> >   at
> >
> >
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
> >   at
> org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
> >   at java.util.logging.LogManager.demandLogger(LogManager.java:551)
> >   at java.util.logging.Logger.demandLogger(Logger.java:455)
> >   at java.util.logging.Logger.getLogger(Logger.java:502)
> >   at
> >
> >
> com.vaadin.external.org.slf4j.impl.JDK14LoggerFactory.getLogger(JDK14LoggerFactory.java:72)
> >   - locked <0x12d9> (a
> > com.vaadin.external.org.slf4j.impl.JDK14LoggerFactory)
> >   at
> >
> >
> com.vaadin.external.org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
> >   at
> >
> >
> com.vaadin.external.org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
> > A >>>>>>  at
> >
> >
> org.atmosphere.container.JSR356AsyncSupport.<clinit>(JSR356AsyncSupport.java:34)
> > <<<<<<<<<<A
> >   at
> >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeConstructorAccessorImpl.java:-1)
> >   at
> >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> >   at
> >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >   at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
> >   at
> >
> >
> org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:246).....
> > ....................
> >
> > that logger is initialized in A, and CoreLoggerAdapter(
> >
> >
> http://logging.apache.org/log4j/2.x/log4j-jul/apidocs/org/apache/logging/log4j/jul/CoreLoggerAdapter.html
> > )
> > calls in B context.getLogger(name, MESSAGE_FACTORY) where
> MESSAGE_FACTORY =
> > new MessageFormatMessageFactory(),
> >
> > On Fri, 3 Jul 2015 at 21:41 Remko Popma <remko.po...@gmail.com> wrote:
> >
> > > That logger (used in logger.info("JSR 356 Mapping path {}",
> > > servletPath);),
> > > can you check where/how it is created? The error indicates you are
> using
> > a
> > >
> >
> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/MessageFormatMessageFactory.html
> > >
> > > while the "{}" for parameters can only be used with the default
> > >
> >
> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/message/ParameterizedMessageFactory.html
> > >
> > > Sent from my iPhone
> > >
> > > > On 2015/07/04, at 3:54, Jose Luis Valencia <jvalen...@rocoto.com.pe>
> > > wrote:
> > > >
> > > > logger.info("JSR 356 Mapping path {}", servletPath);
> > >
> >
>

Reply via email to