I have a complex log4j pattern with 14 tags, with the '-' character used as separator.
Unfortunately, the separator is not well chosen, as a tag can contain this separator
I can't change the log4j pattern, and I try to find a solution to fix this problem.
Here is my pattern :
Code: Select all
%d [%p] %t'-%mx{codeCentre}-%mx{loginUtilisateur}-%mx{idFournisseur}-%mx{energie}-%mx{numeroPdl}-%mx{service}-%mx{version}-(%c{1}.%M():%L) %m%n
1)
The tag containing the separator (loginUtilisateur) contain an email, so always with the '@' character. As the '-' is always on the first part of the email (before the @), I try to separate this tag in 2 with adding a @ as a separator like that :
Code: Select all
%d [%p] %t'-%mx{codeCentre}-%mx{loginUtilisateur}@%mx{loginUtilisateur2}-%mx{idFournisseur}-%mx{energie}-%mx{numeroPdl}-%mx{service}-%mx{version}-(%c{1}.%M():%L) %m%n
2)
Writing a new parser.
As my pattern is long and complex, I really don't want to rewrite all the parser!
I saw it's possible to call the LogMX parser to don't have to re-write the all parser (huge job!), but as classes are obfuscated to avoid a copy of LogMX code, I'm not sure it's a really confident solution. I don't know the class name to call, and it can change for the next LogMX release...
3)
Writing a new manager.
I thought writing a new simple manager to analyze each entry and replace the separator '-' in the tag "loginUtilisateur" submit the log to the parser.
My files are all local, and it will be the LocalFileManager with a kind of pre-code.
But I'm not sure I can do that in a manager...
For me, the most reliable solution seems 3) to write a new manager, but I'm not sure it's possible.
What do you think? Any idea?