You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Matt Sicker <bo...@gmail.com> on 2016/06/21 00:52:11 UTC
Re: [Dev][Log4j2]Log4j2 converter for '@' is not working
Sorry for a super late response, but this is because pattern converters
must be valid unicode identifiers just like Java variables and such.
On 20 May 2015 at 23:52, Chathura Priyankara <pr...@gmail.com>
wrote:
> What can be the issue for this ?
>
> On Tue, May 19, 2015 at 6:01 PM, Chathura Priyankara <
> priyankarahac@gmail.com> wrote:
>
>> Hi all,
>>
>> I created following simple converter to append @ sign in to a log record,
>>
>> @Plugin(name="AtSignPatternConverter", category = "Converter")
>> @ConverterKeys({"@"})
>> public class AtSignPatternConverter extends LogEventPatternConverter{
>>
>> protected AtSignPatternConverter(String name, String style) {
>> super(name, style);
>> }
>>
>> public static AtSignPatternConverter newInstance(String[] options){
>> return new AtSignPatternConverter("@","@");
>> }
>>
>> @Override
>> public void format(LogEvent event, StringBuilder toAppendTo) {
>> toAppendTo.append("@");
>> }
>> }
>>
>> However when I'm using %@ for conversion pattern. I'm getting following
>> exception.
>>
>> 2015-05-19 17:53:55,301 ERROR Unrecognized format specifier []
>> 2015-05-19 17:53:55,302 ERROR Empty conversion specifier starting at
>> position 7 in conversion pattern.
>>
>> (There are other some converters which are working fine in the same
>> package with this)
>>
>> In log4j2 is it not allowed create converter for this symbol ?
>> can anyone please explain me why this is happening ?
>>
>> Thanks,
>> Any help is highly appreciated.
>>
>> --
>> Chathura Priyankara,
>> Faculty of Information Technology,
>> University of Moratuwa.
>>
>
>
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog : www.codeoncloud.blogspot.com
>
--
Matt Sicker <bo...@gmail.com>