logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Deboy <scott.de...@gmail.com>
Subject Re: ExpressionFilter parse error with "&&"
Date Fri, 26 Nov 2010 19:40:38 GMT
In XML, less than, greater than, quote, apostrophe and ampersand all need to
be escaped..

& escaped with &amp;
< escaped with &lt;
> escaped with &gt;
" escaped with &quot;
' escaped with &apos;

        <param name="Expression" value="LEVEL >= WARN && MSG ~= test123"/>

Becomes

        <param name="Expression" value="LEVEL >= WARN &amp;&amp; MSG ~=
test123"/>

Scott

On Fri, Nov 26, 2010 at 11:04 AM, Tech Newbie <technb@yahoo.com> wrote:

> I am using ExpressionFilter to filter out an ERROR event with the text
> "test123".  However, I'm getting a XML SAXParseException:
> The entity name must immediately follow the '&' in the entity reference.
>
>       <filter class="org.apache.log4j.filter.ExpressionFilter">
>         <param name="Expression" value="LEVEL >= WARN && MSG ~= test123"/>
>         <param name="AcceptOnMatch" value="false"/>
>       </filter>
>
> This works if I only have <param name="Expression" value="MSG ~= test123"/>
> but not when I add the LEVEL condition.
>
>
> I have in my classpath:
> apache-log4j-extras-1.1.jar, log4j-1.2.16.jar, jakarta-oro-2.0.8.jar
>
> What's wrong?
>
> ==============================================
>
>     [java] log4j:ERROR Could not parse url [resource:jboss-log4j.xml].
>      [java] org.xml.sax.SAXParseException: The entity name must immediately
> follow the '&' in the entity reference.
>      [java]     at org.apache.xerces.parsers.DOMParser.parse(Unknown
> Source)
>      [java]     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
> Source)
>      [java]     at
> org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:767)
>      [java]     at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:866)
>      [java]     at
>  org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:773)
>      [java]     at
> org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:901)
>      [java]     at
> org.jboss.logging.Log4jService$URLWatchTimerTask.reconfigure(Log4jService.java:643)
>      [java]     at
> org.jboss.logging.Log4jService$URLWatchTimerTask.run(Log4jService.java:582)
>      [java]     at
> org.jboss.logging.Log4jService.setup(Log4jService.java:460)
>      [java]     at
> org.jboss.logging.Log4jService.createService(Log4jService.java:476)
>      [java]     at
> org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
>      [java]     at
>
>  org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>      [java]     at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>      [java]     at
>
>  org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>      [java]     at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>      [java]     at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>      [java]     at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>      [java]     at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>      [java]     at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>      [java]     at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
>      [java]     at $Proxy0.create(Unknown
>  Source)
>      [java]     at
> org.jboss.system.ServiceController.create(ServiceController.java:330)
>      [java]     at
> org.jboss.system.ServiceController.create(ServiceController.java:273)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>      [java]     at
>  org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>      [java]     at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>      [java]     at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>      [java]     at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>      [java]     at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>      [java]     at $Proxy4.create(Unknown Source)
>      [java]     at
> org.jboss.deployment.SARDeployer.create(SARDeployer.java:258)
>      [java]     at
> org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
>      [java]     at
>  org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
>      [java]     at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>      [java]     at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at
>
>  org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>      [java]     at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>      [java]     at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>      [java]     at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>      [java]     at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>      [java]     at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>      [java]     at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>      [java]     at
>  org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>      [java]     at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>      [java]     at $Proxy5.deploy(Unknown Source)
>      [java]     at
> org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
>      [java]     at
> org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
>      [java]     at org.jboss.Main.boot(Main.java:200)
>      [java]     at org.jboss.Main$1.run(Main.java:508)
>      [java]     at java.lang.Thread.run(Thread.java:595)
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message