You may not need to write a custom appender. Have you looked at the 
ThreadContext map? Your application threads can put key-value pairs in that 
map, and following that, all log events generated by that thread will carry 
those key-value pairs. You can output the values with the %X pattern in your 
pattern layout. 

Remko

Sent from my iPhone

> On 2015/05/07, at 22:14, Chathura Priyankara <[email protected]> wrote:
> 
> Hi Beharooz,
> 
> I want to log some application specific data such as domain, userid etc using 
> custom console appender.
> Is this possible ?
> 
> Thanks!
> 
>> On Thu, May 7, 2015 at 5:20 PM, Behrooz Nobakht <[email protected]> wrote:
>> Hi,
>> 
>> What is the customization that you wanna apply?
>> 
>> Cheers,
>> Behrooz
>> 
>> 
>>> On Thu, May 7, 2015 at 1:26 PM, Chathura Priyankara 
>>> <[email protected]> wrote:
>>> Hi devs,
>>> 
>>> I want to create a custom console appender for log4j2 but I cannot find any 
>>> resource or sample about this. The only resource [1] is not enough for this.
>>> 
>>> [1] https://logging.apache.org/log4j/2.x/manual/extending.html#Appenders
>>> 
>>> Can anyone provide me a sample for this ? (both configuration and custom 
>>> appender)
>>> 
>>> Any help is appreciated.
>>> 
>>> Thanks!
>>> 
>>> -- 
>>> Chathura Priyankara,
>>> Faculty of Information Technology,
>>> University of Moratuwa.
>>> Blog  : www.codeoncloud.blogspot.com
>> 
>> 
>> 
>> -- 
>> -- Behrooz Nobakht
> 
> 
> 
> -- 
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com

Reply via email to