RewritePolicy and RewriteAppender are included in the log4j receivers
companion (source only currently).

On Fri, Oct 7, 2011 at 1:45 PM, Scott Deboy <[email protected]> wrote:

> <appender name="F1" class="org.apache.log4j.FileAppender">
>        <param name="file" value="c:/temp/file.txt"/>
>        <param name="append" value="false"/>
>        <layout class="org.apache.log4j.PatternLayout">
>          <param name="ConversionPattern" value="%p %c - p1:%X{p1} p2:%X{p2} 
> %m%n"/>
>        </layout>
>      </appender>
>
>
>      <appender name="A1" class="org.apache.log4j.rewrite.RewriteAppender">
>        <appender-ref ref="F1"/>
>        <rewritePolicy class="org.apache.log4j.rewrite.PropertyRewritePolicy">
>          <param name="properties" value="p1=Hello,p2=World,x1=3.1415"/>
>        </rewritePolicy>
>      </appender>
>
>    <root>
>       <level value="debug"/>
>        <appender-ref ref="A1" />
>     </root>
>
>
> You implement your own RewritePolicy and define its class in place of the
> 'PropertyRewritePolicy' and modify the loggingEvent in the rewrite method of
> the RewritePolicy implementation..
>
> Scott
>
>
> On Fri, Oct 7, 2011 at 1:21 PM, aanjaneya shukla <
> [email protected]> wrote:
>
>> Can you please guide me to any examples, it would be lot quicker.
>>
>> Thanks,
>> Aanjaneya
>>
>> On Fri, Oct 7, 2011 at 8:28 PM, Scott Deboy <[email protected]>
>> wrote:
>> > Yes it is possible to modify log messages before they are sent to an
>> > appender. Use a rewriteappender, implement you own rewritepolicy, and
>> > include an appender-ref to the destination appender in the
>> rewriteappender
>> > definition along with the rewritepolicy.
>> >
>> > Scott
>> >
>> >
>> >
>> > On Oct 7, 2011, at 7:37 AM, aanjaneya shukla <[email protected]
>> >
>> > wrote:
>> >
>> >> Hi,
>> >>
>> >> To avoid log injection by newline charters, is it possible to modify
>> >> the contents of user defined messages in the log files? I want to
>> >> black list certain charters defined in the property file its with
>> >> adding any code to my framework.
>> >>
>> >> Thanks,
>> >> Aanjaneya.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

Reply via email to