You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Priya Ahuja <pr...@gmail.com> on 2015/09/10 20:38:32 UTC

Custom Markers

Hi,

I am currently using log4j2.0 and I have implemented Marker (SYSLOG_MARKER)
for deciding the destination of a log to be localfile log or syslog. But
with this approach all the existing logs in the system (~5000) will need
manual decision and addition of marker to every single log. Is there a
better way to filter logs at INFO level? I don't want to introduce a new
level.


        <Root level="INFO">
            <AppenderRef ref="RFC5424">
                <filters>
                    <MarkerFilter marker="SYSLOG" onMatch="ACCEPT"
onMismatch="DENY"/>
                </filters>
            </AppenderRef>
            <AppenderRef ref="LOGFILE"/>
        </Root>

Thanks,
Priya Ahuja

Re: Custom Markers

Posted by Ralph Goers <ra...@dslextreme.com>.
Gee whiz, that wasn’t very clear.  Let’s try again.

Without modifying the code the only way I can think of to filter the events is to find something within the message itself to filter on.  If you can add the marker only to the events you want routed then the configuration you have below will work. You can also create a special logger just for logging the events that are to be routed.  However, both of those require that code be modified.

Ralph

> On Sep 10, 2015, at 2:40 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> If I understand you correctly, you have an existing application that logs events in about 5000 different places, so you don’t want to have to modify that code.
> 
> Without modifying the code the only way to filter the events is on somehow  find something wiithin the message itself. If you can add the marker only to the message you want routed.
> 
> Ralph
> 
> 
>> On Sep 10, 2015, at 11:38 AM, Priya Ahuja <pr...@gmail.com> wrote:
>> 
>> Hi,
>> 
>> I am currently using log4j2.0 and I have implemented Marker (SYSLOG_MARKER)
>> for deciding the destination of a log to be localfile log or syslog. But
>> with this approach all the existing logs in the system (~5000) will need
>> manual decision and addition of marker to every single log. Is there a
>> better way to filter logs at INFO level? I don't want to introduce a new
>> level.
>> 
>> 
>>       <Root level="INFO">
>>           <AppenderRef ref="RFC5424">
>>               <filters>
>>                   <MarkerFilter marker="SYSLOG" onMatch="ACCEPT"
>> onMismatch="DENY"/>
>>               </filters>
>>           </AppenderRef>
>>           <AppenderRef ref="LOGFILE"/>
>>       </Root>
>> 
>> Thanks,
>> Priya Ahuja
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Custom Markers

Posted by Ralph Goers <ra...@dslextreme.com>.
If I understand you correctly, you have an existing application that logs events in about 5000 different places, so you don’t want to have to modify that code.

Without modifying the code the only way to filter the events is on somehow  find something wiithin the message itself. If you can add the marker only to the message you want routed.

Ralph


> On Sep 10, 2015, at 11:38 AM, Priya Ahuja <pr...@gmail.com> wrote:
> 
> Hi,
> 
> I am currently using log4j2.0 and I have implemented Marker (SYSLOG_MARKER)
> for deciding the destination of a log to be localfile log or syslog. But
> with this approach all the existing logs in the system (~5000) will need
> manual decision and addition of marker to every single log. Is there a
> better way to filter logs at INFO level? I don't want to introduce a new
> level.
> 
> 
>        <Root level="INFO">
>            <AppenderRef ref="RFC5424">
>                <filters>
>                    <MarkerFilter marker="SYSLOG" onMatch="ACCEPT"
> onMismatch="DENY"/>
>                </filters>
>            </AppenderRef>
>            <AppenderRef ref="LOGFILE"/>
>        </Root>
> 
> Thanks,
> Priya Ahuja



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org