Reputation: 139
Firstly must say, i cannot change my log4j.properties to log4j.xml or i cannot change my log4j version 1.x to 2.x due to some reasons. I need to ignore three exceptions for fileAppender i did two exceptions with stringfilter but it does not work third one. My Exception and property file is:
07 Apr 2017 | 11:45:26,499 | ERROR | SFSWorker:Ext:1 | Extensions | | EXCEPTION
com.smartfoxserver.v2.exceptions.SFSJoinRoomException: Join Error - Room is full: 19, Zone: { Zone: Batak } - Can't add User: ( User Name: d354e22339937548abb52ec442eb4eb4, Id: 3, Priv: 0, Sess: 88.253.243.151:33453 )
at com.smartfoxserver.v2.api.SFSApi.joinRoom(SFSApi.java:990)
My Property is:
log4j.appender.fileAppender.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.fileAppender.filter.1.stringToMatch=FORCE_UPDATE
log4j.appender.fileAppender.filter.1.acceptOnMatch=false
log4j.appender.fileAppender.filter.2=org.apache.log4j.varia.StringMatchFilter
log4j.appender.fileAppender.filter.2.stringToMatch=REGULAR_UPDATE
log4j.appender.fileAppender.filter.2.acceptOnMatch=false log4j.appender.consoleAppender.filter.3=org.apache.log4j.varia.StringMatchFilter
log4j.appender.consoleAppender.filter.3.stringToMatch=Room%20is%20full
log4j.appender.consoleAppender.filter.3.acceptOnMatch=false
I do not want to see exceptions that contains "Room is full" on my fileAppender. How can i do it?
Upvotes: 2
Views: 1365
Reputation: 997
If you can't change your configuration of log4j I think it will be difficult.
You can see answers of question log4j StringToMatch in property file
Properties files don't support filters. You'll have to switch to an XML configuration.
But check the Log4j version sometimes it works :
See comment for the answer https://stackoverflow.com/a/3960938/1811730
[EDIT]
Sorry, I did not read the question correctly :-(
Maybe the problem is %20
Have you tried without: log4j.appender.consoleAppender.filter.3.stringToMatch=Room is full
Upvotes: 1