I'm working on a custom layout to mask sensitive information in our production 
logs.
One of the key features is to use regular expressions - so i need the syntax of 
logback.xml to support the special characters in regex - including $.
I have searched high and low with google - and read the source a bit.  but it 
looks like there is no mechanism to escape this character.
Here is a fragment of my config file: 
...       <layout class="log.PIIFilterLayout">          
<pattern>:%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg %n</pattern>    
      <!-- adhoc patterns -->
          <regex>mdn='(.+)'</regex>          <regex>accountName=(.+)$</regex>...
I have tried:   - $  - \$  - \\$  - &#36; No matter what - i get this: 
Failed to instantiate [ch.qos.logback.classic.LoggerContext]Reported 
exception:java.lang.IllegalArgumentException: Failed to parse input 
[accountName=(.+)\\$] at 
ch.qos.logback.core.util.OptionHelper.substVars(OptionHelper.java:119) at 
ch.qos.logback.core.joran.spi.InterpretationContext.subst(InterpretationContext.java:159)
 at 
ch.qos.logback.core.joran.action.NestedBasicPropertyIA.body(NestedBasicPropertyIA.java:87)
 at 
ch.qos.logback.core.joran.spi.Interpreter.callBodyAction(Interpreter.java:295) 
at ch.qos.logback.core.joran.spi.Interpreter.characters(Interpreter.java:175) 
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:57) at 
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
 at 
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
 at 
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
 at 
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
 at 
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
 at 
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
 at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at 
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55) at 
org.slf4j.LoggerFactory.bind(LoggerFactory.java:129) at 
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) at 
org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302) at 
org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276) at 
util.LogFactory.getLogger(LogFactory.java:27) at 
log.PIITest.<clinit>(PIITest.java:20)Caused by: 
ch.qos.logback.core.spi.ScanException: Unexpected end of pattern string

How can i escape $ in logback.xml?
Paul

_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to