Filter log by conversion pattern [%t]

59
June 13, 2019, at 2:50 PM

I am using the log4j2 version 2.11.1. I have the below pattern in log4j2.xml
"%d %-5r %-5p [%t] [%x] [%c] [%M] [%L] - %m%n".
I want to filter the logs on [%t]
I tried RegexFilter=".Coherence." and ThreadContextMapFilter. Filter is not working.

<Configuration xmlns="http://logging.apache.org/log4j/2.0/config" status="DEBUG"> <Properties> <Property name="basePath">../Log4j2Example/logs</Property> </Properties> <Appenders> <!-- File Appender --> <File name="FILE" fileName="${basePath}/logfile.log" append="true" > <PatternLayout pattern="%d %-5r %-5p [%t] [%x] [%c] [%M] [%L] - %m%n" /> <RegexFilter regex=".*Cohernce.*" useRawMsg="true" onMatch="DENY" onMismatch="ACCEPT"/> </File> <File name="STRINGFILE" fileName="${basePath}/logfileAA.log" append="true" > <PatternLayout pattern="%d %-5r %-5p [%t] [%x] [%c] [%M] [%L] - %m%n" /> <RegexFilter regex=".*Cohernce.*" onMatch="ACCEPT" useRawMsg="true" onMismatch="DENY"/> </File> </Appenders> <Loggers> <Logger name="com.jcg.logging" level="debug" additivity="false"> <AppenderRef ref="FILE" /> <AppenderRef ref="STRINGFILE" /> </Logger> <Logger name="com.jcg.logging" level="debug" additivity="false"> <AppenderRef ref="FILEA"/> <AppenderRef ref="STRINGFILE" /> </Logger> <Root level="DEBUG"> <AppenderRef ref="STDOUT" /> </Root> </Loggers> </Configuration>

2019-06-12 10:41:06,262 486977 DEBUG [Coherence:BaseCacheService2Worker:0] [[]] [com.test.logging.Aggregator] [aggregate] [46] - Inside aggregate method-START 2019-06-12 10:41:06,263 486979 DEBUG [Serivee:Coherence:BaseCacheService2Worker] [[]] [com.test.abc.xyz] [XXX] [246] - Inside method -START

Any line contains the Coherence should be redirected to log4j2 Appenders "STRINGFILE"

READ ALSO
Different deserialization behavior between Java 8 and Java 11

Different deserialization behavior between Java 8 and Java 11

I have a problem with deserialization in Java 11 that results in a HashMap with a key that can't be foundI would appreciate if anyone with more knowledge about the issue could say if my proposed solution looks ok, or if there is something better I could do

40
UDP-Java Socket how can I exceed args.length &gt; 2 to test how robust the client server connection is?

UDP-Java Socket how can I exceed args.length > 2 to test how robust the client server connection is?

I tried to enter a different IntetAdress object with googlede before it was initialized to null, which does not make a difference in output

51
Saving the output of array permutations into a 2D array

Saving the output of array permutations into a 2D array

I am trying to save the permutation result of an array into a 2d arraylet's say I have an array {1,2,3,4}, I created a 2D array with rows: N! and columns 4

37