[ 
https://issues.apache.org/jira/browse/LOG4J2-2454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16629662#comment-16629662
 ] 

Lipeng edited comment on LOG4J2-2454 at 9/27/18 2:08 AM:
---------------------------------------------------------

Yes, I want create a custom Alarm Appender and a custom Alarm Filter. The 
filter define more attributes, all the filter attributes will be used by the 
layout. LogEvent contextData is readonly, no any place can pass the attributes 
between log4j2 components. Like the config above, we will generate the follow 
log message.

when match the filter

    <Alarm>
             <resolver>[email protected]</resolver>
             <subject>title1</subject>
             <priority>1</priority>
             <expression>^hello.*</expression>
       </Alarm>

the follow message will be log to file

{[email protected]|mailto:[email protected]] subject=title1 
priority=1 message=log massage }

when match 

      <Alarm>
            <resolver>[email protected]</resolver>
            <subject>title2</subject>
            <priority>1</priority>
            <logLevel>error</logLevel>
        </Alarm>

the follow message will be log to file

{[email protected]|mailto:[email protected]] subject=title2 
priority=1 message=log massage }

So, I hope that LogEvent has such a feature that users can pass data between 
log4j2 components.

thanks


was (Author: teclick):
Yes, I want create a custom Alarm Appender and a custom Alarm Filter. The 
filter define more attributes, all the filter attributes will be used by the 
layout. LogEvent contextData is readonly, no any place can pass the attributes 
between log4j2 components. Like the config above, we will generate the follow 
log message.

when match the filter

    <Alarm>
            <resolver>[email protected]</resolver>
            <subject>title1</subject>
            <priority>1</priority>
            <expression>^hello.*</expression>
      </Alarm>

the follow message will be log to file

{

[[email protected]|mailto:[email protected]]

subject=title1

priority=1

message=log massage

}

when match 

      <Alarm>
           <resolver>[email protected]</resolver>
           <subject>title2</subject>
           <priority>1</priority>
           <logLevel>error</logLevel>
       </Alarm>

the follow message will be log to file

{

[[email protected]|mailto:[email protected]]

subject=title2

priority=1

message=log massage

}

So, I hope that LogEvent has such a feature that users can pass data between 
log4j2 components.

thanks

> LogEvent attach a map attribute
> -------------------------------
>
>                 Key: LOG4J2-2454
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2454
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Lipeng
>            Priority: Minor
>
> We standardize the alarm base on log4j2, there are trigger rules and alarm 
> handle team on the filter, these information will log to file, then our log 
> analysis module will send mail to the team with the filter configuration. but 
> this information can not be passed to the layout module, so I want to add an 
> attribute to pass information between log4j2 components.  
> example
> <AlarmAppender name="alarm">
>     <Filters>
>         <Alarm>
>             <resolver>[email protected]</resolver>
>             <subject>title1</subject>
>             <priority>1</priority>
>             <expression>^hello.*</expression>
>       </Alarm>
>        <Alarm>
>            <resolver>[email protected]</resolver>
>            <subject>title2</subject>
>            <priority>1</priority>
>            <logLevel>error</logLevel>
>        </Alarm>
>     </Filters>
>  </AlarmAppender>



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to