logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saibabu Vallurupalli <saibabu.vallurupa...@gmail.com>
Subject Re: Help with rewrite appender
Date Thu, 23 Jan 2014 17:54:12 GMT
While I am debugging the issue, I moved my properties from log4j.properties
file to log4j.xml file. Now, it is trying to load all the properties and
failing at:
log4j:WARN Continuable parsing error 25 and column 82
log4j:WARN Element type "rewritePolicy" must be declared.
og4j:WARN Continuable parsing error 26 and column 73

I have seen few others also got this issue and I don't see any proper
response coming back.

Please help me.

Thank you,
Sai


On Thu, Jan 23, 2014 at 10:29 AM, Saibabu Vallurupalli <
saibabu.vallurupalli@gmail.com> wrote:

> Hi Good morning.
>
> I am trying to implement Rewrite Appender logic and based on my other
> conversations I understood the way I am doing below, But still I am unable
> to control certain messages.
>
> My Policy class is:
> ***************
> @Override
>     public LoggingEvent rewrite(LoggingEvent source) {
>         String msgToInspect = source.getMessage().toString();
>         if (null != msgToInspect && msgToInspect.contains("///")) {
>             return null;
>         }
>
>         return new LoggingEvent(source.getFQNOfLoggerClass(),
>                 source.getLogger(), source.getTimeStamp(),
> source.getLevel(),
>                 source.getMessage(), source.getThreadName(),
>                 source.getThrowableInformation(), source.getNDC(),
>                 source.getLocationInformation(), source.getProperties());
>     }
> ***************
>
> My log4j.properties file I configured these lines:
> log4j.appender.rewrite = org.apache.log4j.rewrite.RewriteAppender
> log4j.appender.rewrite.appender-ref = R, C
> log4j.appender.rewrite.rewritePolicy =
> gov.hhs.fha.nhinc.log4j.policy.CONNECTLog4jRewritePolicy
>
> where R is RollingFileAppender and C is ConsoleAppender. Based on my logic
> above. I do not want to print the lines having /// slashes in the log
> message. But I am still seeing those log statements.
>
> Am I missing anything here? Please advise.
>
> Thank you,
> Sai
>

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